/[winpt]/trunk/Src/wptW32API.cpp
ViewVC logotype

Diff of /trunk/Src/wptW32API.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 196 by twoaday, Fri Apr 7 10:47:37 2006 UTC revision 204 by twoaday, Wed Apr 26 06:37:23 2006 UTC
# Line 35  Line 35 
35  #include "wptW32API.h"  #include "wptW32API.h"
36  #include "wptErrors.h"  #include "wptErrors.h"
37  #include "wptVersion.h"  #include "wptVersion.h"
38    #include "wptUTF8.h"
39  #include "wptTypes.h"  #include "wptTypes.h"
40    
41    
# Line 590  get_temp_name (char *buf, DWORD buflen, Line 591  get_temp_name (char *buf, DWORD buflen,
591  }  }
592    
593    
594    /* SetDlgItemText replacement with UTF8 support. */  
595    void
596    SetDlgItemText_utf8 (HWND dlg, int id, const char *txt)
597    {
598        char *utf8_txt;
599    
600        utf8_txt = utf8_to_native (txt);
601        SetDlgItemText (dlg, id, utf8_txt);
602        safe_free (utf8_txt);
603    }
604    
605    /* SetWindowText replacement with UTF8 support. */
606    void
607    SetWindowText_utf8 (HWND hwnd, const char *txt)
608    {
609        char *utf8_txt;
610    
611        utf8_txt = utf8_to_native (txt);
612        SetWindowText (hwnd, utf8_txt);
613        safe_free (utf8_txt);
614    }
615    
616    
617    void
618    ListBox_AddString_utf8 (HWND lb, const char *txt)
619    {
620        char *utf8_txt;
621    
622        utf8_txt = utf8_to_native (txt);
623        SendMessage (lb, LB_ADDSTRING, 0, (LPARAM)(LPCSTR)(utf8_txt));
624        safe_free (utf8_txt);
625    }
626    
627    
628    void
629    ComboBox_AddString_utf8 (HWND cb, const char *txt)
630    {
631    
632        char *utf8_txt;
633    
634        utf8_txt = utf8_to_native (txt);
635        SendMessage ((cb), CB_ADDSTRING, 0, (LPARAM)(LPCSTR)(utf8_txt));
636        safe_free (utf8_txt);
637    }
638    
639    
640    /* GetDlgItemText replacement with UTF8 support. */
641    int
642    GetDlgItemText_utf8 (HWND dlg, int id, char **r_txt)
643    {
644        int len = GetWindowTextLength (GetDlgItem (dlg, id));
645        char *txt;
646    
647        *r_txt = NULL;
648        if (len < 1)
649            return 0;
650        txt = new char[len+2];
651        if (!txt)
652            BUG (NULL);
653        GetDlgItemText (dlg, id, txt, len+1);
654        *r_txt = native_to_utf8 (txt);
655        free_if_alloc (txt);
656        return len;
657    }
658    
659    
660  struct reminder_hd_s {  struct reminder_hd_s {
661      int msecs;      int msecs;
662      HWND dlg;      HWND dlg;

Legend:
Removed from v.196  
changed lines
  Added in v.204

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26