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

Diff of /trunk/Src/wptCommonDlg.cpp

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

revision 149 by twoaday, Wed Dec 14 09:01:45 2005 UTC revision 150 by twoaday, Wed Jan 18 11:52:45 2006 UTC
# Line 59  http_dlg_proc (HWND dlg, UINT msg, WPARA Line 59  http_dlg_proc (HWND dlg, UINT msg, WPARA
59              BUG (0);              BUG (0);
60          if (ctx->desc != NULL)          if (ctx->desc != NULL)
61              SetWindowText (dlg, ctx->desc);              SetWindowText (dlg, ctx->desc);
62            else
63                SetWindowText (dlg, _("HTTP Key Import"));
64          if (ctx->title != NULL)          if (ctx->title != NULL)
65              SetDlgItemText (dlg, IDC_HTTP_TITLE, ctx->title);              SetDlgItemText (dlg, IDC_HTTP_TITLE, ctx->title);
66          else          else
67              SetDlgItemText (dlg, IDC_HTTP_TITLE, _("Enter URL to retrieve the public key"));              SetDlgItemText (dlg, IDC_HTTP_TITLE, _("Enter URL to retrieve the public key"));
68          SetDlgItemText (dlg, IDCANCEL, _("&Cancel"));          SetDlgItemText (dlg, IDCANCEL, _("&Cancel"));
         SetWindowText (dlg, _("HTTP Key Import"));  
69          SetForegroundWindow (dlg);          SetForegroundWindow (dlg);
70          break;          break;
71    
# Line 143  get_input_dialog (HWND root, const char Line 144  get_input_dialog (HWND root, const char
144          return NULL;          return NULL;
145      return m_strdup (ctx.url);      return m_strdup (ctx.url);
146  }  }
147    
148    #if 0
149    struct infodlg_s {
150        const char *title;
151        const char *button_1;
152        const char *button_2;
153        const char *text;
154        HICON       ico;
155        int         retval;
156    };
157    
158    /* Dialog box procedure for the info dialog. */
159    static BOOL CALLBACK
160    infodlg_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
161    {
162        static struct infodlg_s *ctx;
163    
164        switch (msg) {
165        case WM_INITDIALOG:
166            ctx = (struct infodlg_s *)lparam;
167            if (!ctx)
168                EndDialog (dlg, FALSE);
169            if (ctx->title)
170                SetWindowText (dlg, ctx->title);
171            if (ctx->text)
172                SetDlgItemText (dlg, IDC_INFODLG_TEXT, ctx->text);
173            if (ctx->button_1)
174                SetDlgItemText (dlg, IDOK, ctx->button_1);
175            if (ctx->button_2)
176                SetDlgItemText (dlg, IDCANCEL, ctx->button_2);
177            if (ctx->ico != NULL) {
178                SendMessage (GetDlgItem (dlg, IDC_INFODLG_ICO), STM_SETICON,
179                             (WPARAM)(HICON)ctx->ico, 0);
180            }
181            SetForegroundWindow (dlg);
182            return TRUE;
183    
184        case WM_COMMAND:
185            switch (LOWORD (wparam)) {
186            case IDOK:
187                ctx->retval = IDOK;
188                EndDialog (dlg, TRUE);
189                break;
190    
191            case IDCANCEL:
192                ctx->retval = IDCANCEL;
193                EndDialog (dlg, FALSE);
194                break;
195            }
196            break;
197        }
198        return FALSE;
199    }
200    
201    
202    int
203    InfoBox (HWND hwnd, LPCTSTR text, LPCTSTR title, UINT type)
204    {
205        struct infodlg_s inf;
206    
207        memset (&inf, 0, sizeof (inf));
208        inf.text = text;
209        inf.title = title;
210        if (type & MB_YESNO) {
211            inf.button_1 = _("Yes");
212            inf.button_2 = _("No");
213        }
214        else {
215            inf.button_1 = _("OK");
216            inf.button_2 = _("Cancel");
217        }
218        if (type & MB_ICONERROR)
219            inf.ico = LoadIcon (NULL, IDI_ERROR);
220        else if (type & MB_ICONWARNING)
221            inf.ico = LoadIcon (NULL,  IDI_EXCLAMATION);
222        else if (type & MB_ICONINFORMATION)
223            inf.ico = LoadIcon (NULL, IDI_INFORMATION);
224        DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_INFODLG, hwnd,
225                        infodlg_dlg_proc, (LPARAM)&inf);
226        return inf.retval;
227    }
228    
229    
230    int
231    InfoBoxEx (HWND hwnd, LPCTSTR text, LPCTSTR title, UINT type, ...)
232    {      
233        va_list arg_ptr;
234        char buf[2048];
235        int id;
236    
237        va_start (arg_ptr, type);
238        _vsnprintf (buf, sizeof (buf)-1, text, arg_ptr);    
239        id = InfoBox (hwnd, buf, title, type);
240        va_end (arg_ptr);
241        return id;
242    }
243    #endif
244    

Legend:
Removed from v.149  
changed lines
  Added in v.150

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26