comparison gtk/dw.c @ 283:54aafc134652

BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups, and fixed SHIFT-TAB through splitbars. Simplified the TAB and SHIFT-TAB handling code on OS/2.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 17 Mar 2003 15:33:51 +0000
parents 916045924784
children ef34ebf8b7cb
comparison
equal deleted inserted replaced
282:916045924784 283:54aafc134652
1 /* 1 /*
2 * Dynamic Windows: 2 * Dynamic Windows:
3 * A GTK like implementation of the PM GUI 3 * A GTK like implementation of the PM GUI
4 * GTK forwarder module for portabilty. 4 * GTK forwarder module for portabilty.
5 * 5 *
6 * (C) 2000-2002 Brian Smith <dbsoft@technologist.com> 6 * (C) 2000-2003 Brian Smith <dbsoft@technologist.com>
7 * 7 *
8 */ 8 */
9 #include "dw.h" 9 #include "dw.h"
10 #include <string.h> 10 #include <string.h>
11 #include <stdlib.h> 11 #include <stdlib.h>
1004 va_start(args, format); 1004 va_start(args, format);
1005 vsprintf(outbuf, format, args); 1005 vsprintf(outbuf, format, args);
1006 va_end(args); 1006 va_end(args);
1007 1007
1008 entrywindow = dw_window_new(HWND_DESKTOP, title, flStyle); 1008 entrywindow = dw_window_new(HWND_DESKTOP, title, flStyle);
1009 mainbox = dw_box_new(BOXVERT, 10); 1009 mainbox = dw_box_new(DW_VERT, 10);
1010 dw_box_pack_start(entrywindow, mainbox, 0, 0, TRUE, TRUE, 0); 1010 dw_box_pack_start(entrywindow, mainbox, 0, 0, TRUE, TRUE, 0);
1011 1011
1012 /* Archive Name */ 1012 /* Archive Name */
1013 stext = dw_text_new(outbuf, 0); 1013 stext = dw_text_new(outbuf, 0);
1014 dw_window_set_style(stext, DW_DT_WORDBREAK, DW_DT_WORDBREAK); 1014 dw_window_set_style(stext, DW_DT_WORDBREAK, DW_DT_WORDBREAK);
1015 1015
1016 dw_box_pack_start(mainbox, stext, 205, 50, TRUE, TRUE, 2); 1016 dw_box_pack_start(mainbox, stext, 205, 50, TRUE, TRUE, 2);
1017 1017
1018 /* Buttons */ 1018 /* Buttons */
1019 buttonbox = dw_box_new(BOXHORZ, 10); 1019 buttonbox = dw_box_new(DW_HORZ, 10);
1020 1020
1021 dw_box_pack_start(mainbox, buttonbox, 0, 0, TRUE, FALSE, 0); 1021 dw_box_pack_start(mainbox, buttonbox, 0, 0, TRUE, FALSE, 0);
1022 1022
1023 okbutton = dw_button_new("Ok", 1001L); 1023 okbutton = dw_button_new("Ok", 1001L);
1024 1024
1079 DWDialog *dwwait; 1079 DWDialog *dwwait;
1080 int x, y; 1080 int x, y;
1081 1081
1082 entrywindow = dw_window_new(HWND_DESKTOP, title, flStyle); 1082 entrywindow = dw_window_new(HWND_DESKTOP, title, flStyle);
1083 1083
1084 mainbox = dw_box_new(BOXVERT, 10); 1084 mainbox = dw_box_new(DW_VERT, 10);
1085 1085
1086 dw_box_pack_start(entrywindow, mainbox, 0, 0, TRUE, TRUE, 0); 1086 dw_box_pack_start(entrywindow, mainbox, 0, 0, TRUE, TRUE, 0);
1087 1087
1088 /* Archive Name */ 1088 /* Archive Name */
1089 stext = dw_text_new(text, 0); 1089 stext = dw_text_new(text, 0);
1090 dw_window_set_style(stext, DW_DT_WORDBREAK, DW_DT_WORDBREAK); 1090 dw_window_set_style(stext, DW_DT_WORDBREAK, DW_DT_WORDBREAK);
1091 1091
1092 dw_box_pack_start(mainbox, stext, 205, 50, TRUE, TRUE, 2); 1092 dw_box_pack_start(mainbox, stext, 205, 50, TRUE, TRUE, 2);
1093 1093
1094 /* Buttons */ 1094 /* Buttons */
1095 buttonbox = dw_box_new(BOXHORZ, 10); 1095 buttonbox = dw_box_new(DW_HORZ, 10);
1096 1096
1097 dw_box_pack_start(mainbox, buttonbox, 0, 0, TRUE, FALSE, 0); 1097 dw_box_pack_start(mainbox, buttonbox, 0, 0, TRUE, FALSE, 0);
1098 1098
1099 yesbutton = dw_button_new("Yes", 1001L); 1099 yesbutton = dw_button_new("Yes", 1001L);
1100 1100
1623 } 1623 }
1624 1624
1625 /* 1625 /*
1626 * Create a new Box to be packed. 1626 * Create a new Box to be packed.
1627 * Parameters: 1627 * Parameters:
1628 * type: Either BOXVERT (vertical) or BOXHORZ (horizontal). 1628 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal).
1629 * pad: Number of pixels to pad around the box. 1629 * pad: Number of pixels to pad around the box.
1630 */ 1630 */
1631 HWND dw_box_new(int type, int pad) 1631 HWND dw_box_new(int type, int pad)
1632 { 1632 {
1633 GtkWidget *tmp, *eventbox; 1633 GtkWidget *tmp, *eventbox;
1647 } 1647 }
1648 1648
1649 /* 1649 /*
1650 * Create a new Group Box to be packed. 1650 * Create a new Group Box to be packed.
1651 * Parameters: 1651 * Parameters:
1652 * type: Either BOXVERT (vertical) or BOXHORZ (horizontal). 1652 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal).
1653 * pad: Number of pixels to pad around the box. 1653 * pad: Number of pixels to pad around the box.
1654 * title: Text to be displayined in the group outline. 1654 * title: Text to be displayined in the group outline.
1655 */ 1655 */
1656 HWND dw_groupbox_new(int type, int pad, char *title) 1656 HWND dw_groupbox_new(int type, int pad, char *title)
1657 { 1657 {
5890 pad = (int)gtk_object_get_data(GTK_OBJECT(item), "boxpad"); 5890 pad = (int)gtk_object_get_data(GTK_OBJECT(item), "boxpad");
5891 item = eventbox; 5891 item = eventbox;
5892 } 5892 }
5893 } 5893 }
5894 5894
5895 if(boxtype == BOXVERT) 5895 if(boxtype == DW_VERT)
5896 gtk_table_resize(GTK_TABLE(box), boxcount + 1, 1); 5896 gtk_table_resize(GTK_TABLE(box), boxcount + 1, 1);
5897 else 5897 else
5898 gtk_table_resize(GTK_TABLE(box), 1, boxcount + 1); 5898 gtk_table_resize(GTK_TABLE(box), 1, boxcount + 1);
5899 5899
5900 gtk_table_attach(GTK_TABLE(box), item, 0, 1, 0, 1, hsize ? DW_EXPAND : 0, vsize ? DW_EXPAND : 0, pad, pad); 5900 gtk_table_attach(GTK_TABLE(box), item, 0, 1, 0, 1, hsize ? DW_EXPAND : 0, vsize ? DW_EXPAND : 0, pad, pad);
6940 #endif 6940 #endif
6941 6941
6942 /* 6942 /*
6943 * Creates a splitbar window (widget) with given parameters. 6943 * Creates a splitbar window (widget) with given parameters.
6944 * Parameters: 6944 * Parameters:
6945 * type: Value can be BOXVERT or BOXHORZ. 6945 * type: Value can be DW_VERT or DW_HORZ.
6946 * topleft: Handle to the window to be top or left. 6946 * topleft: Handle to the window to be top or left.
6947 * bottomright: Handle to the window to be bottom or right. 6947 * bottomright: Handle to the window to be bottom or right.
6948 * Returns: 6948 * Returns:
6949 * A handle to a splitbar window or NULL on failure. 6949 * A handle to a splitbar window or NULL on failure.
6950 */ 6950 */
6953 GtkWidget *tmp = NULL; 6953 GtkWidget *tmp = NULL;
6954 int _locked_by_me = FALSE; 6954 int _locked_by_me = FALSE;
6955 float *percent = malloc(sizeof(float)); 6955 float *percent = malloc(sizeof(float));
6956 6956
6957 DW_MUTEX_LOCK; 6957 DW_MUTEX_LOCK;
6958 if(type == BOXHORZ) 6958 if(type == DW_HORZ)
6959 tmp = gtk_hpaned_new(); 6959 tmp = gtk_hpaned_new();
6960 else 6960 else
6961 tmp = gtk_vpaned_new(); 6961 tmp = gtk_vpaned_new();
6962 gtk_paned_add1(GTK_PANED(tmp), topleft); 6962 gtk_paned_add1(GTK_PANED(tmp), topleft);
6963 gtk_paned_add2(GTK_PANED(tmp), bottomright); 6963 gtk_paned_add2(GTK_PANED(tmp), bottomright);
7067 pad = (int)gtk_object_get_data(GTK_OBJECT(item), "boxpad"); 7067 pad = (int)gtk_object_get_data(GTK_OBJECT(item), "boxpad");
7068 item = eventbox; 7068 item = eventbox;
7069 } 7069 }
7070 } 7070 }
7071 7071
7072 if(boxtype == BOXVERT) 7072 if(boxtype == DW_VERT)
7073 { 7073 {
7074 x = 0; 7074 x = 0;
7075 y = boxcount; 7075 y = boxcount;
7076 gtk_table_resize(GTK_TABLE(box), boxcount + 1, 1); 7076 gtk_table_resize(GTK_TABLE(box), boxcount + 1, 1);
7077 } 7077 }