Mercurial > dwindows
comparison gtk/dw.c @ 153:a371875d5486
Sync up with the latest F/X sources.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Wed, 06 Nov 2002 17:28:04 +0000 |
parents | 656de0c52c56 |
children | 840c54766306 |
comparison
equal
deleted
inserted
replaced
152:e78027768548 | 153:a371875d5486 |
---|---|
6781 ret = (void *)gtk_object_get_data(GTK_OBJECT(window), dataname); | 6781 ret = (void *)gtk_object_get_data(GTK_OBJECT(window), dataname); |
6782 DW_MUTEX_UNLOCK; | 6782 DW_MUTEX_UNLOCK; |
6783 return ret; | 6783 return ret; |
6784 } | 6784 } |
6785 | 6785 |
6786 #ifndef NO_SIGNALS | |
6787 /* | 6786 /* |
6788 * Add a callback to a window event. | 6787 * Add a callback to a window event. |
6789 * Parameters: | 6788 * Parameters: |
6790 * window: Window handle of signal to be called back. | 6789 * window: Window handle of signal to be called back. |
6791 * signame: A string pointer identifying which signal to be hooked. | 6790 * signame: A string pointer identifying which signal to be hooked. |
6947 */ | 6946 */ |
6948 void dw_signal_disconnect_by_data(HWND window, void *data) | 6947 void dw_signal_disconnect_by_data(HWND window, void *data) |
6949 { | 6948 { |
6950 dw_signal_disconnect_by_data(window, data); | 6949 dw_signal_disconnect_by_data(window, data); |
6951 } | 6950 } |
6952 #endif | 6951 |
6953 | |
6954 #ifdef TEST | |
6955 HWND mainwindow, | |
6956 listbox, | |
6957 okbutton, | |
6958 cancelbutton, | |
6959 lbbox, | |
6960 stext, | |
6961 buttonbox, | |
6962 testwindow, | |
6963 testbox, | |
6964 testok, | |
6965 testcancel, | |
6966 testbox2, | |
6967 testok2, | |
6968 testcancel2, | |
6969 notebook; | |
6970 int count = 2; | |
6971 | |
6972 int test_callback(HWND window, void *data) | |
6973 { | |
6974 dw_window_destroy((HWND)data); | |
6975 /* Return -1 to allow the default handlers to return. */ | |
6976 count--; | |
6977 if(!count) | |
6978 exit(0); | |
6979 return -1; | |
6980 } | |
6981 | |
6982 /* | |
6983 * Let's demonstrate the functionality of this library. :) | |
6984 */ | |
6985 int main(int argc, char *argv[]) | |
6986 { | |
6987 unsigned long flStyle = DW_FCF_SYSMENU | DW_FCF_TITLEBAR | | |
6988 DW_FCF_SHELLPOSITION | DW_FCF_TASKLIST | DW_FCF_DLGBORDER; | |
6989 int pageid; | |
6990 | |
6991 dw_init(TRUE, argc, argv); | |
6992 | |
6993 /* Try a little server dialog. :) */ | |
6994 mainwindow = dw_window_new(DW_DESKTOP, "Server", flStyle | DW_FCF_SIZEBORDER | DW_FCF_MINMAX); | |
6995 | |
6996 lbbox = dw_box_new(BOXVERT, 10); | |
6997 | |
6998 dw_box_pack_start(mainwindow, lbbox, 0, 0, TRUE, TRUE, 0); | |
6999 | |
7000 stext = dw_text_new("Choose a server:", 0); | |
7001 | |
7002 dw_window_set_style(stext, DW_DT_VCENTER, DW_DT_VCENTER); | |
7003 | |
7004 dw_box_pack_start(lbbox, stext, 130, 15, FALSE, FALSE, 10); | |
7005 | |
7006 listbox = dw_listbox_new(100L, FALSE); | |
7007 | |
7008 dw_box_pack_start(lbbox, listbox, 130, 200, TRUE, TRUE, 10); | |
7009 | |
7010 buttonbox = dw_box_new(BOXHORZ, 0); | |
7011 | |
7012 dw_box_pack_start(lbbox, buttonbox, 0, 0, TRUE, TRUE, 0); | |
7013 | |
7014 okbutton = dw_button_new("Ok", 1001L); | |
7015 | |
7016 dw_box_pack_start(buttonbox, okbutton, 50, 30, TRUE, TRUE, 5); | |
7017 | |
7018 cancelbutton = dw_button_new("Cancel", 1002L); | |
7019 | |
7020 dw_box_pack_start(buttonbox, cancelbutton, 50, 30, TRUE, TRUE, 5); | |
7021 | |
7022 /* Set some nice fonts and colors */ | |
7023 dw_window_set_color(lbbox, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY); | |
7024 dw_window_set_color(buttonbox, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY); | |
7025 dw_window_set_font(stext, "9.WarpSans"); | |
7026 dw_window_set_color(stext, DW_CLR_BLACK, DW_CLR_PALEGRAY); | |
7027 dw_window_set_font(listbox, "9.WarpSans"); | |
7028 dw_window_set_font(okbutton, "9.WarpSans"); | |
7029 dw_window_set_font(cancelbutton, "9.WarpSans"); | |
7030 | |
7031 dw_window_show(mainwindow); | |
7032 | |
7033 dw_window_set_usize(mainwindow, 170, 340); | |
7034 | |
7035 /* Another small example */ | |
7036 flStyle |= DW_FCF_MINMAX | DW_FCF_SIZEBORDER; | |
7037 | |
7038 testwindow = dw_window_new(DW_DESKTOP, "Wow a test dialog! :) yay!", flStyle); | |
7039 | |
7040 testbox = dw_box_new(BOXVERT, 0); | |
7041 | |
7042 dw_box_pack_start(testwindow, testbox, 0, 0, TRUE, TRUE, 0); | |
7043 | |
7044 notebook = dw_notebook_new(1010L, TRUE); | |
7045 | |
7046 dw_box_pack_start(testbox, notebook, 100, 100, TRUE, TRUE, 0); | |
7047 | |
7048 testbox = dw_box_new(BOXVERT, 10); | |
7049 | |
7050 pageid = dw_notebook_page_new(notebook, 0L, FALSE); | |
7051 | |
7052 dw_notebook_pack(notebook, pageid, testbox); | |
7053 | |
7054 dw_notebook_page_set_text(notebook, pageid, "Test page"); | |
7055 dw_notebook_page_set_status_text(notebook, pageid, "Test page"); | |
7056 | |
7057 testok = dw_button_new("Ok", 1003L); | |
7058 | |
7059 dw_box_pack_start(testbox, testok, 60, 40, TRUE, TRUE, 10); | |
7060 | |
7061 testcancel = dw_button_new("Cancel", 1004L); | |
7062 | |
7063 dw_box_pack_start(testbox, testcancel, 60, 40, TRUE, TRUE, 10); | |
7064 | |
7065 testbox2 = dw_box_new(BOXHORZ, 0); | |
7066 | |
7067 dw_box_pack_start(testbox, testbox2, 0, 0, TRUE, TRUE, 0); | |
7068 | |
7069 testok2 = dw_button_new("Ok", 1003L); | |
7070 | |
7071 dw_box_pack_start(testbox2, testok2, 60, 40, TRUE, TRUE, 10); | |
7072 | |
7073 dw_box_pack_splitbar_start(testbox2); | |
7074 | |
7075 testcancel2 = dw_button_new("Cancel", 1004L); | |
7076 | |
7077 dw_box_pack_start(testbox2, testcancel2, 60, 40, TRUE, TRUE, 10); | |
7078 | |
7079 /* Set some nice fonts and colors */ | |
7080 dw_window_set_color(testbox, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY); | |
7081 dw_window_set_color(testbox2, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY); | |
7082 dw_window_set_font(testok, "9.WarpSans"); | |
7083 dw_window_set_font(testcancel, "9.WarpSans"); | |
7084 dw_window_set_font(testok2, "9.WarpSans"); | |
7085 dw_window_set_font(testcancel2, "9.WarpSans"); | |
7086 | |
7087 dw_window_show(testwindow); | |
7088 | |
7089 /* Setup the function callbacks */ | |
7090 dw_signal_connect(okbutton, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)mainwindow); | |
7091 dw_signal_connect(cancelbutton, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)mainwindow); | |
7092 dw_signal_connect(testok, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)testwindow); | |
7093 dw_signal_connect(testcancel, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)testwindow); | |
7094 dw_signal_connect(testok2, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)testwindow); | |
7095 dw_signal_connect(testcancel2, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)testwindow); | |
7096 dw_signal_connect(mainwindow, "delete_event", DW_SIGNAL_FUNC(test_callback), (void *)mainwindow); | |
7097 dw_signal_connect(testwindow, "delete_event", DW_SIGNAL_FUNC(test_callback), (void *)testwindow); | |
7098 | |
7099 dw_main(); | |
7100 | |
7101 return 0; | |
7102 } | |
7103 #endif | |
7104 |