You can subscribe to this list here.
2003 |
Jan
(30) |
Feb
(20) |
Mar
(151) |
Apr
(86) |
May
(23) |
Jun
(25) |
Jul
(107) |
Aug
(141) |
Sep
(55) |
Oct
(85) |
Nov
(65) |
Dec
(2) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(22) |
Feb
(18) |
Mar
(3) |
Apr
(16) |
May
(69) |
Jun
(3) |
Jul
(1) |
Aug
(3) |
Sep
(1) |
Oct
|
Nov
(6) |
Dec
(1) |
2005 |
Jan
(2) |
Feb
(16) |
Mar
|
Apr
|
May
|
Jun
(47) |
Jul
(1) |
Aug
|
Sep
(6) |
Oct
(4) |
Nov
|
Dec
(34) |
2006 |
Jan
(39) |
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
(5) |
Oct
|
Nov
(4) |
Dec
|
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2008 |
Jan
|
Feb
|
Mar
(26) |
Apr
(1) |
May
(1) |
Jun
|
Jul
(5) |
Aug
(2) |
Sep
(8) |
Oct
(8) |
Nov
(22) |
Dec
(30) |
2009 |
Jan
(10) |
Feb
(13) |
Mar
(14) |
Apr
(14) |
May
(32) |
Jun
(25) |
Jul
(36) |
Aug
(10) |
Sep
(2) |
Oct
|
Nov
|
Dec
(10) |
2010 |
Jan
(9) |
Feb
(4) |
Mar
(2) |
Apr
(1) |
May
(2) |
Jun
(2) |
Jul
(1) |
Aug
(4) |
Sep
|
Oct
(1) |
Nov
|
Dec
|
From: <kr_...@us...> - 2004-01-04 13:15:14
|
Update of /cvsroot/htoolkit/HSQL/PostgreSQL In directory sc8-pr-cvs1:/tmp/cvs-serv27195/PostgreSQL Modified Files: HSQL.hsc Log Message: Make the HSQL package compatible with Hugs Index: HSQL.hsc =================================================================== RCS file: /cvsroot/htoolkit/HSQL/PostgreSQL/HSQL.hsc,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** HSQL.hsc 27 Sep 2003 09:49:19 -0000 1.10 --- HSQL.hsc 4 Jan 2004 13:14:58 -0000 1.11 *************** *** 141,145 **** { seFieldName :: String } ! deriving (Show, Typeable) ----------------------------------------------------------------------------------------- --- 141,151 ---- { seFieldName :: String } ! deriving Show ! ! sqlErrorTc :: TyCon ! sqlErrorTc = mkTyCon "Database.ODBC.HSQL.SqlError" ! ! instance Typeable SqlError where ! typeOf _ = mkAppTy sqlErrorTc [] ----------------------------------------------------------------------------------------- |
From: <kr_...@us...> - 2004-01-04 13:15:13
|
Update of /cvsroot/htoolkit/HSQL In directory sc8-pr-cvs1:/tmp/cvs-serv27195 Modified Files: Makefile config.mk.in configure.ac hsql.pkg.in Log Message: Make the HSQL package compatible with Hugs Index: Makefile =================================================================== RCS file: /cvsroot/htoolkit/HSQL/Makefile,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Makefile 7 Sep 2003 22:56:18 -0000 1.5 --- Makefile 4 Jan 2004 13:14:53 -0000 1.6 *************** *** 13,18 **** --- 13,34 ---- endif + COMPILERS = + ifneq "$(GHC)" "" + COMPILERS += ghc + endif + ifneq "$(HUGS)" "" + COMPILERS += hugs + endif + OBJS = $(patsubst %.hs,%.o, $(HS_SRC)) HI_SRC = $(patsubst %.hs,%.hi,$(HS_SRC)) + SO_SRC = $(patsubst %.hs,%.$(SO_EXT),$(HS_SRC)) + + FFIHUGS_FLAGS = $(patsubst %, +L"%", $(CPPFLAGS)) + ifeq "$(WINODBC)" "YES" + FFIHUGS_FLAGS += $(patsubst %, +L"%", $(patsubst -l%, %.lib, $(LDFLAGS))) + else + FFIHUGS_FLAGS += $(patsubst %, +L"%", $(LDFLAGS)) + endif ifeq "$(HADDOCK)" "" *************** *** 29,36 **** %.hs : %.hsc $(HSC2HS) $< $(CPPFLAGS) %.raw-hs : %.hs $(GHC) -Iincludes $(CPPFLAGS) -D__HADDOCK__ -E -cpp $< -o $<.tmp && sed -e 's/^#.*//' <$<.tmp >$@ ! all: libHSsql.a libHSsql.a: $(OBJS) --- 45,58 ---- %.hs : %.hsc $(HSC2HS) $< $(CPPFLAGS) + %.$(SO_EXT): %.hs + $(FFIHUGS) -98 +G $(FFIHUGS_FLAGS) $< %.raw-hs : %.hs $(GHC) -Iincludes $(CPPFLAGS) -D__HADDOCK__ -E -cpp $< -o $<.tmp && sed -e 's/^#.*//' <$<.tmp >$@ ! ! all: $(patsubst %, all-%, $(COMPILERS)) ! all-ghc: libHSsql.a ! all-hugs: $(SO_SRC) ! libHSsql.a: $(OBJS) *************** *** 42,68 **** depend: $(HS_SRC) $(GHC) -M $^ ! clean: rm -f $(OBJS) rm -f $(HI_SRC) rm -f $(HS_PPS) ! docs : $(HS_PPS) mkdir -p doc $(HADDOCK) -h -o doc $(HS_PPS) ! install: libHSsql.a $(HI_SRC) docs ! $(INSTALL) libHSsql.a $(prefix)/libHSsql.a ! $(INSTALL) -d $(prefix)/imports/Database for i in $(HI_SRC); do \ ! $(INSTALL) -d $(prefix)/imports/Database/`dirname $$i`; \ ! $(INSTALL) -c $$i $(prefix)/imports/Database/`dirname $$i`; \ done ! rm -f $(prefix)/HSsql.o $(GHC_PKG) -u -g -i hsql.pkg if test -f doc/index.html; then \ ! $(INSTALL) -d $(prefix)/doc/html/hsql; \ ! $(INSTALL) -c doc/* $(prefix)/doc/html/hsql; \ fi ! ODBC/HSQL.hs : ODBC/HSQLStructs.h --- 64,113 ---- depend: $(HS_SRC) $(GHC) -M $^ ! ! genclean: distclean ! rm -rf configure autom4te.cache ! ! distclean: clean ! rm -f libHSsql.a ! rm -f config.status config.log config.mk hsql.pkg ! clean: rm -f $(OBJS) rm -f $(HI_SRC) + rm -f $(SO_SRC) + rm -f $(HS_SRC) + rm -f $(patsubst %.hs,%.c,$(HS_SRC)) rm -f $(HS_PPS) ! rm -rf $(patsubst %.o,%_split, $(OBJS)) ! ! docs : $(HS_PPS) mkdir -p doc $(HADDOCK) -h -o doc $(HS_PPS) ! ! install: $(patsubst %, install-%, $(COMPILERS)) ! ! install-ghc: libHSsql.a $(HI_SRC) docs ! $(INSTALL) libHSsql.a $(GHC_DIR)/libHSsql.a ! $(INSTALL) -d $(GHC_DIR)/imports/Database for i in $(HI_SRC); do \ ! $(INSTALL) -d $(GHC_DIR)/imports/Database/`dirname $$i`; \ ! $(INSTALL) -c $$i $(GHC_DIR)/imports/Database/`dirname $$i`; \ done ! rm -f $(GHC_DIR)/HSsql.o $(GHC_PKG) -u -g -i hsql.pkg if test -f doc/index.html; then \ ! $(INSTALL) -d $(GHC_DIR)/doc/html/hsql; \ ! $(INSTALL) -c doc/* $(GHC_DIR)/doc/html/hsql; \ fi ! install-hugs: $(HS_SRC) $(SO_SRC) ! $(INSTALL) -d $(HUGS_DIR)/libraries/Database ! for i in $(HS_SRC) $(SO_SRC); do \ ! $(INSTALL) -d $(HUGS_DIR)/libraries/Database/`dirname $$i`; \ ! $(INSTALL) -c $$i $(HUGS_DIR)/libraries/Database/`dirname $$i`; \ ! done ! ! ! ODBC/HSQL.hs : ODBC/HsODBC.h Index: config.mk.in =================================================================== RCS file: /cvsroot/htoolkit/HSQL/config.mk.in,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** config.mk.in 5 Sep 2003 11:37:55 -0000 1.1 --- config.mk.in 4 Jan 2004 13:14:54 -0000 1.2 *************** *** 3,14 **** WithMySQL=@WithMySQL@ ! GHC = @GHC@ ! HSC2HS = @HSC2HS@ AR = @AR@ LD = @LD@ INSTALL = @INSTALL@ ! GHC_PKG = @GHC_PKG@ ! prefix = @prefix@ ! exec_prefix = @exec_prefix@ CPPFLAGS = @CPPFLAGS@ HADDOCK = @HADDOCK@ --- 3,25 ---- WithMySQL=@WithMySQL@ ! SO_EXT = @SO_EXT@ ! ! WINODBC=@WINODBC@ ! AR = @AR@ LD = @LD@ INSTALL = @INSTALL@ ! CPPFLAGS = @CPPFLAGS@ + LDFLAGS = @LDFLAGS@ + + HSC2HS = @HSC2HS@ HADDOCK = @HADDOCK@ + + GHC = @GHC@ + GHC_DIR = @GHC_DIR@ + GHC_PKG = @GHC_PKG@ + + HUGS = @HUGS@ + HUGS_DIR = @HUGS_DIR@ + FFIHUGS = @FFIHUGS@ Index: configure.ac =================================================================== RCS file: /cvsroot/htoolkit/HSQL/configure.ac,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** configure.ac 7 Sep 2003 09:09:47 -0000 1.5 --- configure.ac 4 Jan 2004 13:14:54 -0000 1.6 *************** *** 53,65 **** if test "$GHC" = "" || test ! -f $GHC; then ! AC_MSG_ERROR([GHC is required to build the package]) fi AC_SUBST(GHC) ! if test "$prefix" = "NONE"; then ! prefix=`$GHC --print-libdir` fi dnl *********************************************** dnl hsc2hs --- 53,81 ---- if test "$GHC" = "" || test ! -f $GHC; then ! AC_MSG_RESULT([The build for GHC will be skiped.]) ! GHC="" fi AC_SUBST(GHC) ! dnl *********************************************** ! dnl GHC directory ! dnl *********************************************** ! AC_ARG_WITH(ghc-dir, ! [ --with-ghc-dir=<ghc directory> ! Install GHC libraries in the given GHC directory (default is "ghc --print-libdir") ! ], ! [GHC_DIR="$withval"], ! [GHC_DIR=`$GHC --print-libdir`] ! ) ! ! if test "$GHC" != ""; then ! if test "$GHC_DIR" = "" || test ! -d $GHC_DIR; then ! AC_MSG_ERROR([GHC_DIR $GHC_DIR does not exist]) ! fi fi + AC_SUBST(GHC_DIR) + dnl *********************************************** dnl hsc2hs *************** *** 97,100 **** --- 113,179 ---- dnl *********************************************** + dnl HUGS + dnl *********************************************** + AC_ARG_WITH(hugs, + [ --with-hugs=<hugs command> + Use a different command instead of 'hugs' for the Hugs interpreter. + ], + [HUGS="$withval"], + [AC_PATH_PROG(HUGS,hugs)] + ) + + if test "$HUGS" = "" || test ! -f $HUGS; then + AC_MSG_RESULT([The build for HUGS will be skiped.]) + HUGS="" + fi + + case $ac_cv_target_alias in + i[[3456]]86-*-cygwin*|i[[3456]]86-*-mingw32*) + SO_EXT=dll;; + *) SO_EXT=so;; + esac + + AC_SUBST(HUGS) + AC_SUBST(SO_EXT) + + dnl *********************************************** + dnl Hugs directory + dnl *********************************************** + AC_ARG_WITH(hugs-dir, + [ --with-hugs-dir=<hugs directory> + Install Hugs libraries in the given Hugs directory (default is the path to hugs) + ], + [HUGS_DIR="$withval"], + [HUGS_DIR=$(dirname $HUGS)] + ) + + if test "$HUGS" != ""; then + if test "$HUGS_DIR" = "" || test ! -d $HUGS_DIR; then + AC_MSG_ERROR([HUGS_DIR $HUGS_DIR does not exist]) + fi + fi + + AC_SUBST(HUGS_DIR) + + dnl *********************************************** + dnl FFIHUGS + dnl *********************************************** + AC_ARG_WITH(ffihugs, + [ --with-ffihugs=<ffihugs command> + Use a different command instead of 'ffihugs' for the Hugs FFI compiler. + ], + [FFIHUGS="$withval"], + [AC_PATH_PROG(FFIHUGS,ffihugs)] + ) + + if test "$HUGS" != ""; then + if test "$FFIHUGS" = "" || test ! -f $FFIHUGS; then + AC_MSG_ERROR([ffihugs is required to build the Hugs libraries]) + fi + fi + + AC_SUBST(FFIHUGS) + + dnl *********************************************** dnl HADDOCK dnl *********************************************** *************** *** 108,112 **** if test "$HADDOCK" = "" || test ! -f $HADDOCK; then ! echo HADDOCK is required to build the documentations fi --- 187,191 ---- if test "$HADDOCK" = "" || test ! -f $HADDOCK; then ! AC_MSG_RESULT([HADDOCK is required to build the documentations]) fi *************** *** 131,134 **** --- 210,215 ---- dnl *********************************************** + WINODBC=NO + if test $WithODBC = YES; then case $ac_cv_target_alias in *************** *** 145,150 **** } ], ! [LIBS="${LIBS} -lodbc32"], AC_MSG_ERROR([sqlext.h and libodbc required to build ODBC building.])) ;; *) AC_CHECK_HEADER(sqlext.h,,AC_MSG_ERROR([sqlext.h and libodbc required to build ODBC building.])) --- 226,233 ---- } ], ! [LDFLAGS="${LDFLAGS} -lodbc32"], AC_MSG_ERROR([sqlext.h and libodbc required to build ODBC building.])) + CPPFLAGS="$CPPFLAGS -DWINODBC" + WINODBC=YES ;; *) AC_CHECK_HEADER(sqlext.h,,AC_MSG_ERROR([sqlext.h and libodbc required to build ODBC building.])) *************** *** 156,159 **** --- 239,244 ---- fi + AC_SUBST(WINODBC) + dnl *********************************************** dnl check for headers and libraries for PostgreSQL *************** *** 206,218 **** dnl *********************************************** ! LL="$LIBS $LDFLAGS" ! ! if test "x$prefix" != xNONE; then ! LIB_DIRS='"'${prefix}'"' ! else ! LIB_DIRS='"'${ac_default_prefix}'"' ! fi ! for lib_opt in ${LL} do case $lib_opt in --- 291,297 ---- dnl *********************************************** ! LIB_DIRS='"'${GHC_DIR}'"' ! for lib_opt in ${LDFLAGS} do case $lib_opt in *************** *** 229,237 **** AC_SUBST(CPPFLAGS) AC_SUBST(DEP_LIBS) AC_SUBST(LIB_DIRS) - AC_SUBST(prefix) - AC_SUBST(exec_prefix) - AC_SUBST(libdir) AC_OUTPUT --- 308,314 ---- AC_SUBST(CPPFLAGS) + AC_SUBST(LDFLAGS) AC_SUBST(DEP_LIBS) AC_SUBST(LIB_DIRS) AC_OUTPUT Index: hsql.pkg.in =================================================================== RCS file: /cvsroot/htoolkit/HSQL/hsql.pkg.in,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** hsql.pkg.in 5 Sep 2003 21:44:10 -0000 1.2 --- hsql.pkg.in 4 Jan 2004 13:14:55 -0000 1.3 *************** *** 2,6 **** {name = "hsql", auto=True, ! import_dirs = ["@prefix@/imports"], source_dirs = [], library_dirs = [@LIB_DIRS@], --- 2,6 ---- {name = "hsql", auto=True, ! import_dirs = ["@GHC_DIR@/imports"], source_dirs = [], library_dirs = [@LIB_DIRS@], |
From: <kr_...@us...> - 2004-01-04 13:15:11
|
Update of /cvsroot/htoolkit/HSQL/MySQL In directory sc8-pr-cvs1:/tmp/cvs-serv27195/MySQL Modified Files: HSQL.hsc Log Message: Make the HSQL package compatible with Hugs Index: HSQL.hsc =================================================================== RCS file: /cvsroot/htoolkit/HSQL/MySQL/HSQL.hsc,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** HSQL.hsc 27 Sep 2003 09:49:19 -0000 1.10 --- HSQL.hsc 4 Jan 2004 13:14:58 -0000 1.11 *************** *** 108,112 **** { seFieldName :: String } ! deriving (Typeable, Show) ----------------------------------------------------------------------------------------- --- 108,119 ---- { seFieldName :: String } ! deriving Show ! ! sqlErrorTc :: TyCon ! sqlErrorTc = mkTyCon "Database.ODBC.HSQL.SqlError" ! ! instance Typeable SqlError where ! typeOf _ = mkAppTy sqlErrorTc [] ! ----------------------------------------------------------------------------------------- |
From: <kr_...@us...> - 2004-01-04 10:22:37
|
Update of /cvsroot/htoolkit/HSQL/ODBC In directory sc8-pr-cvs1:/tmp/cvs-serv740/ODBC Modified Files: HSQL.hsc Log Message: bugfix Index: HSQL.hsc =================================================================== RCS file: /cvsroot/htoolkit/HSQL/ODBC/HSQL.hsc,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** HSQL.hsc 27 Sep 2003 09:49:19 -0000 1.8 --- HSQL.hsc 4 Jan 2004 10:22:34 -0000 1.9 *************** *** 169,181 **** pMsg <- mallocBytes 256 pTextLen <- malloc ! sqlGetDiagRec handleType handle 1 pState pNative pMsg 256 pTextLen ! state <- peekCString pState free pState - native <- peek pNative free pNative - msg <- peekCString pMsg free pMsg free pTextLen ! throwDyn (SqlError {seState=state, seNativeError=fromIntegral native, seErrorMsg=msg}) | otherwise = error (show res) --- 169,185 ---- pMsg <- mallocBytes 256 pTextLen <- malloc ! res <- sqlGetDiagRec handleType handle 1 pState pNative pMsg 256 pTextLen ! e <- if res == (#const SQL_NO_DATA) ! then return SqlNoData ! else do ! state <- peekCString pState ! native <- peek pNative ! msg <- peekCString pMsg ! return (SqlError {seState=state, seNativeError=fromIntegral native, seErrorMsg=msg}) free pState free pNative free pMsg free pTextLen ! throwDyn e | otherwise = error (show res) |
From: <kr_...@us...> - 2003-12-14 11:11:37
|
Update of /cvsroot/htoolkit/port/src/cbits/GTK In directory sc8-pr-cvs1:/tmp/cvs-serv5205/src/cbits/GTK Modified Files: PopUp.c Log Message: Use the new GtkComboBox widget instead of the deprecated GtkCombo Index: PopUp.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/PopUp.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** PopUp.c 12 Oct 2003 22:20:23 -0000 1.9 --- PopUp.c 14 Dec 2003 11:11:26 -0000 1.10 *************** *** 3,24 **** #include "Handlers_stub.h" - static void handleLBoxClick(GtkList *list, gpointer user_data) - { - handleControlCommand((GtkWidget *) user_data); - }; - WindowHandle osCreatePopUp(WindowHandle window) { GtkWidget *popup; ! popup = gtk_combo_new(); ! gtk_entry_set_editable (GTK_ENTRY(GTK_COMBO(popup)->entry), gtk_false()); ! gtk_combo_set_use_arrows_always(GTK_COMBO(popup), gtk_true()); ! gtk_signal_connect(GTK_OBJECT(GTK_COMBO(popup)->entry), "changed", ! GTK_SIGNAL_FUNC(handleLBoxClick), ! popup); port_layout_put(PORT_LAYOUT(GTK_BIN(window)->child), popup); ! return popup; }; --- 3,19 ---- #include "Handlers_stub.h" WindowHandle osCreatePopUp(WindowHandle window) { GtkWidget *popup; ! popup = gtk_combo_box_new_text(); ! //gtk_entry_set_editable (GTK_ENTRY(GTK_COMBO(popup)->entry), gtk_false()); ! //gtk_combo_set_use_arrows_always(GTK_COMBO(popup), gtk_true()); ! gtk_signal_connect(GTK_OBJECT(popup), "changed", ! GTK_SIGNAL_FUNC(handleControlCommand), ! NULL); port_layout_put(PORT_LAYOUT(GTK_BIN(window)->child), popup); ! return popup; }; *************** *** 26,55 **** void osAppendPopUpItem(WindowHandle popup, char *title) { ! GtkWidget *lbox = GTK_COMBO(popup)->list; ! GtkWidget *li = gtk_list_item_new_with_label(title); ! gtk_list_append_items(GTK_LIST(lbox), g_list_append(NULL,li)); ! gtk_widget_show(li); }; void osInsertPopUpItem(WindowHandle popup, int index, char *title) { ! GtkWidget *lbox = GTK_COMBO(popup)->list; ! GtkWidget *li = gtk_list_item_new_with_label(title); ! gtk_list_insert_items(GTK_LIST(lbox), g_list_append(NULL,li), index); ! gtk_widget_show(li); }; void osRemovePopUpItem(WindowHandle popup, int index) { ! GtkWidget *lbox = GTK_COMBO(popup)->list; ! GList *tmp_list = g_list_append(NULL, g_list_nth(GTK_LIST(lbox)->children, index)->data); ! gtk_list_remove_items (GTK_LIST(lbox),tmp_list); ! g_list_free(tmp_list); }; void osRemoveAllPopUpItems(WindowHandle popup) { ! GtkWidget *lbox = GTK_COMBO(popup)->list; ! gtk_list_remove_items (GTK_LIST(lbox),GTK_LIST(lbox)->children); }; --- 21,40 ---- void osAppendPopUpItem(WindowHandle popup, char *title) { ! gtk_combo_box_append_text(GTK_COMBO_BOX(popup), title); }; void osInsertPopUpItem(WindowHandle popup, int index, char *title) { ! gtk_combo_box_insert_text(GTK_COMBO_BOX(popup), index, title); }; void osRemovePopUpItem(WindowHandle popup, int index) { ! gtk_combo_box_remove_text(GTK_COMBO_BOX(popup), index); }; void osRemoveAllPopUpItems(WindowHandle popup) { ! gtk_list_store_clear(GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(popup)))); }; *************** *** 66,82 **** int osGetPopUpSelection(WindowHandle popup) { ! GtkWidget *lbox = GTK_COMBO(popup)->list; ! if (!GTK_LIST(lbox)->selection) ! return -1; ! ! return gtk_list_child_position(GTK_LIST(lbox), (GtkWidget *) GTK_LIST(lbox)->selection->data); }; void osSetPopUpSelection(WindowHandle popup, int index) { ! GtkWidget *lbox = GTK_COMBO(popup)->list; ! if (index > 0) ! gtk_list_select_item(GTK_LIST(lbox),index); ! else ! gtk_list_unselect_all(GTK_LIST(lbox)); }; --- 51,59 ---- int osGetPopUpSelection(WindowHandle popup) { ! return gtk_combo_box_get_active(GTK_COMBO_BOX(popup)); }; void osSetPopUpSelection(WindowHandle popup, int index) { ! gtk_combo_box_set_active(GTK_COMBO_BOX(popup), index); }; |
From: <kr_...@us...> - 2003-12-14 10:51:51
|
Update of /cvsroot/htoolkit/port/src/cbits/GTK In directory sc8-pr-cvs1:/tmp/cvs-serv2507/src/cbits/GTK Modified Files: ToolBar.c gtkdropdowntoolbutton.c gtkdropdowntoolbutton.h Log Message: Make the library compatible with ToolBar API in GTK 2.3.1 Index: ToolBar.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/ToolBar.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ToolBar.c 31 Aug 2003 12:56:26 -0000 1.10 --- ToolBar.c 14 Dec 2003 10:51:39 -0000 1.11 *************** *** 45,63 **** } - void tool_button_clicked(GtkWidget *widget, gpointer user_data) - { - handleToolCommand((ToolHandle) user_data); - } - ToolHandle osInsertToolButton(WindowHandle toolbar, int pos) { ! GtkToolItem *item = gtk_tool_button_new("", gtk_image_new()); ! gtk_signal_connect (GTK_OBJECT(GTK_TOOL_BUTTON(item)->button), "clicked", ! GTK_SIGNAL_FUNC(tool_button_clicked), ! item); gtk_signal_connect (GTK_OBJECT(item), "destroy", GTK_SIGNAL_FUNC(handleToolDestroy), NULL); - gtk_tool_button_set_label_widget(GTK_TOOL_BUTTON(item), gtk_label_new("")); gtk_toolbar_insert(GTK_TOOLBAR(toolbar), item, pos); gtk_widget_show_all(GTK_WIDGET(item)); --- 45,58 ---- } ToolHandle osInsertToolButton(WindowHandle toolbar, int pos) { ! GtkToolItem *item = gtk_tool_button_new(gtk_image_new(), ""); ! gtk_tool_button_set_use_underline (GTK_TOOL_BUTTON(item), TRUE); ! gtk_signal_connect (GTK_OBJECT(item), "clicked", ! GTK_SIGNAL_FUNC(handleToolCommand), ! NULL); gtk_signal_connect (GTK_OBJECT(item), "destroy", GTK_SIGNAL_FUNC(handleToolDestroy), NULL); gtk_toolbar_insert(GTK_TOOLBAR(toolbar), item, pos); gtk_widget_show_all(GTK_WIDGET(item)); *************** *** 68,80 **** { GtkToolItem *item = gtk_toggle_tool_button_new(); ! gtk_signal_connect (GTK_OBJECT(GTK_TOOL_BUTTON(item)->button), "clicked", ! GTK_SIGNAL_FUNC(tool_button_clicked), ! item); gtk_signal_connect (GTK_OBJECT(item), "destroy", GTK_SIGNAL_FUNC(handleToolDestroy), NULL); - gtk_tool_button_set_label_widget(GTK_TOOL_BUTTON(item), gtk_label_new("")); gtk_tool_button_set_icon_widget(GTK_TOOL_BUTTON(item), gtk_image_new()); - gtk_toolbar_insert(GTK_TOOLBAR(toolbar), item, pos); gtk_widget_show_all(GTK_WIDGET(item)); --- 63,74 ---- { GtkToolItem *item = gtk_toggle_tool_button_new(); ! gtk_tool_button_set_use_underline (GTK_TOOL_BUTTON(item), TRUE); ! gtk_signal_connect (GTK_OBJECT(item), "clicked", ! GTK_SIGNAL_FUNC(handleToolCommand), ! NULL); gtk_signal_connect (GTK_OBJECT(item), "destroy", GTK_SIGNAL_FUNC(handleToolDestroy), NULL); gtk_tool_button_set_icon_widget(GTK_TOOL_BUTTON(item), gtk_image_new()); gtk_toolbar_insert(GTK_TOOLBAR(toolbar), item, pos); gtk_widget_show_all(GTK_WIDGET(item)); *************** *** 84,91 **** static void tool_radio_button_clicked(GtkWidget *widget, gpointer user_data) { ! ToolHandle toolItem = (ToolHandle) user_data; ! ! if (gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(toolItem))) ! handleToolCommand(toolItem); } --- 78,83 ---- static void tool_radio_button_clicked(GtkWidget *widget, gpointer user_data) { ! if (gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(widget))) ! handleToolCommand(widget); } *************** *** 93,107 **** { GtkToolItem *item = gtk_radio_tool_button_new(NULL); ! GTK_TOGGLE_BUTTON (GTK_TOOL_BUTTON(item)->button)->active = FALSE; ! ! gtk_signal_connect (GTK_OBJECT(GTK_TOOL_BUTTON(item)->button), "clicked", GTK_SIGNAL_FUNC(tool_radio_button_clicked), ! item); gtk_signal_connect (GTK_OBJECT(item), "destroy", GTK_SIGNAL_FUNC(handleToolDestroy), NULL); - gtk_tool_button_set_label_widget(GTK_TOOL_BUTTON(item), gtk_label_new("")); gtk_tool_button_set_icon_widget(GTK_TOOL_BUTTON(item), gtk_image_new()); - gtk_toolbar_insert(GTK_TOOLBAR(toolbar), item, pos); gtk_widget_show_all(GTK_WIDGET(item)); --- 85,97 ---- { GtkToolItem *item = gtk_radio_tool_button_new(NULL); ! gtk_tool_button_set_use_underline (GTK_TOOL_BUTTON(item), TRUE); ! gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON (item), FALSE); ! gtk_signal_connect (GTK_OBJECT(item), "clicked", GTK_SIGNAL_FUNC(tool_radio_button_clicked), ! NULL); gtk_signal_connect (GTK_OBJECT(item), "destroy", GTK_SIGNAL_FUNC(handleToolDestroy), NULL); gtk_tool_button_set_icon_widget(GTK_TOOL_BUTTON(item), gtk_image_new()); gtk_toolbar_insert(GTK_TOOLBAR(toolbar), item, pos); gtk_widget_show_all(GTK_WIDGET(item)); *************** *** 123,133 **** ToolHandle osInsertToolDropDownButton(WindowHandle toolbar, MenuHandle hmenu, int pos) { ! GtkToolItem *item = gtk_drop_down_tool_button_new(); gtk_drop_down_tool_button_set_menu(GTK_DROP_DOWN_TOOL_BUTTON(item), hmenu); gtk_signal_connect (GTK_OBJECT(item), "destroy", GTK_SIGNAL_FUNC(handleToolDestroy), NULL); - gtk_tool_button_set_label_widget(GTK_TOOL_BUTTON(item), gtk_label_new("")); - gtk_tool_button_set_icon_widget(GTK_TOOL_BUTTON(item), gtk_image_new()); gtk_toolbar_insert(GTK_TOOLBAR(toolbar), item, pos); gtk_widget_show_all(GTK_WIDGET(item)); --- 113,122 ---- ToolHandle osInsertToolDropDownButton(WindowHandle toolbar, MenuHandle hmenu, int pos) { ! GtkToolItem *item = gtk_drop_down_tool_button_new(gtk_image_new(), "", NULL); ! gtk_tool_button_set_use_underline (GTK_TOOL_BUTTON(item), TRUE); gtk_drop_down_tool_button_set_menu(GTK_DROP_DOWN_TOOL_BUTTON(item), hmenu); gtk_signal_connect (GTK_OBJECT(item), "destroy", GTK_SIGNAL_FUNC(handleToolDestroy), NULL); gtk_toolbar_insert(GTK_TOOLBAR(toolbar), item, pos); gtk_widget_show_all(GTK_WIDGET(item)); *************** *** 148,152 **** void osSetToolButtonBitmap(ToolHandle toolButton, BitmapHandle bitmap) { ! gtk_image_set_from_pixbuf(gtk_tool_button_get_icon_widget (GTK_TOOL_BUTTON(toolButton)), bitmap->pixbuf); } --- 137,141 ---- void osSetToolButtonBitmap(ToolHandle toolButton, BitmapHandle bitmap) { ! gtk_image_set_from_pixbuf(GTK_IMAGE(gtk_tool_button_get_icon_widget (GTK_TOOL_BUTTON(toolButton))), bitmap->pixbuf); } *************** *** 175,187 **** void osSetToolButtonText(ToolHandle toolButton, char *text) { ! GtkWidget *label = gtk_tool_button_get_label_widget (GTK_TOOL_BUTTON(toolButton)); ! gtk_label_set_text(GTK_LABEL(label), text); } char *osGetToolButtonText(ToolHandle toolButton) { ! GtkWidget *label = gtk_tool_button_get_label_widget (GTK_TOOL_BUTTON(toolButton)); ! char *text = gtk_label_get_text(GTK_LABEL(label)); ! return strdup(text); } --- 164,175 ---- void osSetToolButtonText(ToolHandle toolButton, char *text) { ! gchar *szText = toMnemonicString(text); ! gtk_tool_button_set_label(GTK_TOOL_BUTTON(toolButton), szText); ! rfree(szText); } char *osGetToolButtonText(ToolHandle toolButton) { ! return fromMnemonicString(gtk_tool_button_get_label(GTK_TOOL_BUTTON(toolButton))); } Index: gtkdropdowntoolbutton.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/gtkdropdowntoolbutton.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** gtkdropdowntoolbutton.c 22 Aug 2003 21:45:08 -0000 1.1 --- gtkdropdowntoolbutton.c 14 Dec 2003 10:51:39 -0000 1.2 *************** *** 82,85 **** --- 82,123 ---- } + static GtkWidget * + clone_image_menu_size (GtkImage *image, GtkSettings *settings) + { + GtkImageType storage_type = gtk_image_get_storage_type (image); + + if (storage_type == GTK_IMAGE_STOCK) + { + gchar *stock_id; + gtk_image_get_stock (image, &stock_id, NULL); + return gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_MENU); + } + else if (storage_type == GTK_IMAGE_ICON_SET) + { + GtkIconSet *icon_set; + gtk_image_get_icon_set (image, &icon_set, NULL); + return gtk_image_new_from_icon_set (icon_set, GTK_ICON_SIZE_MENU); + } + else if (storage_type == GTK_IMAGE_PIXBUF) + { + gint width, height; + + if (settings && + gtk_icon_size_lookup_for_settings (settings, GTK_ICON_SIZE_MENU, + &width, &height)) + { + GdkPixbuf *src_pixbuf, *dest_pixbuf; + + src_pixbuf = gtk_image_get_pixbuf (image); + dest_pixbuf = gdk_pixbuf_scale_simple (src_pixbuf, width, height, + GDK_INTERP_BILINEAR); + + return gtk_image_new_from_pixbuf (dest_pixbuf); + } + } + + return NULL; + } + static gboolean gtk_drop_down_tool_button_create_menu_proxy (GtkToolItem *item) *************** *** 89,109 **** GtkStockItem stock_item; gboolean use_mnemonic = TRUE; ! const char *label = ""; ! if (tool_button->label_widget && GTK_IS_LABEL (tool_button->label_widget)) ! label = gtk_label_get_label (GTK_LABEL (tool_button->label_widget)); ! else if (tool_button->label_text) { ! label = tool_button->label_text; ! use_mnemonic = tool_button->use_underline; } - else if (tool_button->stock_id && gtk_stock_lookup (tool_button->stock_id, &stock_item)) - label = stock_item.label; if (use_mnemonic) ! menu_item = gtk_menu_item_new_with_mnemonic (label); else ! menu_item = gtk_menu_item_new_with_label (label); ! gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), GTK_DROP_DOWN_BUTTON(tool_button->button)->menu); gtk_tool_item_set_proxy_menu_item (item, MENU_ID, menu_item); --- 127,177 ---- GtkStockItem stock_item; gboolean use_mnemonic = TRUE; ! const char *label; ! GtkWidget *menu_image = NULL; ! GtkWidget *label_widget = gtk_tool_button_get_label_widget (tool_button); ! GtkWidget *icon_widget = gtk_tool_button_get_icon_widget(tool_button); ! GtkWidget *menu_widget = GTK_DROP_DOWN_BUTTON(_gtk_tool_button_get_button (GTK_TOOL_BUTTON(tool_button)))->menu; ! const gchar *label_text = gtk_tool_button_get_label (tool_button); ! const gchar *stock_id = gtk_tool_button_get_stock_id (tool_button); ! ! if (label_widget && GTK_IS_LABEL (label_widget)) { ! label = gtk_label_get_label (GTK_LABEL (label_widget)); ! use_mnemonic = gtk_label_get_use_underline (GTK_LABEL (label_widget)); ! } ! else if (label_text) ! { ! label = label_text; ! use_mnemonic = gtk_tool_button_get_use_underline (tool_button); ! } ! else if (stock_id && gtk_stock_lookup (stock_id, &stock_item)) ! { ! label = stock_item.label; ! } ! else ! { ! label = ""; } if (use_mnemonic) ! menu_item = gtk_image_menu_item_new_with_mnemonic (label); else ! menu_item = gtk_image_menu_item_new_with_label (label); ! ! if (icon_widget && GTK_IS_IMAGE (icon_widget)) ! { ! menu_image = clone_image_menu_size (GTK_IMAGE(icon_widget), ! gtk_widget_get_settings (GTK_WIDGET (tool_button))); ! } ! else if (stock_id) ! { ! menu_image = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_MENU); ! } ! ! if (menu_image) ! gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_item), menu_image); ! ! gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), menu_widget); gtk_tool_item_set_proxy_menu_item (item, MENU_ID, menu_item); *************** *** 113,117 **** GtkToolItem * ! gtk_drop_down_tool_button_new (void) { GtkToolButton *button; --- 181,187 ---- GtkToolItem * ! gtk_drop_down_tool_button_new (GtkWidget *icon_widget, ! const gchar *label, ! GtkWidget *menu) { GtkToolButton *button; *************** *** 119,123 **** button = g_object_new (GTK_TYPE_DROP_DOWN_TOOL_BUTTON, NULL); ! return GTK_TOOL_ITEM (button); } --- 189,202 ---- button = g_object_new (GTK_TYPE_DROP_DOWN_TOOL_BUTTON, NULL); ! ! if (label) ! gtk_tool_button_set_label (button, label); ! ! if (icon_widget) ! gtk_tool_button_set_icon_widget (button, icon_widget); ! ! if (menu) ! gtk_drop_down_tool_button_set_menu(GTK_DROP_DOWN_TOOL_BUTTON(button), menu); ! return GTK_TOOL_ITEM (button); } *************** *** 139,147 **** GtkWidget* gtk_drop_down_tool_button_get_menu(GtkDropDownToolButton *button) { ! return gtk_drop_down_button_get_menu(GTK_DROP_DOWN_BUTTON(GTK_TOOL_BUTTON(button)->button)); } void gtk_drop_down_tool_button_set_menu(GtkDropDownToolButton *button, GtkWidget *menu) { ! gtk_drop_down_button_set_menu(GTK_DROP_DOWN_BUTTON(GTK_TOOL_BUTTON(button)->button), menu); } --- 218,229 ---- GtkWidget* gtk_drop_down_tool_button_get_menu(GtkDropDownToolButton *button) { ! return gtk_drop_down_button_get_menu( ! GTK_DROP_DOWN_BUTTON(_gtk_tool_button_get_button (GTK_TOOL_BUTTON(button)))); } void gtk_drop_down_tool_button_set_menu(GtkDropDownToolButton *button, GtkWidget *menu) { ! gtk_drop_down_button_set_menu( ! GTK_DROP_DOWN_BUTTON(_gtk_tool_button_get_button (GTK_TOOL_BUTTON(button))), ! menu); } Index: gtkdropdowntoolbutton.h =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/gtkdropdowntoolbutton.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** gtkdropdowntoolbutton.h 22 Aug 2003 21:45:08 -0000 1.1 --- gtkdropdowntoolbutton.h 14 Dec 2003 10:51:39 -0000 1.2 *************** *** 50,54 **** GType gtk_drop_down_tool_button_get_type (void) G_GNUC_CONST; ! GtkToolItem *gtk_drop_down_tool_button_new (void); GtkToolItem *gtk_drop_down_tool_button_new_from_stock (const gchar *stock_id); GtkWidget* gtk_drop_down_tool_button_get_menu (GtkDropDownToolButton *button); --- 50,54 ---- GType gtk_drop_down_tool_button_get_type (void) G_GNUC_CONST; ! GtkToolItem *gtk_drop_down_tool_button_new (GtkWidget *icon_widget, const gchar *label, GtkWidget *menu); GtkToolItem *gtk_drop_down_tool_button_new_from_stock (const gchar *stock_id); GtkWidget* gtk_drop_down_tool_button_get_menu (GtkDropDownToolButton *button); |
From: <kr_...@us...> - 2003-11-26 22:05:04
|
Update of /cvsroot/htoolkit/port/src/cbits/GTK In directory sc8-pr-cvs1:/tmp/cvs-serv10286/src/cbits/GTK Modified Files: ListBox.c Log Message: Added support for CheckListBox for GNOME Index: ListBox.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/ListBox.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ListBox.c 8 Oct 2003 22:21:57 -0000 1.10 --- ListBox.c 26 Nov 2003 22:05:01 -0000 1.11 *************** *** 52,62 **** }; void osAppendListBoxItem(WindowHandle listbox, char *title) { GtkTreeIter iter; GtkWidget *lbox = GTK_BIN(listbox)->child; ! GtkListStore *store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(lbox))); ! gtk_list_store_append(store, &iter); ! gtk_list_store_set(store, &iter, 0, title, -1); }; --- 52,134 ---- }; + static void checkbox_toggled(GtkCellRendererToggle *cellrenderertoggle, gchar *path_string, gpointer user_data) + { + GtkWidget *sw = (GtkWidget *)user_data; + GtkWidget *listbox = GTK_BIN(sw)->child; + GtkTreeModel *model; + GtkTreeIter iter; + GtkTreePath *path; + gboolean state; + + path = gtk_tree_path_new_from_string (path_string); + model = gtk_tree_view_get_model(GTK_TREE_VIEW(listbox)); + gtk_tree_model_get_iter (model, &iter, path); + + gtk_tree_model_get(model, &iter, 0, &state, -1); + gtk_list_store_set (GTK_LIST_STORE (model), &iter, 0, !state, -1); + + handleControlCommand(sw); + }; + + WindowHandle osCreateCheckListBox(WindowHandle window) + { + GtkListStore *store; + GtkWidget *lbox, *sw; + GtkTreeViewColumn *column; + GtkCellRenderer *render; + + /* create scrolled window */ + sw = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_ETCHED_IN); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + + /* create list store */ + store = gtk_list_store_new (2, G_TYPE_BOOLEAN, G_TYPE_STRING); + + /* create tree view */ + lbox = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store)); + gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(lbox), FALSE); + gtk_tree_view_set_enable_search (GTK_TREE_VIEW(lbox), TRUE); + gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(lbox)), GTK_SELECTION_SINGLE); + g_object_unref (store); + + /* add columns to the tree view */ + render = gtk_cell_renderer_toggle_new (); + g_signal_connect (render, "toggled", + G_CALLBACK (checkbox_toggled), sw); + column = gtk_tree_view_column_new_with_attributes ("", + render, + "active", + 0, + NULL); + gtk_tree_view_append_column (GTK_TREE_VIEW(lbox), column); + column = gtk_tree_view_column_new_with_attributes ("", + gtk_cell_renderer_text_new (), + "text", + 1, + NULL); + gtk_tree_view_append_column (GTK_TREE_VIEW(lbox), column); + + gtk_container_add(GTK_CONTAINER(sw), lbox); + gtk_widget_show(lbox); + + port_layout_put(PORT_LAYOUT(GTK_BIN(window)->child), sw); + + return sw; + }; + void osAppendListBoxItem(WindowHandle listbox, char *title) { GtkTreeIter iter; GtkWidget *lbox = GTK_BIN(listbox)->child; ! GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(lbox)); ! gtk_list_store_append(GTK_LIST_STORE(model), &iter); ! ! if (gtk_tree_model_get_n_columns(model) > 1) ! gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0, FALSE, 1, title, -1); ! else ! gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0, title, -1); }; *************** *** 65,71 **** GtkTreeIter iter; GtkWidget *lbox = GTK_BIN(listbox)->child; ! GtkListStore *store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(lbox))); ! gtk_list_store_insert(store, &iter, index); ! gtk_list_store_set(store, &iter, 0, title, -1);}; void osRemoveListBoxItem(WindowHandle listbox, int index) --- 137,148 ---- GtkTreeIter iter; GtkWidget *lbox = GTK_BIN(listbox)->child; ! GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(lbox)); ! gtk_list_store_insert(GTK_LIST_STORE(model), &iter, index); ! ! if (gtk_tree_model_get_n_columns(model) > 1) ! gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0, FALSE, 1, title, -1); ! else ! gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0, title, -1); ! }; void osRemoveListBoxItem(WindowHandle listbox, int index) *************** *** 117,124 **** { BOOL result; ! GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(GTK_BIN(listbox)->child)); GtkTreePath *path = gtk_tree_path_new_from_indices (index, -1); ! result = gtk_tree_selection_path_is_selected(selection, path); gtk_tree_path_free(path); --- 194,212 ---- { BOOL result; ! GtkWidget *lbox = GTK_BIN(listbox)->child; GtkTreePath *path = gtk_tree_path_new_from_indices (index, -1); + GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(lbox)); ! if (gtk_tree_model_get_n_columns(model) > 1) ! { ! GtkTreeIter iter; ! gtk_tree_model_get_iter (model, &iter, path); ! gtk_tree_model_get(model, &iter, 0, &result, -1); ! } ! else ! { ! GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(lbox)); ! result = gtk_tree_selection_path_is_selected(selection, path); ! } gtk_tree_path_free(path); *************** *** 131,135 **** GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(lbox)); ! if (index > 0) { GtkTreePath *path = gtk_tree_path_new_from_indices (index, -1); --- 219,223 ---- GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(lbox)); ! if (index >= 0) { GtkTreePath *path = gtk_tree_path_new_from_indices (index, -1); *************** *** 144,156 **** void osSetListBoxItemSelectState(WindowHandle listbox, int index, BOOL state) { ! GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(GTK_BIN(listbox)->child)); ! if (index > 0) { GtkTreePath *path = gtk_tree_path_new_from_indices (index, -1); ! if (state) ! gtk_tree_selection_select_path(selection, path); else ! gtk_tree_selection_unselect_path(selection, path); gtk_tree_path_free(path); --- 232,256 ---- void osSetListBoxItemSelectState(WindowHandle listbox, int index, BOOL state) { ! GtkWidget *lbox = GTK_BIN(listbox)->child; ! GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(lbox)); ! if (index >= 0) { GtkTreePath *path = gtk_tree_path_new_from_indices (index, -1); ! GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(lbox)); ! ! if (gtk_tree_model_get_n_columns(model) > 1) ! { ! GtkTreeIter iter; ! gtk_tree_model_get_iter (model, &iter, path); ! gtk_list_store_set (GTK_LIST_STORE(model), &iter, 0, state, -1); ! } else ! { ! if (state) ! gtk_tree_selection_select_path(selection, path); ! else ! gtk_tree_selection_unselect_path(selection, path); ! } gtk_tree_path_free(path); |
From: <kr_...@us...> - 2003-11-25 15:57:52
|
Update of /cvsroot/htoolkit/gio/src/Graphics/UI/GIO In directory sc8-pr-cvs1:/tmp/cvs-serv20774/src/Graphics/UI/GIO Modified Files: Controls.hs Log Message: Add an instance of Able for DateEntry Index: Controls.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Controls.hs,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** Controls.hs 25 Nov 2003 14:17:56 -0000 1.42 --- Controls.hs 25 Nov 2003 15:57:48 -0000 1.43 *************** *** 287,290 **** --- 287,293 ---- return de + instance Able DateEntry where + enabled = newStdAttr dehandle Port.getControlEnabled Port.setControlEnabled + instance Tipped DateEntry where tooltip = newStdAttr dehandle Port.getControlTip Port.setControlTip |
From: <kr_...@us...> - 2003-11-25 14:18:00
|
Update of /cvsroot/htoolkit/gio/src/Graphics/UI/GIO In directory sc8-pr-cvs1:/tmp/cvs-serv991/src/Graphics/UI/GIO Modified Files: Controls.hs Log Message: Add support for CheckListBox Index: Controls.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Controls.hs,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** Controls.hs 24 Nov 2003 22:41:28 -0000 1.41 --- Controls.hs 25 Nov 2003 14:17:56 -0000 1.42 *************** *** 60,64 **** -- selection list control where the value assigned to each item is of (IO ()) type. -- Each time the user selects an item, its IO action is executed. ! , SelectionList, ListBox, selectionList, listBox -- * Slider --- 60,64 ---- -- selection list control where the value assigned to each item is of (IO ()) type. -- Each time the user selects an item, its IO action is executed. ! , SelectionList, ListBox, selectionList, selectionCheckList, listBox -- * Slider *************** *** 427,430 **** --- 427,444 ---- slitems <- newVar [] return (SelectionList multi hlist (hwindow w) slitems) + set lb props + return lb + + -- | Create a selection checklist control. A "checklist control" + -- displays a list of items where each item in the list has a + -- check box next to it. The checklist control is a similar to the + -- normal list box with multi selection allowed. The difference + -- is that the checklist uses check boxes to indicate + -- the selected items. + selectionCheckList :: Container w => [Prop (SelectionList a)] -> w -> IO (SelectionList a) + selectionCheckList props w = do + lb <- do hlist <- Port.createCheckListBox (hwindow w) + slitems <- newVar [] + return (SelectionList True hlist (hwindow w) slitems) set lb props return lb |
From: <kr_...@us...> - 2003-11-25 14:12:27
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32 In directory sc8-pr-cvs1:/tmp/cvs-serv32518/src/cbits/Win32 Modified Files: Internals.h ListBox.c Util.c Window.c Log Message: Add support for CheckListBox control Index: Internals.h =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Internals.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Internals.h 24 Nov 2003 22:58:59 -0000 1.16 --- Internals.h 25 Nov 2003 14:12:22 -0000 1.17 *************** *** 74,76 **** --- 74,78 ---- void RefreshStatusBarIndicators(); + void DrawCheckListBoxItem(LPDRAWITEMSTRUCT lpDIS); + #endif Index: ListBox.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/ListBox.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ListBox.c 8 Oct 2003 22:21:57 -0000 1.7 --- ListBox.c 25 Nov 2003 14:12:22 -0000 1.8 *************** *** 2,5 **** --- 2,122 ---- #include "Internals.h" #include "Handlers_stub.h" + #include <windowsx.h> + + void DrawCheckListBoxItem(LPDRAWITEMSTRUCT lpDIS) + { + if ((((LONG) lpDIS->itemID) >= 0) && (lpDIS->itemAction & (ODA_DRAWENTIRE | ODA_SELECT))) + { + int cyItem; + BOOL fDisabled; + HFONT hFont, hOldFont; + COLORREF newBkColor, oldBkColor; + COLORREF newTextColor, oldTextColor; + TEXTMETRIC tm; + int nTextLen; + LPCSTR lpszText; + + cyItem = SendMessage(lpDIS->hwndItem, LB_GETITEMHEIGHT, lpDIS->itemID, 0); + + fDisabled = !IsWindowEnabled(lpDIS->hwndItem); + + newTextColor = fDisabled ? RGB(0x80, 0x80, 0x80) : GetSysColor(COLOR_WINDOWTEXT); // light gray + oldTextColor = SetTextColor(lpDIS->hDC, newTextColor); + + newBkColor = GetSysColor(COLOR_WINDOW); + oldBkColor = SetBkColor(lpDIS->hDC, newBkColor); + + if (newTextColor == newBkColor) + newTextColor = RGB(0xC0, 0xC0, 0xC0); // dark gray + + if (!fDisabled && ((lpDIS->itemState & ODS_SELECTED) != 0)) + { + SetTextColor(lpDIS->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT)); + SetBkColor(lpDIS->hDC, GetSysColor(COLOR_HIGHLIGHT)); + } + + hFont = (HFONT) SendMessage(lpDIS->hwndItem,WM_GETFONT,0,0); + hOldFont = SelectObject(lpDIS->hDC, hFont); + GetTextMetrics(lpDIS->hDC, &tm); + + nTextLen = SendMessage(lpDIS->hwndItem, LB_GETTEXTLEN, lpDIS->itemID, 0); + lpszText = rmalloc(nTextLen+1); + SendMessage(lpDIS->hwndItem, LB_GETTEXT, lpDIS->itemID, (LPARAM) lpszText); + + ExtTextOut(lpDIS->hDC, lpDIS->rcItem.left + cyItem, + lpDIS->rcItem.top + max(0, (cyItem - tm.tmHeight) / 2), + ETO_OPAQUE, &lpDIS->rcItem, lpszText, nTextLen, NULL); + + Rectangle(lpDIS->hDC, 1, lpDIS->rcItem.top+1, cyItem-1, lpDIS->rcItem.top+cyItem-1); + + if (SendMessage(lpDIS->hwndItem, LB_GETITEMDATA, lpDIS->itemID, 0) > 0) + { + HPEN hPen, hOldPen; + + hPen = CreatePen(PS_SOLID, 2, newTextColor); + hOldPen = SelectObject(lpDIS->hDC, hPen); + + MoveToEx(lpDIS->hDC, 3, lpDIS->rcItem.top+cyItem/2-1, NULL); + LineTo(lpDIS->hDC, cyItem/2, lpDIS->rcItem.top+cyItem-4); + LineTo(lpDIS->hDC, cyItem-4, lpDIS->rcItem.top+3); + + SelectObject(lpDIS->hDC, hOldPen); + } + + rfree(lpszText); + + SelectObject(lpDIS->hDC, hOldFont); + SetBkColor(lpDIS->hDC, oldBkColor); + SetTextColor(lpDIS->hDC, oldTextColor); + } + + if ((lpDIS->itemAction & ODA_FOCUS) != 0) + DrawFocusRect(lpDIS->hDC, &lpDIS->rcItem); + } + + WNDPROC DefCheckListBoxProc = NULL; + + LRESULT CALLBACK HCheckListBoxFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) + { + switch (uMsg) + { + case WM_LBUTTONDOWN: + { + int cyItem; + int nTopIndex, nIndex, nCount; + BOOL bCheck; + POINT pos; + RECT rect; + + pos.x = GET_X_LPARAM(lParam); + pos.y = GET_Y_LPARAM(lParam); + + SetFocus(hWnd); + + cyItem = SendMessage(hWnd, LB_GETITEMHEIGHT, 0, 0); + nCount = SendMessage(hWnd, LB_GETCOUNT, 0, 0); + nTopIndex = SendMessage(hWnd, LB_GETTOPINDEX, 0, 0); + + if (pos.y < cyItem * nCount) + { + nIndex = nTopIndex + pos.y / cyItem; + if (pos.x < cyItem) + { + bCheck = SendMessage(hWnd, LB_GETITEMDATA, nIndex, 0); + SendMessage(hWnd, LB_SETITEMDATA, nIndex, !bCheck); + + handleControlCommand(hWnd); + + SendMessage(hWnd, LB_GETITEMRECT, nIndex, (LPARAM)&rect); + rect.right = rect.left + cyItem; + InvalidateRect(hWnd, &rect, TRUE); + } + } + } + break; + }; + + return CallWindowProc(DefCheckListBoxProc, hWnd, uMsg, wParam, lParam); + } WindowHandle osCreateListBox(WindowHandle window, BOOL multisel) *************** *** 21,24 **** --- 138,159 ---- }; + WindowHandle osCreateCheckListBox(WindowHandle window) + { + HWND hListBox; + + hListBox = CreateWindowEx( + WS_EX_CLIENTEDGE, + "HCHECKLISTBOX", + NULL, + WS_CHILD | WS_VSCROLL | WS_BORDER | LBS_NOTIFY | WS_TABSTOP | LBS_HASSTRINGS | LBS_OWNERDRAWFIXED, + 0,0,0,0, + window, + NULL, + ghModule, + NULL + ); + return checkWindow(hListBox, "LISTBOX"); + }; + void osAppendListBoxItem(WindowHandle listbox, char *title) { *************** *** 86,90 **** BOOL osGetListBoxItemSelectState(WindowHandle listbox, int index) { ! return SendMessage(listbox, LB_GETSEL, index, 0) > 0; } --- 221,231 ---- BOOL osGetListBoxItemSelectState(WindowHandle listbox, int index) { ! char buffer[20]; ! GetClassName(listbox,buffer,sizeof(buffer)); ! ! if (_stricmp(buffer, "HCHECKLISTBOX") == 0) ! return SendMessage(listbox, LB_GETITEMDATA, index, 0) > 0; ! else ! return SendMessage(listbox, LB_GETSEL, index, 0) > 0; } *************** *** 97,101 **** void osSetListBoxItemSelectState(WindowHandle listbox, int index, BOOL state) { ! SendMessage(listbox, LB_SETSEL, state, index); }; --- 238,257 ---- void osSetListBoxItemSelectState(WindowHandle listbox, int index, BOOL state) { ! char buffer[20]; ! GetClassName(listbox,buffer,sizeof(buffer)); ! ! if (_stricmp(buffer, "HCHECKLISTBOX") == 0) ! { ! RECT rect; ! int cyItem = SendMessage(listbox, LB_GETITEMHEIGHT, 0, 0); ! ! SendMessage(listbox, LB_SETITEMDATA, index, state); ! ! SendMessage(listbox, LB_GETITEMRECT, index, (LPARAM)&rect); ! rect.right = rect.left + cyItem; ! InvalidateRect(listbox, &rect, TRUE); ! } ! else ! SendMessage(listbox, LB_SETSEL, state, index); }; Index: Util.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Util.c,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** Util.c 24 Nov 2003 22:40:41 -0000 1.28 --- Util.c 25 Nov 2003 14:12:22 -0000 1.29 *************** *** 38,45 **** --- 38,47 ---- extern LRESULT CALLBACK HNotebookPageFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); extern LRESULT CALLBACK HGroupBoxFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); + extern LRESULT CALLBACK HCheckListBoxFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); extern WNDPROC DefToolBarProc; extern WNDPROC DefTabCtrlProc; extern WNDPROC DefGroupBoxProc; + extern WNDPROC DefCheckListBoxProc; void osInit(char *appName, char *appVersion, int DocumentInterface) *************** *** 136,139 **** --- 138,149 ---- wc.lpfnWndProc = HGroupBoxFunction; wc.lpszClassName = "HGROUPBOX"; + RegisterClass(&wc); + + // GroupBox class + GetClassInfo(ghModule, "LISTBOX", &wc); + DefCheckListBoxProc = wc.lpfnWndProc; + wc.style = CS_DBLCLKS; + wc.lpfnWndProc = HCheckListBoxFunction; + wc.lpszClassName = "HCHECKLISTBOX"; RegisterClass(&wc); Index: Window.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Window.c,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** Window.c 23 Nov 2003 10:23:14 -0000 1.61 --- Window.c 25 Nov 2003 14:12:22 -0000 1.62 *************** *** 642,645 **** --- 642,652 ---- } return (LRESULT) pData->hBackBrush; + case WM_DRAWITEM: + { + LPDRAWITEMSTRUCT lpDIS = (LPDRAWITEMSTRUCT) lParam; + + if (lpDIS->CtlType == ODT_LISTBOX) + DrawCheckListBoxItem(lpDIS); + } } |
From: <kr_...@us...> - 2003-11-25 14:12:26
|
Update of /cvsroot/htoolkit/port/src/Port In directory sc8-pr-cvs1:/tmp/cvs-serv32518/src/Port Modified Files: Controls.hs Log Message: Add support for CheckListBox control Index: Controls.hs =================================================================== RCS file: /cvsroot/htoolkit/port/src/Port/Controls.hs,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** Controls.hs 24 Nov 2003 22:40:41 -0000 1.28 --- Controls.hs 25 Nov 2003 14:12:22 -0000 1.29 *************** *** 85,94 **** , getPopUpSelection, setPopUpSelection -- * List box ! , createListBox, getListBoxRequestSize , appendListBoxItem, insertListBoxItem , removeListBoxItem, removeAllListBoxItems , getListBoxSingleSelection, setListBoxSingleSelection , getListBoxItemSelectState, setListBoxItemSelectState ! , getListBoxCurrentItem -- * Slider , createHorzSlider, createVertSlider, getSliderRequestSize --- 85,94 ---- , getPopUpSelection, setPopUpSelection -- * List box ! , createListBox, createCheckListBox, getListBoxRequestSize , appendListBoxItem, insertListBoxItem , removeListBoxItem, removeAllListBoxItems , getListBoxSingleSelection, setListBoxSingleSelection , getListBoxItemSelectState, setListBoxItemSelectState ! , getListBoxCurrentItem -- * Slider , createHorzSlider, createVertSlider, getSliderRequestSize *************** *** 96,120 **** , getSliderPosition, setSliderPosition -- * TrackBar ! , createHorzTrackBar, createVertTrackBar, getTrackBarRequestSize -- * ProgressBar ! , createHorzProgressBar, createVertProgressBar, getProgressBarRequestSize ! , setProgressBarFraction, getProgressBarFraction ! -- * CompoundControl ! , createCompoundControl, getCompoundControlRequestSize ! -- * GroupBox ! , createGroupBox, getGroupBoxBordersSize ! , getGroupBoxText, setGroupBoxText ! -- * Notebook ! , createNotebook, getNotebookRequestSize ! , getNotebookLabelsPosition, setNotebookLabelsPosition ! , getNotebookSelection, setNotebookSelection ! , getNotebookPageCount ! -- * NotebookPage ! , insertNotebookPage ! , getNotebookPageTitle, setNotebookPageTitle ! , getNotebookPageBitmap, setNotebookPageBitmap ! , getNotebookPagePos ! , destroyNotebookPage ! , getNotebookPageSize ) where --- 96,120 ---- , getSliderPosition, setSliderPosition -- * TrackBar ! , createHorzTrackBar, createVertTrackBar, getTrackBarRequestSize -- * ProgressBar ! , createHorzProgressBar, createVertProgressBar, getProgressBarRequestSize ! , setProgressBarFraction, getProgressBarFraction ! -- * CompoundControl ! , createCompoundControl, getCompoundControlRequestSize ! -- * GroupBox ! , createGroupBox, getGroupBoxBordersSize ! , getGroupBoxText, setGroupBoxText ! -- * Notebook ! , createNotebook, getNotebookRequestSize ! , getNotebookLabelsPosition, setNotebookLabelsPosition ! , getNotebookSelection, setNotebookSelection ! , getNotebookPageCount ! -- * NotebookPage ! , insertNotebookPage ! , getNotebookPageTitle, setNotebookPageTitle ! , getNotebookPageBitmap, setNotebookPageBitmap ! , getNotebookPagePos ! , destroyNotebookPage ! , getNotebookPageSize ) where *************** *** 334,337 **** --- 334,344 ---- -- installed with 'setControlCommandHandler'. foreign import ccall "osCreateListBox" createListBox :: WindowHandle -> Bool -> IO WindowHandle + + -- | Create a new checklist box. A "checklist box" displays a list of + -- items where each item in the list has a check box next to it. + -- The check list box is a similar to the normal list box with multi + -- selection allowed. The difference is that the checklist box uses + -- check boxes to indicate the selected items. + foreign import ccall "osCreateCheckListBox" createCheckListBox :: WindowHandle -> IO WindowHandle appendListBoxItem :: WindowHandle -> String -> IO () |
From: <kr_...@us...> - 2003-11-25 14:12:26
|
Update of /cvsroot/htoolkit/port/src/include In directory sc8-pr-cvs1:/tmp/cvs-serv32518/src/include Modified Files: ListBox.h Log Message: Add support for CheckListBox control Index: ListBox.h =================================================================== RCS file: /cvsroot/htoolkit/port/src/include/ListBox.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ListBox.h 10 Jul 2003 19:39:56 -0000 1.3 --- ListBox.h 25 Nov 2003 14:12:22 -0000 1.4 *************** *** 5,8 **** --- 5,9 ---- WindowHandle osCreateListBox(WindowHandle window, BOOL multisel); + WindowHandle osCreateCheckListBox(WindowHandle window); void osAppendListBoxItem(WindowHandle listbox, char *title); void osInsertListBoxItem(WindowHandle listbox, int index, char *title); |
From: <kr_...@us...> - 2003-11-24 23:22:42
|
Update of /cvsroot/htoolkit/port/src/include In directory sc8-pr-cvs1:/tmp/cvs-serv14520/src/include Modified Files: HsPort.h Log Message: Bugfixes Index: HsPort.h =================================================================== RCS file: /cvsroot/htoolkit/port/src/include/HsPort.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** HsPort.h 23 Nov 2003 10:23:14 -0000 1.10 --- HsPort.h 24 Nov 2003 23:22:39 -0000 1.11 *************** *** 8,11 **** --- 8,12 ---- #include "port/ListBox.h" #include "port/EditBox.h" + #include "port/DateEntry.h" #include "port/PopUp.h" #include "port/Button.h" |
From: <kr_...@us...> - 2003-11-24 23:22:42
|
Update of /cvsroot/htoolkit/port/src/cbits/GTK In directory sc8-pr-cvs1:/tmp/cvs-serv14520/src/cbits/GTK Modified Files: DateEntry.c Log Message: Bugfixes Index: DateEntry.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/DateEntry.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DateEntry.c 24 Nov 2003 22:40:41 -0000 1.1 --- DateEntry.c 24 Nov 2003 23:22:39 -0000 1.2 *************** *** 25,33 **** time_t osGetDateEntryValue(WindowHandle entry) { ! return gnome_date_edit_get_time(GNOME_DATE_TIME(entry)); } void osSetDateEntryValue(WindowHandle entry, time_t value) { ! gnome_date_edit_set_time(GNOME_DATE_TIME(entry), value); } --- 25,33 ---- time_t osGetDateEntryValue(WindowHandle entry) { ! return gnome_date_edit_get_time(GNOME_DATE_EDIT(entry)); } void osSetDateEntryValue(WindowHandle entry, time_t value) { ! gnome_date_edit_set_time(GNOME_DATE_EDIT(entry), value); } |
From: <kr_...@us...> - 2003-11-24 22:59:04
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32 In directory sc8-pr-cvs1:/tmp/cvs-serv9745/src/cbits/Win32 Modified Files: Internals.h Log Message: update to w32api-2.4 Index: Internals.h =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Internals.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Internals.h 18 Nov 2003 18:03:41 -0000 1.15 --- Internals.h 24 Nov 2003 22:58:59 -0000 1.16 *************** *** 4,16 **** #include <config.h> - extern BOOL gInKey; - extern int gCurChar; - #include "MenuHandlesMap.h" - #ifndef GET_WHEEL_DELTA_WPARAM - #define GET_WHEEL_DELTA_WPARAM(wparam) ((short)HIWORD (wparam)) - #endif - #ifndef NCCALCSIZE_PARAMS typedef struct tagNCCALCSIZE_PARAMS { --- 4,9 ---- *************** *** 20,65 **** #endif ! #ifndef TB_GETMAXSIZE ! #define TB_GETMAXSIZE (WM_USER + 83) ! #endif ! ! #ifndef TB_SETSTYLE ! #define TB_SETSTYLE (WM_USER + 56) ! #endif ! ! #ifndef TB_GETSTYLE ! #define TB_GETSTYLE (WM_USER + 57) ! #endif ! ! #ifndef TBSTYLE_EX_MIXEDBUTTONS ! #define TBSTYLE_EX_MIXEDBUTTONS 8 ! #endif ! ! #ifndef TBSTYLE_EX_MIXEDBUTTONS ! #define TBSTYLE_EX_MIXEDBUTTONS 8 ! #endif ! ! #ifndef BTNS_SHOWTEXT ! #define BTNS_SHOWTEXT 0x0040 ! #endif ! ! #ifndef BTNS_WHOLEDROPDOWN ! #define BTNS_WHOLEDROPDOWN 0x0080 ! #endif ! ! #ifndef TBN_DROPDOWN ! #define TBN_DROPDOWN (TBN_FIRST - 10) ! #endif ! ! #ifndef NMMOUSE ! typedef struct tagNMMOUSE { ! NMHDR hdr; ! DWORD_PTR dwItemSpec; ! DWORD_PTR dwItemData; ! POINT pt; ! LPARAM dwHitInfo; // any specifics about where on the item or control the mouse is ! } NMMOUSE, FAR* LPNMMOUSE; ! #endif ! extern HMODULE ghModule; extern HWND ghWndFrame; --- 13,18 ---- #endif ! extern BOOL gInKey; ! extern int gCurChar; extern HMODULE ghModule; extern HWND ghWndFrame; |
From: <kr_...@us...> - 2003-11-24 22:41:31
|
Update of /cvsroot/htoolkit/gio/src/Graphics/UI/GIO In directory sc8-pr-cvs1:/tmp/cvs-serv6285/src/Graphics/UI/GIO Modified Files: Controls.hs Log Message: Add support for DateEntry control Index: Controls.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Controls.hs,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** Controls.hs 23 Nov 2003 16:29:13 -0000 1.40 --- Controls.hs 24 Nov 2003 22:41:28 -0000 1.41 *************** *** 31,34 **** --- 31,38 ---- , Entry, entry, readOnly, password + -- * DateEntry + -- | A date entry control is a rectangular widget in which the user can enter a date. + , DateEntry, dateEntry + -- * Choice & Popup -- | The choice control consists of a list box combined with a label control. *************** *** 126,129 **** --- 130,134 ---- import Graphics.UI.GIO.Layout import Control.Monad(when, mapM_, filterM) + import System.Time(ClockTime) -------------------------------------------------------------------- *************** *** 264,267 **** --- 269,298 ---- password :: Attr Entry Bool password = newStdAttr ehandle Port.getEditPassword Port.setEditPassword + + -------------------------------------------------------------------- + -- DateEntry + -------------------------------------------------------------------- + -- | A date entry control. + data DateEntry = DateEntry + { dehandle :: !WindowHandle + , deparent :: !WindowHandle + } + + -- | Create an entry. + dateEntry :: Container w => [Prop DateEntry] -> w -> IO DateEntry + dateEntry props w = do + de <- do hentry <- Port.createDateEntry (hwindow w) + return (DateEntry hentry (hwindow w)) + set de props + return de + + instance Tipped DateEntry where + tooltip = newStdAttr dehandle Port.getControlTip Port.setControlTip + + instance Control DateEntry where + pack = stdPack deparent dehandle Port.getDateEntryRequestSize + + instance Valued DateEntry ClockTime where + value = newStdAttr dehandle Port.getDateEntryValue Port.setDateEntryValue -------------------------------------------------------------------- |
From: <kr_...@us...> - 2003-11-24 22:40:45
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32 In directory sc8-pr-cvs1:/tmp/cvs-serv5941/src/cbits/Win32 Modified Files: Util.c Added Files: DateEntry.c Log Message: Add support for DateEntry control --- NEW FILE: DateEntry.c --- #include "DateEntry.h" #include "Internals.h" #include "Handlers_stub.h" WindowHandle osCreateDateEntry(WindowHandle window) { HWND hEntry; hEntry = CreateWindowEx( WS_EX_CLIENTEDGE, DATETIMEPICK_CLASS, NULL, WS_CHILD | WS_BORDER | WS_TABSTOP, 0,0,0,0, window, NULL, ghModule, NULL ); return checkWindow(hEntry, DATETIMEPICK_CLASS); }; void osGetDateEntryReqSize(WindowHandle entry, int *res) { SIZE sz; HDC hDC = GetDC(entry); HFONT hFont = (HFONT) SendMessage(entry,WM_GETFONT,0,0); char buffer[20]; GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SSHORTDATE, buffer, 20); if (hFont) SelectObject(hDC, hFont); GetTextExtentPoint32(hDC, buffer, strlen(buffer), &sz); ReleaseDC(entry, hDC); res[0] = sz.cx + GetSystemMetrics(SM_CXBORDER)*2 + GetSystemMetrics(SM_CXVSCROLL); res[1] = sz.cy + GetSystemMetrics(SM_CYBORDER)*2 + 6; } time_t osGetDateEntryValue(WindowHandle entry) { struct tm tm; SYSTEMTIME stm; SendMessage(entry, DTM_GETSYSTEMTIME, 0, (LPARAM) &stm); tm.tm_sec = stm.wSecond; tm.tm_min = stm.wMinute; tm.tm_hour = stm.wHour; tm.tm_mday = stm.wDay; tm.tm_mon = stm.wMonth-1; tm.tm_year = stm.wYear-1900; tm.tm_wday = stm.wDayOfWeek; tm.tm_yday = 0; tm.tm_isdst = -1; return mktime(&tm); } void osSetDateEntryValue(WindowHandle entry, time_t value) { struct tm *ptm; SYSTEMTIME stm; ptm = localtime(&value); stm.wSecond = ptm->tm_sec; stm.wMinute = ptm->tm_min; stm.wHour = ptm->tm_hour; stm.wDay = ptm->tm_mday; stm.wMonth = ptm->tm_mon+1; stm.wYear = ptm->tm_year+1900; stm.wDayOfWeek = ptm->tm_wday; SendMessage(entry, DTM_SETSYSTEMTIME, 0, (LPARAM) &stm); } Index: Util.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Util.c,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** Util.c 12 Oct 2003 21:33:46 -0000 1.27 --- Util.c 24 Nov 2003 22:40:41 -0000 1.28 *************** *** 181,185 **** icc.dwSize = sizeof(icc); ! icc.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&icc); } --- 181,185 ---- icc.dwSize = sizeof(icc); ! icc.dwICC = ICC_WIN95_CLASSES | ICC_DATE_CLASSES; InitCommonControlsEx(&icc); } |
From: <kr_...@us...> - 2003-11-24 22:40:45
|
Update of /cvsroot/htoolkit/port/src/include In directory sc8-pr-cvs1:/tmp/cvs-serv5941/src/include Modified Files: Types.h Added Files: DateEntry.h Log Message: Add support for DateEntry control --- NEW FILE: DateEntry.h --- #ifndef DATEENTRY_H #define DATEENTRY_H #include "Types.h" WindowHandle osCreateDateEntry(WindowHandle window); void osGetDateEntryReqSize(WindowHandle entry, int *res); time_t osGetDateEntryValue(WindowHandle entry); void osSetDateEntryValue(WindowHandle entry, time_t value); #endif Index: Types.h =================================================================== RCS file: /cvsroot/htoolkit/port/src/include/Types.h,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Types.h 18 Nov 2003 18:03:41 -0000 1.20 --- Types.h 24 Nov 2003 22:40:41 -0000 1.21 *************** *** 9,12 **** --- 9,13 ---- #include <memory.h> #include <string.h> + #include <time.h> typedef enum {PosLeft=0, PosTop=1, PosRight=2, PosBottom=3} PositionType; |
From: <kr_...@us...> - 2003-11-24 22:40:44
|
Update of /cvsroot/htoolkit/port/src/Port In directory sc8-pr-cvs1:/tmp/cvs-serv5941/src/Port Modified Files: Controls.hs Log Message: Add support for DateEntry control Index: Controls.hs =================================================================== RCS file: /cvsroot/htoolkit/port/src/Port/Controls.hs,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** Controls.hs 23 Nov 2003 10:23:13 -0000 1.27 --- Controls.hs 24 Nov 2003 22:40:41 -0000 1.28 *************** *** 1,3 **** ! {-# OPTIONS -fglasgow-exts -#include Button.h -#include CheckBox.h -#include EditBox.h -#include Label.h -#include ListBox.h -#include PopUp.h -#include RadioBox.h -#include Window.h -#include ProgressBar.h -#include Slider.h -#include Notebook.h -#include GroupBox.h -#include TrackBar.h #-} ----------------------------------------------------------------------------------------- {-| Module : Controls --- 1,3 ---- ! {-# OPTIONS -fglasgow-exts -#include Button.h -#include CheckBox.h -#include EditBox.h -#include DateEntry.h -#include Label.h -#include ListBox.h -#include PopUp.h -#include RadioBox.h -#include Window.h -#include ProgressBar.h -#include Slider.h -#include Notebook.h -#include GroupBox.h -#include TrackBar.h #-} ----------------------------------------------------------------------------------------- {-| Module : Controls *************** *** 19,22 **** --- 19,24 ---- * Edit box + * DateEntry + * List box *************** *** 63,66 **** --- 65,71 ---- , getEditPassword,setEditPassword , changeEditBoxFont + -- * DateEntry + , createDateEntry, getDateEntryRequestSize + , getDateEntryValue, setDateEntryValue -- * Check box , createCheckBox, getCheckBoxRequestSize *************** *** 116,119 **** --- 121,125 ---- import Foreign import Foreign.C + import System.Time import Control.Concurrent.MVar import Data.Maybe(fromMaybe) *************** *** 263,266 **** --- 269,293 ---- changeEditBoxFont hwnd font = withCFont font (osChangeEditBoxFont hwnd) foreign import ccall osChangeEditBoxFont :: WindowHandle -> FontHandle -> IO () + + ----------------------------------------------------------------------------------------- + -- DateEntry + ----------------------------------------------------------------------------------------- + -- | Create a date entry control. + foreign import ccall "osCreateDateEntry" createDateEntry :: WindowHandle -> IO WindowHandle + + getDateEntryRequestSize :: WindowHandle -> IO Size + getDateEntryRequestSize hwnd = withCSizeResult (osGetDateEntryReqSize hwnd) + foreign import ccall osGetDateEntryReqSize :: WindowHandle -> Ptr CInt -> IO () + + getDateEntryValue :: WindowHandle -> IO ClockTime + getDateEntryValue hwnd = do + ctime <- osGetDateEntryValue hwnd + return (TOD (fromIntegral ctime) 0) + foreign import ccall osGetDateEntryValue :: WindowHandle -> IO CTime + + setDateEntryValue :: WindowHandle -> ClockTime -> IO () + setDateEntryValue hwnd (TOD time 0) = osSetDateEntryValue hwnd (fromIntegral time) + foreign import ccall osSetDateEntryValue :: WindowHandle -> CTime -> IO () + ----------------------------------------------------------------------------------------- |
From: <kr_...@us...> - 2003-11-24 22:40:44
|
Update of /cvsroot/htoolkit/port/src/cbits/GTK In directory sc8-pr-cvs1:/tmp/cvs-serv5941/src/cbits/GTK Added Files: DateEntry.c Log Message: Add support for DateEntry control --- NEW FILE: DateEntry.c --- #include "DateEntry.h" #include "Internals.h" #include "Handlers_stub.h" WindowHandle osCreateDateEntry(WindowHandle window) { GtkWidget *entry; entry = gnome_date_edit_new(0,FALSE,FALSE); port_layout_put(PORT_LAYOUT(GTK_BIN(window)->child), entry); return entry; }; void osGetDateEntryReqSize(WindowHandle entry, int *res) { GtkRequisition requisition; gtk_widget_size_request(entry, &requisition); res[0] = requisition.width; res[1] = requisition.height; } time_t osGetDateEntryValue(WindowHandle entry) { return gnome_date_edit_get_time(GNOME_DATE_TIME(entry)); } void osSetDateEntryValue(WindowHandle entry, time_t value) { gnome_date_edit_set_time(GNOME_DATE_TIME(entry), value); } |
From: <kr_...@us...> - 2003-11-24 22:40:44
|
Update of /cvsroot/htoolkit/port In directory sc8-pr-cvs1:/tmp/cvs-serv5941 Modified Files: makefile Log Message: Add support for DateEntry control Index: makefile =================================================================== RCS file: /cvsroot/htoolkit/port/makefile,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** makefile 23 Nov 2003 10:23:13 -0000 1.44 --- makefile 24 Nov 2003 22:40:41 -0000 1.45 *************** *** 46,50 **** STUBS = Port/Handlers.hs ! CSRCS = Window.c Util.c Bitmap.c Button.c CheckBox.c EditBox.c \ FileDialog.c ColorDialog.c FontDialog.c AboutDialog.c PopUp.c Canvas.c Menu.c ListBox.c \ Label.c Font.c RadioBox.c Timer.c Frame.c Message.c Slider.c TrackBar.c ProgressBar.c \ --- 46,50 ---- STUBS = Port/Handlers.hs ! CSRCS = Window.c Util.c Bitmap.c Button.c CheckBox.c EditBox.c DateEntry.c \ FileDialog.c ColorDialog.c FontDialog.c AboutDialog.c PopUp.c Canvas.c Menu.c ListBox.c \ Label.c Font.c RadioBox.c Timer.c Frame.c Message.c Slider.c TrackBar.c ProgressBar.c \ |
From: <kr_...@us...> - 2003-11-24 19:22:11
|
Update of /cvsroot/htoolkit/port/src/cbits/GTK In directory sc8-pr-cvs1:/tmp/cvs-serv27951/src/cbits/GTK Modified Files: TrackBar.c Log Message: bugfix Index: TrackBar.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/TrackBar.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TrackBar.c 23 Nov 2003 10:23:13 -0000 1.1 --- TrackBar.c 24 Nov 2003 19:22:08 -0000 1.2 *************** *** 3,27 **** #include "Handlers_stub.h" ! WindowHandle osCreateHorzTrackBar(WindowHandle form) { GtkWidget *trackBar; GtkWidget *left_button, *right_button; ! left_button = gtk_button_new(); gtk_signal_connect (GTK_OBJECT(left_button), "clicked", ! GTK_SIGNAL_FUNC(handleTrackBarIncrement), ! NULL); gtk_container_add(GTK_CONTAINER(left_button), gtk_arrow_new(GTK_ARROW_LEFT,GTK_SHADOW_NONE)); gtk_widget_show_all(left_button); right_button = gtk_button_new(); gtk_signal_connect (GTK_OBJECT(right_button), "clicked", ! GTK_SIGNAL_FUNC(handleTrackBarDecrement), ! NULL); gtk_container_add(GTK_CONTAINER(right_button), gtk_arrow_new(GTK_ARROW_RIGHT,GTK_SHADOW_NONE)); gtk_widget_show_all(right_button); - - trackBar = gtk_hbox_new(TRUE, 0); - gtk_box_pack_start(GTK_BOX(trackBar),left_button ,TRUE,TRUE,0); gtk_box_pack_end (GTK_BOX(trackBar),right_button,TRUE,TRUE,0); --- 3,40 ---- #include "Handlers_stub.h" ! static void track_increment(GtkWidget *widget, gpointer data) ! { ! handleTrackBarIncrement((WindowHandle) data); ! } ! ! static void track_decrement(GtkWidget *widget, gpointer data) ! { ! handleTrackBarDecrement((WindowHandle) data); ! } ! ! WindowHandle osCreateHorzTrackBar(WindowHandle window) { GtkWidget *trackBar; GtkWidget *left_button, *right_button; ! ! trackBar = gtk_hbox_new(TRUE, 0); ! port_layout_put(PORT_LAYOUT(GTK_BIN(window)->child), trackBar); ! left_button = gtk_button_new(); + gtk_container_set_border_width(GTK_CONTAINER(left_button), 0); gtk_signal_connect (GTK_OBJECT(left_button), "clicked", ! GTK_SIGNAL_FUNC(track_decrement), ! trackBar); gtk_container_add(GTK_CONTAINER(left_button), gtk_arrow_new(GTK_ARROW_LEFT,GTK_SHADOW_NONE)); gtk_widget_show_all(left_button); + gtk_box_pack_start(GTK_BOX(trackBar),left_button ,TRUE,TRUE,0); right_button = gtk_button_new(); + gtk_container_set_border_width(GTK_CONTAINER(right_button), 0); gtk_signal_connect (GTK_OBJECT(right_button), "clicked", ! GTK_SIGNAL_FUNC(track_increment), ! trackBar); gtk_container_add(GTK_CONTAINER(right_button), gtk_arrow_new(GTK_ARROW_RIGHT,GTK_SHADOW_NONE)); gtk_widget_show_all(right_button); gtk_box_pack_end (GTK_BOX(trackBar),right_button,TRUE,TRUE,0); *************** *** 29,55 **** }; ! WindowHandle osCreateVertTrackBar(WindowHandle form) { GtkWidget *trackBar; GtkWidget *up_button, *down_button; up_button = gtk_button_new(); gtk_signal_connect (GTK_OBJECT(up_button), "clicked", ! GTK_SIGNAL_FUNC(handleTrackBarIncrement), ! NULL); gtk_container_add(GTK_CONTAINER(up_button), gtk_arrow_new(GTK_ARROW_UP,GTK_SHADOW_NONE)); gtk_widget_show_all(up_button); down_button = gtk_button_new(); gtk_signal_connect (GTK_OBJECT(down_button), "clicked", ! GTK_SIGNAL_FUNC(handleTrackBarDecrement), ! NULL); gtk_container_add(GTK_CONTAINER(down_button), gtk_arrow_new(GTK_ARROW_DOWN,GTK_SHADOW_NONE)); gtk_widget_show_all(down_button); - - trackBar = gtk_vbox_new(TRUE, 0); - gtk_box_pack_start(GTK_BOX(trackBar),up_button, TRUE,TRUE,0); gtk_box_pack_end (GTK_BOX(trackBar),down_button,TRUE,TRUE,0); ! return trackBar; }; --- 42,69 ---- }; ! WindowHandle osCreateVertTrackBar(WindowHandle window) { GtkWidget *trackBar; GtkWidget *up_button, *down_button; + trackBar = gtk_vbox_new(TRUE, 0); + port_layout_put(PORT_LAYOUT(GTK_BIN(window)->child), trackBar); + up_button = gtk_button_new(); gtk_signal_connect (GTK_OBJECT(up_button), "clicked", ! GTK_SIGNAL_FUNC(track_increment), ! trackBar); gtk_container_add(GTK_CONTAINER(up_button), gtk_arrow_new(GTK_ARROW_UP,GTK_SHADOW_NONE)); gtk_widget_show_all(up_button); + gtk_box_pack_start(GTK_BOX(trackBar),up_button, TRUE,TRUE,0); down_button = gtk_button_new(); gtk_signal_connect (GTK_OBJECT(down_button), "clicked", ! GTK_SIGNAL_FUNC(track_decrement), ! trackBar); gtk_container_add(GTK_CONTAINER(down_button), gtk_arrow_new(GTK_ARROW_DOWN,GTK_SHADOW_NONE)); gtk_widget_show_all(down_button); gtk_box_pack_end (GTK_BOX(trackBar),down_button,TRUE,TRUE,0); ! return trackBar; }; *************** *** 59,63 **** GtkRequisition requisition; ! gtk_widget_size_request(button, &requisition); res[0] = requisition.width; --- 73,77 ---- GtkRequisition requisition; ! gtk_widget_size_request(trackBar, &requisition); res[0] = requisition.width; |
From: <kr_...@us...> - 2003-11-23 16:29:16
|
Update of /cvsroot/htoolkit/gio/src/Graphics/UI/GIO In directory sc8-pr-cvs1:/tmp/cvs-serv415/src/Graphics/UI/GIO Modified Files: Attributes.hs Controls.hs Log Message: Add support for Valued class and Choice and SelectionList controls Index: Attributes.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Attributes.hs,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Attributes.hs 15 Nov 2003 10:52:30 -0000 1.20 --- Attributes.hs 23 Nov 2003 16:29:13 -0000 1.21 *************** *** 92,95 **** --- 92,98 ---- , RangedSelect, range, selectedPos + -- ** Valued + , Valued, value + -- ** Icon , HasIcon, icon *************** *** 319,328 **** -- | Widgets that have selectable items, like popup controls. ! class Countable w => CommandItems w where ! items :: Attr w [(String,IO ())] ! appendItem :: w -> (String,IO ()) -> IO () ! insertItem :: w -> Int -> (String,IO ()) -> IO () ! removeItem :: w -> Int -> IO () ! removeAllItems :: w -> IO () -- | Widgets that have a single selection (like popup control). --- 322,331 ---- -- | Widgets that have selectable items, like popup controls. ! class CommandItems w where ! items :: Attr (w a) [(String,a)] ! appendItem :: w a -> (String,a) -> IO () ! insertItem :: w a -> Int -> (String,a) -> IO () ! removeItem :: w a -> Int -> IO () ! removeAllItems :: w a -> IO () -- | Widgets that have a single selection (like popup control). *************** *** 341,344 **** --- 344,352 ---- -- | The selected position selectedPos :: Attr w Int + + -- | Widgets that edit a value + class Valued w a | w -> a where + -- The value + value :: Attr w a -- | Widgets which displays an icon. Index: Controls.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Controls.hs,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** Controls.hs 23 Nov 2003 10:31:05 -0000 1.39 --- Controls.hs 23 Nov 2003 16:29:13 -0000 1.40 *************** *** 31,49 **** , Entry, entry, readOnly, password ! -- * Popup ! -- | A popup control consists of a list box combined with a label control. ! -- The list box portion of the control drop down only when the user selects ! -- the drop-down arrow next to the control. The currently selected item in the ! -- list box is displayed in the label control. ! , Popup, popup ! ! -- * ListBox ! -- | A list box displays a list of items, that the user can view and select. ! -- In a single-selection list box, the user can select only one item. ! -- In a multiple-selection list box, a range of items can be selected. ! -- When the user selects an item, it is highlighted and the list box ! -- the 'command' event is generated. ! , ListBox, listBox ! -- * Slider -- | A slider control is a widget containing a slider and tick marks. --- 31,61 ---- , Entry, entry, readOnly, password ! -- * Choice & Popup ! -- | The choice control consists of a list box combined with a label control. ! -- The list box of the control drops down only when the user selects ! -- the drop-down arrow next to the label. The currently selected item in the ! -- list box is displayed in the label control. When the user ! -- selects an item from the popup list, the 'command' event is generated. ! -- The application can assign a specific value to each item to identify it. ! -- If the value type is an instance of 'Eq', then the application can use ! -- the 'value' attribute to select the item by its value. The popup control ! -- is a special kind of choice control where the value assigned to each item ! -- is of (IO ()) type. Each time the user selects an item, ! -- its IO action is executed. ! , Choice, Popup, popup, choice ! ! -- * SelectionList & ListBox ! -- | A selection list displays a list of items, that the user can view and select. ! -- In a single-selection list, the user can select only one item while in ! -- a multiple-selection list, a range of items can be selected. When the user ! -- selects an item from the list box, it becomes highlighted and the ! -- 'command' event is generated. The application can assign a specific value to ! -- each item to identify it. If the value type is an instance of 'Eq', ! -- then the application can use the 'value' attribute to specify the set of ! -- selected items. The list box control is a special kind of ! -- selection list control where the value assigned to each item is of (IO ()) type. ! -- Each time the user selects an item, its IO action is executed. ! , SelectionList, ListBox, selectionList, listBox ! -- * Slider -- | A slider control is a widget containing a slider and tick marks. *************** *** 241,244 **** --- 253,259 ---- instance Control Entry where pack = stdPack eparent ehandle Port.getEditRequestSize + + instance Valued Entry String where + value = title -- | Determines if the user can edit the text in the editable widget or not. *************** *** 250,418 **** password = newStdAttr ehandle Port.getEditPassword Port.setEditPassword ! {-------------------------------------------------------------------- ! Popup box --------------------------------------------------------------------} ! -- | A popup selection box. Allthough it is 'Commanding', the default ! -- command handler automatically calls a handler associated with a ! -- selected item. ! data Popup = Popup { phandle :: !WindowHandle ! , pparent :: !WindowHandle ! , pitems :: Var [(String,IO ())] } -- | Create a popup selection box. ! popup :: Container w => [Prop Popup] -> w -> IO Popup ! popup props w = do p <- do hpop <- Port.createPopUp (hwindow w) ! pitems <- newVar [] ! return (Popup hpop (hwindow w) pitems) ! set p [on command =: popupCommand p] set p props return p ! -- default command handler ! popupCommand :: Popup -> IO () ! popupCommand p ! = do i <- get p selected ! xs <- getVar (pitems p) ! when (i>=0 && i < length xs) (snd (xs!!i)) -- invoke appropiate handler ! instance Countable Popup where ! count = readAttr "count" (fmap length . getVar . pitems) ! instance CommandItems Popup where items ! = newAttr (\w -> getVar (pitems w)) ! (\w xs -> do Port.removeAllPopUpItems (phandle w) ! mapM_ (Port.appendPopUpItem (phandle w) . fst) xs ! setVar (pitems w) xs ! set w [selected =: 0]) appendItem p item@(title,action) = do ! items <- takeVar (pitems p) ! Port.appendPopUpItem (phandle p) title ! putVar (pitems p) (items++[item]) insertItem p pos item@(title,action) = do ! items <- takeVar (pitems p) ! Port.insertPopUpItem (phandle p) pos title ! putVar (pitems p) (insertAt pos item items) removeItem p pos = do ! items <- takeVar (pitems p) ! Port.removePopUpItem (phandle p) pos ! putVar (pitems p) (removeAt pos items) removeAllItems p = do ! items <- takeVar (pitems p) ! Port.removeAllPopUpItems (phandle p) ! putVar (pitems p) [] ! instance SingleSelect Popup where ! selected = newStdAttr phandle Port.getPopUpSelection Port.setPopUpSelection ! instance Dimensions Popup where ! frame = newStdAttr phandle Port.getControlFrame Port.moveResizeControl ! instance Able Popup where ! enabled = newStdAttr phandle Port.getControlEnabled Port.setControlEnabled ! instance Tipped Popup where ! tooltip = newStdAttr phandle Port.getControlTip Port.setControlTip ! instance Control Popup where ! pack = stdPack pparent phandle Port.getPopUpRequestSize ! instance Commanding Popup where ! command = newStdEvent phandle Port.getControlCommandHandler Port.setControlCommandHandler Port.setControlCommandDefHandler ! {-------------------------------------------------------------------- ! ListBox ! --------------------------------------------------------------------} ! -- | A list box. Allthough it is 'Commanding', the default ! -- command handler automatically calls a handler associated with a ! -- selected item. ! data ListBox = ListBox { lbhandle :: !WindowHandle ! , lbparent :: !WindowHandle ! , lbitems :: Var [(String,IO ())] ! } -- | Create a list box. listBox :: Container w => Bool -> [Prop ListBox] -> w -> IO ListBox listBox multi props w = do ! lb <- do ! hlist <- Port.createListBox (hwindow w) multi ! lbitems <- newVar [] ! return (ListBox hlist (hwindow w) lbitems) set lb [on command =: listBoxCommand lb] - set lb props return lb ! -- default command handler ! listBoxCommand :: ListBox -> IO () ! listBoxCommand lb = do ! i <- Port.getListBoxCurrentItem (lbhandle lb) ! xs <- getVar (lbitems lb) ! when (i>=0 && i < length xs) (snd (xs!!i)) -- invoke appropiate handler ! ! instance Countable ListBox where ! count = readAttr "count" (fmap length . getVar . lbitems) ! instance CommandItems ListBox where items ! = newAttr (\w -> getVar (lbitems w)) ! (\w xs -> do Port.removeAllListBoxItems (lbhandle w) ! mapM_ (Port.appendListBoxItem (lbhandle w) . fst) xs ! setVar (lbitems w) xs) appendItem lb item@(title,action) = do ! items <- takeVar (lbitems lb) ! Port.appendListBoxItem (lbhandle lb) title ! putVar (lbitems lb) (items++[item]) insertItem lb pos item@(title,action) = do ! items <- takeVar (lbitems lb) ! Port.insertListBoxItem (lbhandle lb) pos title ! putVar (lbitems lb) (insertAt pos item items) removeItem lb pos = do ! items <- takeVar (lbitems lb) ! Port.removeListBoxItem (lbhandle lb) pos ! putVar (lbitems lb) (removeAt pos items) removeAllItems lb = do ! items <- takeVar (lbitems lb) ! Port.removeAllListBoxItems (lbhandle lb) ! putVar (lbitems lb) [] ! instance SingleSelect ListBox where ! selected = newStdAttr lbhandle Port.getListBoxSingleSelection Port.setListBoxSingleSelection ! instance MultiSelect ListBox where selection = newAttr getter setter where getter w = do ! items <- getVar (lbitems w) ! filterM (\i -> Port.getListBoxItemSelectState (lbhandle w) i) [0..length items-1] setter w xs = do ! items <- getVar (lbitems w) ! mapM_ (\x -> Port.setListBoxItemSelectState (lbhandle w) x (elem x xs)) [0..length items-1] ! instance Dimensions ListBox where ! frame = newStdAttr lbhandle Port.getControlFrame Port.moveResizeControl ! instance Able ListBox where ! enabled = newStdAttr lbhandle Port.getControlEnabled Port.setControlEnabled ! instance Tipped ListBox where ! tooltip = newStdAttr lbhandle Port.getControlTip Port.setControlTip ! instance Control ListBox where ! pack = stdPack lbparent lbhandle Port.getListBoxRequestSize ! instance Commanding ListBox where ! command = newStdEvent lbhandle Port.getControlCommandHandler Port.setControlCommandHandler Port.setControlCommandDefHandler -------------------------------------------------------------------- --- 265,509 ---- password = newStdAttr ehandle Port.getEditPassword Port.setEditPassword ! -------------------------------------------------------------------- ! -- Choice & Popup --------------------------------------------------------------------} ! ! -- | A choice control. ! data Choice a = Choice { chhandle :: !WindowHandle ! , chparent :: !WindowHandle ! , chitems :: Var [(String,a)] } + -- | A popup selection box is a special kind of choice control. The default + -- command handler automatically calls a handler associated as a value to the + -- selected item. + type Popup = Choice (IO ()) + -- | Create a popup selection box. ! choice :: Container w => [Prop (Choice a)] -> w -> IO (Choice a) ! choice props w = do p <- do hpop <- Port.createPopUp (hwindow w) ! chitems <- newVar [] ! return (Choice hpop (hwindow w) chitems) set p props return p ! -- | Create a popup selection box. ! popup :: Container w => [Prop Popup] -> w -> IO Popup ! popup props w = do ! c <- choice props w ! set c [on command =: popupCommand c] ! return c ! where ! -- default command handler ! popupCommand :: Popup -> IO () ! popupCommand p ! = do i <- get p selected ! xs <- getVar (chitems p) ! when (i>=0 && i < length xs) (snd (xs!!i)) -- invoke appropiate handler ! instance Countable (Choice a) where ! count = readAttr "count" (fmap length . getVar . chitems) ! instance CommandItems Choice where items ! = newAttr (\w -> getVar (chitems w)) ! (\w xs -> do Port.removeAllPopUpItems (chhandle w) ! mapM_ (Port.appendPopUpItem (chhandle w) . fst) xs ! setVar (chitems w) xs ! Port.setPopUpSelection (chhandle w) 0) appendItem p item@(title,action) = do ! items <- takeVar (chitems p) ! Port.appendPopUpItem (chhandle p) title ! putVar (chitems p) (items++[item]) insertItem p pos item@(title,action) = do ! items <- takeVar (chitems p) ! Port.insertPopUpItem (chhandle p) pos title ! putVar (chitems p) (insertAt pos item items) removeItem p pos = do ! items <- takeVar (chitems p) ! Port.removePopUpItem (chhandle p) pos ! putVar (chitems p) (removeAt pos items) removeAllItems p = do ! items <- takeVar (chitems p) ! Port.removeAllPopUpItems (chhandle p) ! putVar (chitems p) [] ! instance SingleSelect (Choice a) where ! selected = newStdAttr chhandle Port.getPopUpSelection Port.setPopUpSelection ! instance Dimensions (Choice a) where ! frame = newStdAttr chhandle Port.getControlFrame Port.moveResizeControl ! instance Able (Choice a) where ! enabled = newStdAttr chhandle Port.getControlEnabled Port.setControlEnabled ! instance Tipped (Choice a) where ! tooltip = newStdAttr chhandle Port.getControlTip Port.setControlTip ! instance Control (Choice a) where ! pack = stdPack chparent chhandle Port.getPopUpRequestSize ! instance Commanding (Choice a) where ! command = newStdEvent chhandle Port.getControlCommandHandler Port.setControlCommandHandler Port.setControlCommandDefHandler ! instance Eq a => Valued (Choice a) (Maybe a) where ! value = newAttr getValue setValue ! where ! getValue c = do ! i <- get c selected ! xs <- getVar (chitems c) ! return (if i>=0 && i < length xs ! then Just (snd (xs!!i)) ! else Nothing) ! ! setValue c (Just v) = do ! xs <- getVar (chitems c) ! set c [selected =: findValue v 0 xs] ! setValue c Nothing = do ! set c [selected =: -1] ! ! findValue v n [] = -1 ! findValue v n ((_,v'):vs) ! | v == v' = n ! | otherwise = findValue v (n+1) vs ! ! -------------------------------------------------------------------- ! -- SelectionList & ListBox ! -------------------------------------------------------------------- ! ! -- | A selection list control ! data SelectionList a = SelectionList ! { slIsMulti :: Bool ! , slhandle :: !WindowHandle ! , slparent :: !WindowHandle ! , slitems :: Var [(String,a)] ! } ! ! -- | A list box is a special kind of selection list control. The default ! -- command handler automatically calls a handler associated as a value to the ! -- selected item. ! type ListBox = SelectionList (IO ()) ! ! -- | Create a selection list box. ! selectionList :: Container w => Bool -> [Prop (SelectionList a)] -> w -> IO (SelectionList a) ! selectionList multi props w = do ! lb <- do hlist <- Port.createListBox (hwindow w) multi ! slitems <- newVar [] ! return (SelectionList multi hlist (hwindow w) slitems) ! set lb props ! return lb -- | Create a list box. listBox :: Container w => Bool -> [Prop ListBox] -> w -> IO ListBox listBox multi props w = do ! lb <- selectionList multi props w set lb [on command =: listBoxCommand lb] return lb + where + listBoxCommand :: ListBox -> IO () + listBoxCommand lb = do + i <- Port.getListBoxCurrentItem (slhandle lb) + xs <- getVar (slitems lb) + when (i>=0 && i < length xs) (snd (xs!!i)) -- invoke appropiate handler ! instance Countable (SelectionList a) where ! count = readAttr "count" (fmap length . getVar . slitems) ! instance CommandItems SelectionList where items ! = newAttr (\w -> getVar (slitems w)) ! (\w xs -> do Port.removeAllListBoxItems (slhandle w) ! mapM_ (Port.appendListBoxItem (slhandle w) . fst) xs ! setVar (slitems w) xs) appendItem lb item@(title,action) = do ! items <- takeVar (slitems lb) ! Port.appendListBoxItem (slhandle lb) title ! putVar (slitems lb) (items++[item]) insertItem lb pos item@(title,action) = do ! items <- takeVar (slitems lb) ! Port.insertListBoxItem (slhandle lb) pos title ! putVar (slitems lb) (insertAt pos item items) removeItem lb pos = do ! items <- takeVar (slitems lb) ! Port.removeListBoxItem (slhandle lb) pos ! putVar (slitems lb) (removeAt pos items) removeAllItems lb = do ! items <- takeVar (slitems lb) ! Port.removeAllListBoxItems (slhandle lb) ! putVar (slitems lb) [] ! instance SingleSelect (SelectionList a) where ! selected = newStdAttr slhandle Port.getListBoxSingleSelection Port.setListBoxSingleSelection ! instance MultiSelect (SelectionList a) where selection = newAttr getter setter where getter w = do ! items <- getVar (slitems w) ! filterM (\i -> Port.getListBoxItemSelectState (slhandle w) i) [0..length items-1] setter w xs = do ! items <- getVar (slitems w) ! mapM_ (\x -> Port.setListBoxItemSelectState (slhandle w) x (elem x xs)) [0..length items-1] ! instance Dimensions (SelectionList a) where ! frame = newStdAttr slhandle Port.getControlFrame Port.moveResizeControl ! instance Able (SelectionList a) where ! enabled = newStdAttr slhandle Port.getControlEnabled Port.setControlEnabled ! instance Tipped (SelectionList a) where ! tooltip = newStdAttr slhandle Port.getControlTip Port.setControlTip ! instance Control (SelectionList a) where ! pack = stdPack slparent slhandle Port.getListBoxRequestSize ! instance Commanding (SelectionList a) where ! command = newStdEvent slhandle Port.getControlCommandHandler Port.setControlCommandHandler Port.setControlCommandDefHandler ! ! instance Eq a => Valued (SelectionList a) [a] where ! value = newAttr getter setter ! where ! getter (SelectionList multi handle _ itemsVar) ! | multi = do ! xs <- getVar itemsVar ! let getSelection _ [] = return [] ! getSelection i ((_,v):xs) = do ! selected <- Port.getListBoxItemSelectState handle i ! vs <- getSelection (i+1) xs ! return (if selected then v:vs else vs) ! getSelection 0 xs ! | otherwise = do ! index <- Port.getListBoxSingleSelection handle ! xs <- getVar itemsVar ! return (if index>=0 && index < length xs ! then [snd (xs!!index)] ! else []) ! setter (SelectionList multi handle _ itemsVar) vs ! | multi = do ! xs <- getVar itemsVar ! let setSelection _ [] = return () ! setSelection i ((_,v):xs) = do ! Port.setListBoxItemSelectState handle i (elem v vs) ! setSelection (i+1) xs ! setSelection 0 xs ! | otherwise = do ! xs <- getVar itemsVar ! let setSelection _ [] = Port.setListBoxSingleSelection handle (-1) ! setSelection i ((_,v):xs) ! | v `elem` vs = Port.setListBoxSingleSelection handle i ! | otherwise = setSelection (i+1) xs ! setSelection 0 xs ! -------------------------------------------------------------------- *************** *** 453,456 **** --- 544,550 ---- instance Control CheckBox where pack = stdPack cparent chandle Port.getCheckBoxRequestSize + + instance Valued CheckBox Bool where + value = checked -------------------------------------------------------------------- *************** *** 488,491 **** --- 582,588 ---- instance Control RadioBox where pack = stdPack rparent rhandle Port.getRadioBoxRequestSize + + instance Valued RadioBox Bool where + value = checked *************** *** 531,534 **** --- 628,634 ---- instance Control Slider where pack = stdPack sparent shandle Port.getSliderRequestSize + + instance Valued Slider Int where + value = selectedPos *************** *** 623,626 **** --- 723,728 ---- pack = stdPack pbparent pbhandle Port.getProgressBarRequestSize + instance Valued ProgressBar Int where + value = selectedPos -------------------------------------------------------------------- |
From: <kr_...@us...> - 2003-11-23 16:29:16
|
Update of /cvsroot/htoolkit/gio In directory sc8-pr-cvs1:/tmp/cvs-serv415 Modified Files: makefile Log Message: Add support for Valued class and Choice and SelectionList controls Index: makefile =================================================================== RCS file: /cvsroot/htoolkit/gio/makefile,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** makefile 15 Nov 2003 10:34:13 -0000 1.17 --- makefile 23 Nov 2003 16:29:13 -0000 1.18 *************** *** 62,66 **** # options ! HC-OPTIONS = -package port -O2 # haddock --- 62,66 ---- # options ! HC-OPTIONS = -package port -O2 -fglasgow-exts # haddock |
From: <kr_...@us...> - 2003-11-23 10:31:08
|
Update of /cvsroot/htoolkit/gio/src/Graphics/UI/GIO In directory sc8-pr-cvs1:/tmp/cvs-serv4812/src/Graphics/UI/GIO Modified Files: Controls.hs Log Message: Better Haddock style comments Index: Controls.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Controls.hs,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** Controls.hs 23 Nov 2003 10:25:47 -0000 1.38 --- Controls.hs 23 Nov 2003 10:31:05 -0000 1.39 *************** *** 16,21 **** ----------------------------------------------------------------------------------------- module Graphics.UI.GIO.Controls( ! -- * Controls ! -- ** Button -- | A button control is a small, rectangular child window that can be -- clicked on and off. Buttons can be labeled or appear without text. --- 16,20 ---- ----------------------------------------------------------------------------------------- module Graphics.UI.GIO.Controls( ! -- * Button -- | A button control is a small, rectangular child window that can be -- clicked on and off. Buttons can be labeled or appear without text. *************** *** 23,36 **** Button, button ! -- ** Label -- | A label control simply displays a text string and it can be used -- to label other controls. A label control can\'t take input and can\'t provide output. , Label, label ! -- ** Entry -- | An entry control is a rectangular widget in which the user can enter text. , Entry, entry, readOnly, password ! -- ** Popup -- | A popup control consists of a list box combined with a label control. -- The list box portion of the control drop down only when the user selects --- 22,35 ---- Button, button ! -- * Label -- | A label control simply displays a text string and it can be used -- to label other controls. A label control can\'t take input and can\'t provide output. , Label, label ! -- * Entry -- | An entry control is a rectangular widget in which the user can enter text. , Entry, entry, readOnly, password ! -- * Popup -- | A popup control consists of a list box combined with a label control. -- The list box portion of the control drop down only when the user selects *************** *** 39,43 **** , Popup, popup ! -- ** ListBox -- | A list box displays a list of items, that the user can view and select. -- In a single-selection list box, the user can select only one item. --- 38,42 ---- , Popup, popup ! -- * ListBox -- | A list box displays a list of items, that the user can view and select. -- In a single-selection list box, the user can select only one item. *************** *** 47,51 **** , ListBox, listBox ! -- ** Slider -- | A slider control is a widget containing a slider and tick marks. -- When the user moves the slider, using either the mouse or the direction keys, --- 46,50 ---- , ListBox, listBox ! -- * Slider -- | A slider control is a widget containing a slider and tick marks. -- When the user moves the slider, using either the mouse or the direction keys, *************** *** 55,64 **** , Slider, hslider, vslider ! -- ** TrackBar -- | An track bar control is a pair of arrow buttons that the user can click -- to increment or decrement the value value displayed in another control. , TrackBar, hTrackBar, vTrackBar, increment, decrement ! -- ** ProgressBar -- | A progress bar control is a window that an application can use to -- indicate the progress of a lengthy operation. It consists of a rectangle --- 54,63 ---- , Slider, hslider, vslider ! -- * TrackBar -- | An track bar control is a pair of arrow buttons that the user can click -- to increment or decrement the value value displayed in another control. , TrackBar, hTrackBar, vTrackBar, increment, decrement ! -- * ProgressBar -- | A progress bar control is a window that an application can use to -- indicate the progress of a lengthy operation. It consists of a rectangle *************** *** 70,74 **** , ProgressBar, hProgressBar, vProgressBar ! -- ** CheckBox -- | A check box consists of a square box and a label, that indicates a choice -- the user can make by selecting the check. Each CheckBox has two states: --- 69,73 ---- , ProgressBar, hProgressBar, vProgressBar ! -- * CheckBox -- | A check box consists of a square box and a label, that indicates a choice -- the user can make by selecting the check. Each CheckBox has two states: *************** *** 78,82 **** , CheckBox, checkBox ! -- ** RadioBox -- | A radio button consists of a round button and a label that indicates a -- choice the user can make by selecting the button. An application typically --- 77,81 ---- , CheckBox, checkBox ! -- * RadioBox -- | A radio button consists of a round button and a label that indicates a -- choice the user can make by selecting the button. An application typically *************** *** 88,92 **** , RadioBox, radioBox, setRadioBoxGroup ! -- ** GroupBox -- | A group box is a rectangle that surrounds a set of controls, such as -- check boxes or radio buttons, with application-defined label in its upper --- 87,91 ---- , RadioBox, radioBox, setRadioBoxGroup ! -- * GroupBox -- | A group box is a rectangle that surrounds a set of controls, such as -- check boxes or radio buttons, with application-defined label in its upper *************** *** 95,102 **** , GroupBox, groupBox ! -- ** CompoundControl , CompoundControl, compoundControl ! -- ** Notebook -- | A notebook control is analogous to the dividers in a real notebook. -- By using a notebook control, an application can define multiple pages for --- 94,101 ---- , GroupBox, groupBox ! -- * CompoundControl , CompoundControl, compoundControl ! -- * Notebook -- | A notebook control is analogous to the dividers in a real notebook. -- By using a notebook control, an application can define multiple pages for |