comparison gtk/dw.c @ 427:b0e2ba7c46c5

For message boxes that have icons, increase the size of the text area (and hence the complete window) by the width of the icon. In dw_mle_export(), force the return value to be NULL in case passed window is "invalid". For dw_mle_export() under GTK 1.2, reduce the number endpoint by 1. This is so that the "bytes" return value from dw_mle_query() can be passed in directly.
author mhessling@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 26 May 2003 07:39:38 +0000
parents 1f92eadea7d3
children f977c80a1dfa
comparison
equal deleted inserted replaced
426:1f92eadea7d3 427:b0e2ba7c46c5
1166 ULONG flStyle = DW_FCF_TITLEBAR | DW_FCF_SHELLPOSITION | DW_FCF_DLGBORDER; 1166 ULONG flStyle = DW_FCF_TITLEBAR | DW_FCF_SHELLPOSITION | DW_FCF_DLGBORDER;
1167 DWDialog *dwwait; 1167 DWDialog *dwwait;
1168 va_list args; 1168 va_list args;
1169 char outbuf[256]; 1169 char outbuf[256];
1170 char **xpm_data = NULL; 1170 char **xpm_data = NULL;
1171 int x, y; 1171 int x, y, extra_width=0;
1172 1172
1173 va_start(args, format); 1173 va_start(args, format);
1174 vsprintf(outbuf, format, args); 1174 vsprintf(outbuf, format, args);
1175 va_end(args); 1175 va_end(args);
1176 1176
1198 else if(flags & DW_MB_INFORMATION) 1198 else if(flags & DW_MB_INFORMATION)
1199 xpm_data = (char **)_dw_messagebox_information; 1199 xpm_data = (char **)_dw_messagebox_information;
1200 else if(flags & DW_MB_QUESTION) 1200 else if(flags & DW_MB_QUESTION)
1201 xpm_data = (char **)_dw_messagebox_question; 1201 xpm_data = (char **)_dw_messagebox_question;
1202 1202
1203 if(xpm_data)
1204 extra_width = 32;
1205
1203 if(texttargetbox == imagetextbox) 1206 if(texttargetbox == imagetextbox)
1204 { 1207 {
1205 GdkPixmap *icon_pixmap = NULL; 1208 GdkPixmap *icon_pixmap = NULL;
1206 GdkBitmap *bitmap = NULL; 1209 GdkBitmap *bitmap = NULL;
1207 HWND handle = dw_bitmap_new( 100 ); 1210 HWND handle = dw_bitmap_new( 100 );
1226 } 1229 }
1227 1230
1228 /* Create text */ 1231 /* Create text */
1229 stext = dw_text_new(outbuf, 0); 1232 stext = dw_text_new(outbuf, 0);
1230 dw_window_set_style(stext, DW_DT_WORDBREAK, DW_DT_WORDBREAK); 1233 dw_window_set_style(stext, DW_DT_WORDBREAK, DW_DT_WORDBREAK);
1231 dw_box_pack_start(texttargetbox, stext, 235, 50, TRUE, TRUE, 2); 1234 dw_box_pack_start(texttargetbox, stext, 235+extra_width, 50, TRUE, TRUE, 2);
1232 1235
1233 /* Buttons */ 1236 /* Buttons */
1234 buttonbox = dw_box_new(DW_HORZ, 10); 1237 buttonbox = dw_box_new(DW_HORZ, 10);
1235 1238
1236 dw_box_pack_start(mainbox, buttonbox, 0, 0, TRUE, FALSE, 0); 1239 dw_box_pack_start(mainbox, buttonbox, 0, 0, TRUE, FALSE, 0);
1273 cancelbutton = dw_button_new("Cancel", 1003L); 1276 cancelbutton = dw_button_new("Cancel", 1003L);
1274 dw_box_pack_start(buttonbox, cancelbutton, 50, 30, TRUE, FALSE, 2); 1277 dw_box_pack_start(buttonbox, cancelbutton, 50, 30, TRUE, FALSE, 2);
1275 dw_signal_connect(cancelbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_cancel_func), (void *)dwwait); 1278 dw_signal_connect(cancelbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_cancel_func), (void *)dwwait);
1276 } 1279 }
1277 1280
1278 x = (dw_screen_width() - 280)/2; 1281 x = (dw_screen_width() - (280+extra_width))/2;
1279 y = (dw_screen_height() - 150)/2; 1282 y = (dw_screen_height() - 150)/2;
1280 1283
1281 dw_window_set_pos_size(entrywindow, x, y, 280, 150); 1284 dw_window_set_pos_size(entrywindow, x, y, (280+extra_width), 150);
1282 1285
1283 dw_window_show(entrywindow); 1286 dw_window_show(entrywindow);
1284 1287
1285 return (int)dw_dialog_wait(dwwait);; 1288 return (int)dw_dialog_wait(dwwait);
1286 } 1289 }
1287 1290
1288 /* 1291 /*
1289 * Minimizes or Iconifies a top-level window. 1292 * Minimizes or Iconifies a top-level window.
1290 * Parameters: 1293 * Parameters:
3058 { 3061 {
3059 int _locked_by_me = FALSE; 3062 int _locked_by_me = FALSE;
3060 gchar *text; 3063 gchar *text;
3061 3064
3062 DW_MUTEX_LOCK; 3065 DW_MUTEX_LOCK;
3066 /* force the return value to nul in case the following tests fail */
3067 if(buffer)
3068 strcpy(buffer,"");
3063 #if GTK_MAJOR_VERSION > 1 3069 #if GTK_MAJOR_VERSION > 1
3064 if(GTK_IS_SCROLLED_WINDOW(handle)) 3070 if(GTK_IS_SCROLLED_WINDOW(handle))
3065 #else 3071 #else
3066 if(GTK_IS_BOX(handle)) 3072 if(GTK_IS_BOX(handle))
3067 #endif 3073 #endif
3077 tbuffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (tmp)); 3083 tbuffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (tmp));
3078 gtk_text_buffer_get_iter_at_offset(tbuffer, &start, startpoint); 3084 gtk_text_buffer_get_iter_at_offset(tbuffer, &start, startpoint);
3079 gtk_text_buffer_get_iter_at_offset(tbuffer, &end, startpoint + length); 3085 gtk_text_buffer_get_iter_at_offset(tbuffer, &end, startpoint + length);
3080 text = gtk_text_iter_get_text(&start, &end); 3086 text = gtk_text_iter_get_text(&start, &end);
3081 if(text) /* Should this get freed? */ 3087 if(text) /* Should this get freed? */
3082 strcpy(buffer, text); 3088 {
3089 if(buffer)
3090 strcpy(buffer, text);
3091 }
3083 } 3092 }
3084 #else 3093 #else
3085 if(tmp && GTK_IS_TEXT(tmp)) 3094 if(tmp && GTK_IS_TEXT(tmp))
3086 { 3095 {
3087 text = gtk_editable_get_chars(GTK_EDITABLE(&(GTK_TEXT(tmp)->editable)), startpoint, startpoint + length); 3096 text = gtk_editable_get_chars(GTK_EDITABLE(&(GTK_TEXT(tmp)->editable)), startpoint, startpoint + length - 1);
3088 if(text) 3097 if(text)
3089 { 3098 {
3090 strcpy(buffer, text); 3099 if(buffer)
3100 strcpy(buffer, text);
3091 g_free(text); 3101 g_free(text);
3092 } 3102 }
3093 } 3103 }
3094 #endif 3104 #endif
3095 } 3105 }