Mercurial > dwindows
comparison gtk/dw.c @ 401:306ce9765a61
Fixes for new message box code. Also incorporated a fix from dw_window_set
_usize() into dw_window_set_pos_size(). Finally moved xpm files into the
gtk/ subdirectory.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sat, 10 May 2003 06:49:32 +0000 |
parents | a7a561103eac |
children | 0f0183aa2b05 |
comparison
equal
deleted
inserted
replaced
400:3d4c34bb7834 | 401:306ce9765a61 |
---|---|
23 #endif | 23 #endif |
24 #if GTK_MAJOR_VERSION > 1 | 24 #if GTK_MAJOR_VERSION > 1 |
25 #include <gdk-pixbuf/gdk-pixbuf.h> | 25 #include <gdk-pixbuf/gdk-pixbuf.h> |
26 #endif | 26 #endif |
27 | 27 |
28 #include "messagebox_error.xpm" | 28 #include "gtk/messagebox_error.xpm" |
29 #include "messagebox_warning.xpm" | 29 #include "gtk/messagebox_warning.xpm" |
30 #include "messagebox_information.xpm" | 30 #include "gtk/messagebox_information.xpm" |
31 #include "messagebox_question.xpm" | 31 #include "gtk/messagebox_question.xpm" |
32 | 32 |
33 /* These are used for resource management */ | 33 /* These are used for resource management */ |
34 #if defined(DW_RESOURCES) && !defined(BUILD_DLL) | 34 #if defined(DW_RESOURCES) && !defined(BUILD_DLL) |
35 extern DWResources _resources; | 35 extern DWResources _resources; |
36 #endif | 36 #endif |
1140 va_end(args); | 1140 va_end(args); |
1141 | 1141 |
1142 entrywindow = dw_window_new(HWND_DESKTOP, title, flStyle); | 1142 entrywindow = dw_window_new(HWND_DESKTOP, title, flStyle); |
1143 mainbox = dw_box_new(DW_VERT, 10); | 1143 mainbox = dw_box_new(DW_VERT, 10); |
1144 dw_box_pack_start(entrywindow, mainbox, 0, 0, TRUE, TRUE, 0); | 1144 dw_box_pack_start(entrywindow, mainbox, 0, 0, TRUE, TRUE, 0); |
1145 /* delete me */dw_window_set_color(mainbox, DW_CLR_BLACK, DW_CLR_RED); | 1145 |
1146 | 1146 /* determine if an icon is to be used - if so we need another HORZ box */ |
1147 /* determine if an icon is to be used - if so we need another HORZ box */ | |
1148 if((flags & DW_MB_ERROR) | (flags & DW_MB_WARNING) | (flags & DW_MB_INFORMATION) | (flags & DW_MB_QUESTION)) | 1147 if((flags & DW_MB_ERROR) | (flags & DW_MB_WARNING) | (flags & DW_MB_INFORMATION) | (flags & DW_MB_QUESTION)) |
1149 { | 1148 { |
1150 imagetextbox = dw_box_new(DW_HORZ, 101); | 1149 imagetextbox = dw_box_new(DW_HORZ, 0); |
1151 dw_box_pack_start(mainbox, imagetextbox, 0, 0, TRUE, TRUE, 2); | 1150 dw_box_pack_start(mainbox, imagetextbox, 0, 0, TRUE, TRUE, 2); |
1152 texttargetbox = imagetextbox; | 1151 texttargetbox = imagetextbox; |
1153 /* delete me */dw_window_set_color(imagetextbox, DW_CLR_BLACK, DW_CLR_YELLOW); | |
1154 } | 1152 } |
1155 else | 1153 else |
1156 { | 1154 { |
1157 imagetextbox = NULL; | 1155 imagetextbox = NULL; |
1158 texttargetbox = mainbox; | 1156 texttargetbox = mainbox; |
1193 } | 1191 } |
1194 | 1192 |
1195 /* Create text */ | 1193 /* Create text */ |
1196 stext = dw_text_new(outbuf, 0); | 1194 stext = dw_text_new(outbuf, 0); |
1197 dw_window_set_style(stext, DW_DT_WORDBREAK, DW_DT_WORDBREAK); | 1195 dw_window_set_style(stext, DW_DT_WORDBREAK, DW_DT_WORDBREAK); |
1198 dw_box_pack_start(texttargetbox, stext, 205, 50, TRUE, TRUE, 2); | 1196 dw_box_pack_start(texttargetbox, stext, 235, 50, TRUE, TRUE, 2); |
1199 | 1197 |
1200 /* Buttons */ | 1198 /* Buttons */ |
1201 buttonbox = dw_box_new(DW_HORZ, 10); | 1199 buttonbox = dw_box_new(DW_HORZ, 10); |
1202 | 1200 |
1203 dw_box_pack_start(mainbox, buttonbox, 0, 0, TRUE, FALSE, 0); | 1201 dw_box_pack_start(mainbox, buttonbox, 0, 0, TRUE, FALSE, 0); |
1204 /* delete me */dw_window_set_color(buttonbox, DW_CLR_BLACK, DW_CLR_WHITE); | |
1205 | 1202 |
1206 dwwait = dw_dialog_new((void *)entrywindow); | 1203 dwwait = dw_dialog_new((void *)entrywindow); |
1207 | 1204 |
1208 /* which buttons ? */ | 1205 /* which buttons ? */ |
1209 if(flags & DW_MB_OK) | 1206 if(flags & DW_MB_OK) |
1210 { | 1207 { |
1211 okbutton = dw_button_new("Ok", 1001L); | 1208 okbutton = dw_button_new("Ok", 1001L); |
1212 dw_box_pack_start(buttonbox, okbutton, 50, 30, TRUE, FALSE, 2); | 1209 dw_box_pack_start(buttonbox, okbutton, 50, 30, TRUE, FALSE, 2); |
1213 dw_signal_connect(okbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_ok_func), (void *)dwwait); | 1210 dw_signal_connect(okbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_ok_func), (void *)dwwait); |
1241 cancelbutton = dw_button_new("Cancel", 1003L); | 1238 cancelbutton = dw_button_new("Cancel", 1003L); |
1242 dw_box_pack_start(buttonbox, cancelbutton, 50, 30, TRUE, FALSE, 2); | 1239 dw_box_pack_start(buttonbox, cancelbutton, 50, 30, TRUE, FALSE, 2); |
1243 dw_signal_connect(cancelbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_cancel_func), (void *)dwwait); | 1240 dw_signal_connect(cancelbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_cancel_func), (void *)dwwait); |
1244 } | 1241 } |
1245 | 1242 |
1246 x = (dw_screen_width() - 220)/2; | 1243 x = (dw_screen_width() - 280)/2; |
1247 y = (dw_screen_height() - 110)/2; | 1244 y = (dw_screen_height() - 150)/2; |
1248 | 1245 |
1249 dw_window_set_pos_size(entrywindow, x, y, 220, 110); | 1246 dw_window_set_pos_size(entrywindow, x, y, 280, 150); |
1250 | 1247 |
1251 dw_window_show(entrywindow); | 1248 dw_window_show(entrywindow); |
1252 | 1249 |
1253 return (int)dw_dialog_wait(dwwait);; | 1250 return (int)dw_dialog_wait(dwwait);; |
1254 } | 1251 } |
6308 return; | 6305 return; |
6309 | 6306 |
6310 DW_MUTEX_LOCK; | 6307 DW_MUTEX_LOCK; |
6311 if(GTK_IS_WINDOW(handle)) | 6308 if(GTK_IS_WINDOW(handle)) |
6312 { | 6309 { |
6313 _size_allocate(GTK_WINDOW(handle)); | 6310 dw_window_set_usize(handle, width, height); |
6314 | |
6315 gtk_widget_set_uposition(handle, x, y); | 6311 gtk_widget_set_uposition(handle, x, y); |
6316 if(handle->window) | |
6317 gdk_window_resize(handle->window, width - _dw_border_width, height - _dw_border_height); | |
6318 gtk_window_set_default_size(GTK_WINDOW(handle), width - _dw_border_width, height - _dw_border_height); | |
6319 } | 6312 } |
6320 else if(handle->window) | 6313 else if(handle->window) |
6321 { | 6314 { |
6322 gdk_window_resize(handle->window, width, height); | 6315 gdk_window_resize(handle->window, width, height); |
6323 gdk_window_move(handle->window, x, y); | 6316 gdk_window_move(handle->window, x, y); |