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...> - 2003-03-30 18:49:12
|
Update of /cvsroot/htoolkit/port In directory sc8-pr-cvs1:/tmp/cvs-serv19641/port Modified Files: makefile Log Message: The process related features are extracted into newly created module "Process". Added new process attribute "title" instead of title as parameter. Index: makefile =================================================================== RCS file: /cvsroot/htoolkit/port/makefile,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** makefile 27 Mar 2003 13:36:21 -0000 1.15 --- makefile 30 Mar 2003 18:49:07 -0000 1.16 *************** *** 39,43 **** Port/Controls.hs \ Port/FileDialog.hs Port/ColorDialog.hs Port/FontDialog.hs \ ! Port/Menu.hs Port/Window.hs \ Port/Timer.hs \ Port/Message.hs \ --- 39,43 ---- Port/Controls.hs \ Port/FileDialog.hs Port/ColorDialog.hs Port/FontDialog.hs \ ! Port/Menu.hs Port/Window.hs Port/Process.hs \ Port/Timer.hs \ Port/Message.hs \ |
From: <kr_...@us...> - 2003-03-30 18:49:12
|
Update of /cvsroot/htoolkit/port/src/Port In directory sc8-pr-cvs1:/tmp/cvs-serv19641/port/src/Port Added Files: Process.hs Log Message: The process related features are extracted into newly created module "Process". Added new process attribute "title" instead of title as parameter. --- NEW FILE: Process.hs --- {-# OPTIONS -fglasgow-exts #-} ----------------------------------------------------------------------------------------- {-| Module : Process Copyright : (c) Krasimir Angelov 2003 License : BSD-style Maintainer : ka2...@ya... Stability : provisional Portability : portable -} ----------------------------------------------------------------------------------------- module Graphics.UI.Port.Process ( start, quit, halt , getProcessTitle, setProcessTitle ) where import Graphics.UI.Port.Types import Graphics.UI.Port.Window import Graphics.UI.Port.Timer import Graphics.UI.Port.Handlers import Foreign.C import System.Mem( performGC ) import Control.Monad(when) -- | Start the event loop. Runs until 'quit' is called. start :: DocumentInterface -> IO a -> IO a start di io = do osInit (toCDocumentInterface di) setProcessDismissHandler (quit >> return ()) r <- io osStart return r -- | 'quit' exits the main event loop, closes any windows and menus, destroys all timers -- and unregisters any event handlers. This function is automatically called when all -- windows are closed. quit :: IO Bool quit = do r <- dismissAllWindows when r $ do destroyAllTimers osQuit performGC -- to release any foreign objects return r -- | 'quit' exits the main event loop, closes any windows and menus, destroys all timers -- and unregisters any event handlers. This function is automatically called when all -- windows are closed. halt :: IO () halt = do destroyAllWindows destroyAllTimers osQuit performGC -- to release any foreign objects foreign import ccall "osInit" osInit :: CInt -> IO () foreign import ccall "osStart" osStart :: IO () foreign import ccall osQuit :: IO () getProcessTitle = osGetProcessTitle >>= peekCString foreign import ccall osGetProcessTitle :: IO CString setProcessTitle appName = withCString appName osSetProcessTitle foreign import ccall osSetProcessTitle :: CString -> IO () |
From: <kr_...@us...> - 2003-03-30 18:49:12
|
Update of /cvsroot/htoolkit/port/src In directory sc8-pr-cvs1:/tmp/cvs-serv19641/port/src Modified Files: Port.hs Log Message: The process related features are extracted into newly created module "Process". Added new process attribute "title" instead of title as parameter. Index: Port.hs =================================================================== RCS file: /cvsroot/htoolkit/port/src/Port.hs,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Port.hs 26 Mar 2003 08:45:51 -0000 1.13 --- Port.hs 30 Mar 2003 18:49:07 -0000 1.14 *************** *** 1,3 **** - {-# OPTIONS -fglasgow-exts -#include Types.h #-} ----------------------------------------------------------------------------------------- {-| Module : Port --- 1,2 ---- *************** *** 10,14 **** The /main/ interface of "Port". Re-exports functionality from ! other modules and exports the 'start' function. -} ----------------------------------------------------------------------------------------- --- 9,13 ---- The /main/ interface of "Port". Re-exports functionality from ! other modules. -} ----------------------------------------------------------------------------------------- *************** *** 38,43 **** , module Graphics.UI.Port.Types ! -- * The main event loop ! , start, quit ) where --- 37,42 ---- , module Graphics.UI.Port.Types ! -- * Process ! , module Graphics.UI.Port.Process ) where *************** *** 58,61 **** --- 57,62 ---- import Graphics.UI.Port.Timer + import Graphics.UI.Port.Process + import Graphics.UI.Port.Types hiding ( CColor, fromCColor, toCColor *************** *** 75,103 **** , CBool, fromCBool, toCBool ) - - import Foreign.C - import System.Mem( performGC ) - import Control.Monad(when) - - -- | Start the event loop. Runs until 'quit' is called. - start :: String -> DocumentInterface -> IO a -> IO a - start appName di io = do - withCString appName (\s -> osInit s (toCDocumentInterface di)) - setProcessDismissHandler quit - r <- io - osStart - return r - foreign import ccall "osInit" osInit :: CString -> CInt -> IO () - foreign import ccall "osStart" osStart :: IO () - - -- | 'quit' exits the main event loop, closes any windows and menus, destroys all timers - -- and unregisters any event handlers. This function is automatically called when all - -- windows are closed. - quit :: IO () - quit = do - r <- dismissAllWindows - when r $ do - destroyAllTimers - osQuit - performGC -- to release any foreign objects - foreign import ccall osQuit :: IO () \ No newline at end of file --- 76,77 ---- |
From: <kr_...@us...> - 2003-03-30 18:49:12
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32 In directory sc8-pr-cvs1:/tmp/cvs-serv19641/port/src/cbits/Win32 Modified Files: Frame.c Util.c Window.c Log Message: The process related features are extracted into newly created module "Process". Added new process attribute "title" instead of title as parameter. Index: Frame.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Frame.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Frame.c 29 Mar 2003 08:12:19 -0000 1.3 --- Frame.c 30 Mar 2003 18:49:07 -0000 1.4 *************** *** 188,189 **** --- 188,242 ---- return result; }; + + char *osGetProcessTitle() + { + FrameData *pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); + return pFrameData->lpszAppName; + } + + void osSetProcessTitle(char *szAppName) + { + HWND hWnd; + char *s, *title; + int nTextLen; + FrameData *pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); + + pFrameData->lpszAppName = strdup(szAppName); + + hWnd = pFrameData->hClientWnd; + if (pFrameData->DocumentInterface == 2) + hWnd = (HWND) SendMessage(hWnd, WM_MDIGETACTIVE, 0, 0); + + s = NULL; + if (hWnd) + { + nTextLen = GetWindowTextLength(hWnd); + s = malloc(nTextLen+1); + if (s) GetWindowText(hWnd, s, nTextLen); + } + + if (pFrameData->lpszAppName && *pFrameData->lpszAppName) + { + if (s && *s) + { + title = rmalloc(strlen(pFrameData->lpszAppName)+nTextLen+6); + + if (title) + { + strcpy(title, pFrameData->lpszAppName); + strcat(title, " - ["); + strcat(title, s); + strcat(title, "]"); + SetWindowText(ghWndFrame, title); + } + + rfree(title); + } + else + SetWindowText(ghWndFrame, pFrameData->lpszAppName); + } + else + SetWindowText(ghWndFrame, s); + + free(s); + } Index: Util.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Util.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Util.c 29 Mar 2003 08:12:19 -0000 1.10 --- Util.c 30 Mar 2003 18:49:07 -0000 1.11 *************** *** 50,54 **** */ ! void osInit(char *szAppName, int DocumentInterface) { if (!ghModule) --- 50,54 ---- */ ! void osInit(int DocumentInterface) { if (!ghModule) *************** *** 130,134 **** { ghWndFrame = CreateWindow ( "HSDIFRAME", ! szAppName, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT,CW_USEDEFAULT, --- 130,134 ---- { ghWndFrame = CreateWindow ( "HSDIFRAME", ! NULL, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT,CW_USEDEFAULT, *************** *** 143,147 **** { ghWndFrame = CreateWindow ( "HMDIFRAME", ! szAppName, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT,CW_USEDEFAULT, --- 143,147 ---- { ghWndFrame = CreateWindow ( "HMDIFRAME", ! NULL, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT,CW_USEDEFAULT, *************** *** 200,201 **** --- 200,202 ---- DestroyWindow(ghWndFrame); } + Index: Window.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Window.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Window.c 29 Mar 2003 08:12:19 -0000 1.17 --- Window.c 30 Mar 2003 18:49:07 -0000 1.18 *************** *** 716,722 **** char *s = (char *) lParam; ! printf("WM_SETTEXT %p %d\n", s, *s); ! ! if (pFrameData->lpszAppName) { if (s && *s) --- 716,720 ---- char *s = (char *) lParam; ! if (pFrameData->lpszAppName && *pFrameData->lpszAppName) { if (s && *s) *************** *** 724,737 **** char *title; int nTextLen; ! ! s = (char *) lParam; nTextLen = strlen(s); title = rmalloc(strlen(pFrameData->lpszAppName)+nTextLen+6); ! strcpy(title, pFrameData->lpszAppName); ! strcat(title, " - ["); ! strcat(title, s); ! strcat(title, "]"); ! SetWindowText(ghWndFrame, title); } else --- 722,739 ---- char *title; int nTextLen; ! nTextLen = strlen(s); title = rmalloc(strlen(pFrameData->lpszAppName)+nTextLen+6); ! if (title) ! { ! strcpy(title, pFrameData->lpszAppName); ! strcat(title, " - ["); ! strcat(title, s); ! strcat(title, "]"); ! SetWindowText(ghWndFrame, title); ! } ! ! free(title); } else *************** *** 774,789 **** case WM_SETTEXT: { ! char *title, *s; ! int nTextLen; ! s = (char *) lParam; ! nTextLen = strlen(s); ! title = rmalloc(strlen(pFrameData->lpszAppName)+nTextLen+6); ! strcpy(title, pFrameData->lpszAppName); ! strcat(title, " - ["); ! strcat(title, s); ! strcat(title, "]"); ! SetWindowText(ghWndFrame, title); } break; --- 776,807 ---- case WM_SETTEXT: { ! char *s = (char *) lParam; ! ! if (pFrameData->lpszAppName && *pFrameData->lpszAppName) ! { ! if (s && *s) ! { ! char *title; ! int nTextLen; ! nTextLen = strlen(s); ! title = rmalloc(strlen(pFrameData->lpszAppName)+nTextLen+6); ! if (title) ! { ! strcpy(title, pFrameData->lpszAppName); ! strcat(title, " - ["); ! strcat(title, s); ! strcat(title, "]"); ! SetWindowText(ghWndFrame, title); ! } ! ! free(title); ! } ! else ! SetWindowText(ghWndFrame, pFrameData->lpszAppName); ! } ! else ! SetWindowText(ghWndFrame, s); } break; *************** *** 801,804 **** --- 819,824 ---- strcat(title, "]"); SetWindowText(ghWndFrame, title); + + free(title); if (hWnd == (HWND) lParam) |
From: <kr_...@us...> - 2003-03-30 18:49:11
|
Update of /cvsroot/htoolkit/port/src/cbits/GTK In directory sc8-pr-cvs1:/tmp/cvs-serv19641/port/src/cbits/GTK Modified Files: Frame.c Util.c Window.c Log Message: The process related features are extracted into newly created module "Process". Added new process attribute "title" instead of title as parameter. Index: Frame.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Frame.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Frame.c 29 Mar 2003 08:12:18 -0000 1.3 --- Frame.c 30 Mar 2003 18:49:07 -0000 1.4 *************** *** 5,8 **** --- 5,9 ---- #include <gdk/gdkkeysyms.h> + char *gAppName = NULL; GtkWidget *gFrameWidget = NULL; GtkWidget *gClientWidget = NULL; *************** *** 50,53 **** --- 51,63 ---- } + static void frame_destroy_handler(GtkWidget *widget, GdkEvent *event, gpointer user_data) + { + handleProcessDestroy(); + if (gDocumentInterface == 1) + free(gWindowName); + } + + + BOOL gInKey = FALSE; int gCurChar = 0; *************** *** 189,192 **** --- 199,205 ---- GTK_SIGNAL_FUNC(frame_delete_handler), NULL); + gtk_signal_connect (GTK_OBJECT(gFrameWidget), "destroy", + GTK_SIGNAL_FUNC(frame_destroy_handler), + NULL); gtk_signal_connect (GTK_OBJECT(gFrameWidget), "key-press-event", GTK_SIGNAL_FUNC(frame_key_press_handler), *************** *** 274,281 **** /* Create the window. */ gFrameWidget = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_window_set_title(GTK_WINDOW(gFrameWidget), gAppName); gtk_signal_connect (GTK_OBJECT(gFrameWidget), "delete-event", GTK_SIGNAL_FUNC(frame_delete_handler), NULL); gtk_signal_connect (GTK_OBJECT(gFrameWidget), "key-press-event", GTK_SIGNAL_FUNC(frame_key_press_handler), --- 287,296 ---- /* Create the window. */ gFrameWidget = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_signal_connect (GTK_OBJECT(gFrameWidget), "delete-event", GTK_SIGNAL_FUNC(frame_delete_handler), NULL); + gtk_signal_connect (GTK_OBJECT(gFrameWidget), "destroy", + GTK_SIGNAL_FUNC(frame_destroy_handler), + NULL); gtk_signal_connect (GTK_OBJECT(gFrameWidget), "key-press-event", GTK_SIGNAL_FUNC(frame_key_press_handler), *************** *** 296,298 **** --- 311,324 ---- gtk_widget_show_all(gFrameWidget); + } + + char *osGetProcessTitle() + { + return gAppName; + } + + void osSetProcessTitle(char *szAppName) + { + gAppName = strdup(szAppName); + updateFrameTitle(); } Index: Util.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Util.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Util.c 29 Mar 2003 08:12:18 -0000 1.10 --- Util.c 30 Mar 2003 18:49:07 -0000 1.11 *************** *** 7,11 **** BOOL bInitialized = FALSE; int gDocumentInterface; - char *gAppName; void *rmalloc (unsigned long bytes) --- 7,10 ---- *************** *** 27,31 **** } ! void osInit(char *AppName, int DocumentInterface) { if (!bInitialized) --- 26,30 ---- } ! void osInit(int DocumentInterface) { if (!bInitialized) *************** *** 40,44 **** bInitialized = TRUE; - gAppName = strdup(AppName); gDocumentInterface = DocumentInterface; --- 39,42 ---- *************** *** 54,58 **** gtk_main(); handleProcessDestroy(); - free(gAppName); } --- 52,55 ---- *************** *** 110,111 **** --- 107,144 ---- return s; }; + + void updateFrameTitle() + { + char *title; + + if (gAppName && *gAppName) + { + if (gDocumentInterface == 2) + { + GtkWidget *label; + + label = gtk_notebook_get_tab_label(GTK_NOTEBOOK(gClientWidget),gtk_notebook_get_nth_page(GTK_NOTEBOOK(gClientWidget),gtk_notebook_get_current_page(GTK_NOTEBOOK(gClientWidget)))); + gWindowName = gtk_label_get_text(GTK_LABEL(label)); + } + + if (gWindowName && *gWindowName) + { + title = rmalloc(strlen(gAppName)+strlen(gWindowName)+6); + + if (title) + { + strcpy(title, gAppName); + strcat(title, " - ["); + strcat(title, gWindowName); + strcat(title, "]"); + gtk_window_set_title(GTK_WINDOW(gFrameWidget), title); + } + + rfree(title); + } + else + gtk_window_set_title(GTK_WINDOW(gFrameWidget), gAppName); + } + else + gtk_window_set_title(GTK_WINDOW(gFrameWidget), gWindowName); + } Index: Window.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Window.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Window.c 29 Mar 2003 08:12:18 -0000 1.11 --- Window.c 30 Mar 2003 18:49:07 -0000 1.12 *************** *** 4,7 **** --- 4,8 ---- #include <gdk/gdkkeysyms.h> + char *gWindowName = NULL; static void getWindowClipRect(GtkWidget *window, GdkRegion *region) *************** *** 290,294 **** if (gDocumentInterface == 2) ! gtk_notebook_append_page(GTK_NOTEBOOK(gClientWidget),sw,gtk_label_new(gAppName)); else { --- 291,295 ---- if (gDocumentInterface == 2) ! gtk_notebook_append_page(GTK_NOTEBOOK(gClientWidget),sw,gtk_label_new("")); else { *************** *** 355,360 **** char *osGetWindowTitle(WindowHandle window) { - char *title; - if (gDocumentInterface == 2) { --- 356,359 ---- *************** *** 362,373 **** label = gtk_notebook_get_tab_label(GTK_NOTEBOOK(gClientWidget),window); ! title = gtk_label_get_text(GTK_LABEL(label)); ! } ! else ! { ! title = GTK_WINDOW(gFrameWidget)->title; } ! ! return strdup(title); }; --- 361,368 ---- label = gtk_notebook_get_tab_label(GTK_NOTEBOOK(gClientWidget),window); ! gWindowName = gtk_label_get_text(GTK_LABEL(label)); } ! ! return strdup(gWindowName); }; *************** *** 385,389 **** else { ! gtk_window_set_title(GTK_WINDOW(gFrameWidget), title); } }; --- 380,385 ---- else { ! gWindowName = strdup(title); ! updateFrameTitle(); } }; |
From: <kr_...@us...> - 2003-03-30 18:49:11
|
Update of /cvsroot/htoolkit/gio/src/Graphics/UI/GIO In directory sc8-pr-cvs1:/tmp/cvs-serv19641/gio/src/Graphics/UI/GIO Modified Files: Attributes.hs Events.hs Window.hs Added Files: Process.hs Log Message: The process related features are extracted into newly created module "Process". Added new process attribute "title" instead of title as parameter. --- NEW FILE: Process.hs --- {-# OPTIONS -fglasgow-exts #-} ----------------------------------------------------------------------------------------- {-| Module : Process Copyright : (c) Krasimir Angelov 2003 License : BSD-style Maintainer : ka2...@ya... Stability : provisional Portability : portable The process object is an abstraction which provides access to attributes which are global for entire application. -} ------------------------------------------------------------------------------- module Graphics.UI.GIO.Process ( Process, pc , start, quit, halt ) where import System.Directory import Graphics.UI.GIO.Types import Graphics.UI.GIO.Attributes import Graphics.UI.GIO.Events import qualified Graphics.UI.Port as Lib data Process pc :: Process pc = error "The Process is an abstract object and cannot be evaluated" instance Deadly Process where dismissWidget p = quit dismiss = newEvent (const Lib.getProcessDismissHandler) (const Lib.setProcessDismissHandler) (const Lib.setProcessDismissDefHandler) destroyWidget p = halt destroy = newEvent (const Lib.getProcessDestroyHandler) (const Lib.setProcessDestroyHandler) (const Lib.setProcessDestroyDefHandler) instance Titled Process where title = newAttr (const Lib.getProcessTitle) (const Lib.setProcessTitle) -- | Start the event loop. start :: DocumentInterface -> [Prop Process] -> IO a -> IO () start di props io = do curdir <- getCurrentDirectory Lib.start di ((set pc props >> io) `catch` \err -> quit >> ioError err) setCurrentDirectory curdir -- | Force the event loop to terminate. quit :: IO Bool quit = Lib.quit -- | Force the event loop to terminate. halt :: IO () halt = Lib.halt Index: Attributes.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Attributes.hs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Attributes.hs 26 Mar 2003 19:20:23 -0000 1.7 --- Attributes.hs 30 Mar 2003 18:49:07 -0000 1.8 *************** *** 28,32 **** The function 'get', 'set' and '(=:)' are polymorphic and work for all widgets, but the @title@ attribute just works for windows. Many attributes are defined for multiple ! widgets and are organised in type classes, for example 'Widget' and 'Dimensions'. The ('~:') operator is used to transform an attribute with an update function. --- 28,32 ---- The function 'get', 'set' and '(=:)' are polymorphic and work for all widgets, but the @title@ attribute just works for windows. Many attributes are defined for multiple ! widgets and are organised in type classes, for example 'Deadly' and 'Dimensions'. The ('~:') operator is used to transform an attribute with an update function. *************** *** 43,51 **** -- * Common widget classes ! -- ** Widget ! , Widget ! , dismissWidget ! , destroyWidget ! -- ** Dimensions , Dimensions --- 43,47 ---- -- * Common widget classes ! -- ** Dimensions , Dimensions *************** *** 61,64 **** --- 57,63 ---- -- ** Literate , Literate, text, font + + -- ** Titled + , Titled, title -- ** Drawn *************** *** 192,202 **** Classes --------------------------------------------------------------------} ! -- | Every window item is part of the 'Widget' class. The operations ! -- on widgets are 'dismissWidget' and 'destroyWidget'. ! class Widget w where ! -- | Close a widget ! dismissWidget :: w -> IO Bool ! destroyWidget :: w -> IO () ! -- | Widgets with dimensions have a width, height and position. Only the -- 'frame' method is not defaulted. --- 191,195 ---- Classes --------------------------------------------------------------------} ! -- | Widgets with dimensions have a width, height and position. Only the -- 'frame' method is not defaulted. *************** *** 255,258 **** --- 248,256 ---- -- | The font. font :: Attr w Font + + -- | Widgets with a title. + class Titled w where + -- | The title. + title :: Attr w String -- | Widgets that can be enabled or disabled. Index: Events.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Events.hs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Events.hs 26 Mar 2003 08:54:55 -0000 1.6 --- Events.hs 30 Mar 2003 18:49:07 -0000 1.7 *************** *** 62,75 **** -- * Basic events -- ** Commanding , Commanding, command -- ** Reactive , Reactive , mouse, keyboard -- ** Form , Form, activate, deactivate, scroll, resize -- ** Deadly ! , Deadly ! , destroy, dismiss -- ** Paint , Paint, paint, repaint --- 62,81 ---- -- * Basic events + -- ** Commanding , Commanding, command + -- ** Reactive , Reactive , mouse, keyboard + -- ** Form , Form, activate, deactivate, scroll, resize + -- ** Deadly ! , Deadly ! , dismissWidget, dismiss ! , destroyWidget, destroy ! -- ** Paint , Paint, paint, repaint *************** *** 155,163 **** scroll :: Event w (Point -> IO ()) resize :: Event w (Size -> IO ()) ! -- | The Deadly widgets can be destroyed and dissmissed class Deadly w where -- | The 'dismiss' event is called when the user tries to close the form. dismiss :: Event w (IO ()) -- | The destroy event is triggered when a widget is destroied. destroy :: Event w (IO ()) --- 161,175 ---- scroll :: Event w (Point -> IO ()) resize :: Event w (Size -> IO ()) ! -- | The Deadly widgets can be destroyed and dissmissed class Deadly w where + -- | Close a widget + dismissWidget :: w -> IO Bool + -- | The 'dismiss' event is called when the user tries to close the form. dismiss :: Event w (IO ()) + + destroyWidget :: w -> IO () + -- | The destroy event is triggered when a widget is destroied. destroy :: Event w (IO ()) Index: Window.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Window.hs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Window.hs 26 Mar 2003 15:39:46 -0000 1.8 --- Window.hs 30 Mar 2003 18:49:07 -0000 1.9 *************** *** 12,16 **** ----------------------------------------------------------------------------------------- module Graphics.UI.GIO.Window ! ( Window, window, title, domain, resizeable, view, layout, autosize , dialog, modalDialog -- * Internal --- 12,16 ---- ----------------------------------------------------------------------------------------- module Graphics.UI.GIO.Window ! ( Window, window, domain, resizeable, view, layout, autosize , dialog, modalDialog -- * Internal *************** *** 118,126 **** = varAttr vautosize ! -- | The title of the window. ! title :: Attr Window String ! title ! = newAttr (\w -> Lib.getWindowTitle (hwindow w)) ! (\w x -> Lib.setWindowTitle (hwindow w) x) -- | The window handle --- 118,124 ---- = varAttr vautosize ! instance Titled Window where ! title = newAttr (\w -> Lib.getWindowTitle (hwindow w)) ! (\w x -> Lib.setWindowTitle (hwindow w) x) -- | The window handle *************** *** 151,157 **** (\w sz-> Lib.setWindowViewSize (hwindow w) sz) ! instance Widget Window where dismissWidget w = Lib.dismissWindow (hwindow w) ! destroyWidget w = Lib.destroyWindow (hwindow w) instance Dimensions Window where --- 149,157 ---- (\w sz-> Lib.setWindowViewSize (hwindow w) sz) ! instance Deadly Window where dismissWidget w = Lib.dismissWindow (hwindow w) ! dismiss = newDismissEvent hwindow ! destroyWidget w = Lib.destroyWindow (hwindow w) ! destroy = newDestroyEvent hwindow instance Dimensions Window where *************** *** 182,189 **** resize = newResizeEvent hwindow - instance Deadly Window where - dismiss = newDismissEvent hwindow - destroy = newDestroyEvent hwindow - instance Paint Window where repaint w = do Lib.invalidateWindow (hwindow w) --- 182,185 ---- |
From: <kr_...@us...> - 2003-03-30 18:49:11
|
Update of /cvsroot/htoolkit/port/src/include In directory sc8-pr-cvs1:/tmp/cvs-serv19641/port/src/include Modified Files: Internals.h Types.h Log Message: The process related features are extracted into newly created module "Process". Added new process attribute "title" instead of title as parameter. Index: Internals.h =================================================================== RCS file: /cvsroot/htoolkit/port/src/include/Internals.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Internals.h 29 Mar 2003 08:12:19 -0000 1.7 --- Internals.h 30 Mar 2003 18:49:08 -0000 1.8 *************** *** 33,37 **** extern int gDocumentInterface; ! extern char *gAppName; extern GtkWidget *gFrameWidget; extern GtkWidget *gClientWidget; --- 33,37 ---- extern int gDocumentInterface; ! extern char *gAppName, *gWindowName; extern GtkWidget *gFrameWidget; extern GtkWidget *gClientWidget; *************** *** 42,45 **** --- 42,47 ---- void createMDIFrame(); void createSDIFrame(); + + void updateFrameTitle(); #endif Index: Types.h =================================================================== RCS file: /cvsroot/htoolkit/port/src/include/Types.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Types.h 26 Mar 2003 12:56:30 -0000 1.7 --- Types.h 30 Mar 2003 18:49:08 -0000 1.8 *************** *** 126,132 **** #endif ! extern void osInit(char *AppName, int DocumentInterface); extern void osStart(); extern void osQuit(); #endif --- 126,134 ---- #endif ! extern void osInit(int DocumentInterface); extern void osStart(); extern void osQuit(); + extern char *osGetProcessTitle(); + extern void osSetProcessTitle(char *CString); #endif |
From: <kr_...@us...> - 2003-03-30 18:49:10
|
Update of /cvsroot/htoolkit/gio/src/Graphics/UI In directory sc8-pr-cvs1:/tmp/cvs-serv19641/gio/src/Graphics/UI Modified Files: GIO.hs Log Message: The process related features are extracted into newly created module "Process". Added new process attribute "title" instead of title as parameter. Index: GIO.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO.hs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** GIO.hs 26 Mar 2003 10:38:33 -0000 1.8 --- GIO.hs 30 Mar 2003 18:49:07 -0000 1.9 *************** *** 1,3 **** - {-# OPTIONS -fglasgow-exts #-} ----------------------------------------------------------------------------------------- {-| Module : GIO --- 1,2 ---- *************** *** 10,15 **** The /main/ interface to the GIO library. Reexports ! functionality from other modules and provides the ! 'start' and 'quit' functions. -} ------------------------------------------------------------------------------- --- 9,13 ---- The /main/ interface to the GIO library. Reexports ! functionality from other modules. -} ------------------------------------------------------------------------------- *************** *** 29,37 **** , module Graphics.UI.GIO.Layout , module Graphics.UI.GIO.Controls ! , start, quit ) where - import System.Directory - import qualified Graphics.UI.Port as Lib import Graphics.UI.GIO.Types import Graphics.UI.GIO.Font --- 27,33 ---- , module Graphics.UI.GIO.Layout , module Graphics.UI.GIO.Controls ! , module Graphics.UI.GIO.Process ) where import Graphics.UI.GIO.Types import Graphics.UI.GIO.Font *************** *** 47,70 **** import Graphics.UI.GIO.Layout import Graphics.UI.GIO.Controls ! ! data Process ! ! instance Deadly Process where ! dismiss = newEvent (const Lib.getProcessDismissHandler) (const Lib.setProcessDismissHandler) (const Lib.setProcessDismissDefHandler) ! destroy = newEvent (const Lib.getProcessDestroyHandler) (const Lib.setProcessDestroyHandler) (const Lib.setProcessDestroyDefHandler) ! ! -- | Start the event loop. 'quit' is automatically called all windows are closed. ! start :: String -> DocumentInterface -> [Prop Process] -> IO a -> IO () ! start title di props io ! = do curdir <- getCurrentDirectory ! Lib.start title di action ! setCurrentDirectory curdir ! where ! action = do ! mapM_ (set1 undefined) props ! io `catch` \err -> do{ quit; ioError err } ! ! -- | Force the event loop to terminate. ! quit :: IO () ! quit ! = Lib.quit \ No newline at end of file --- 43,45 ---- import Graphics.UI.GIO.Layout import Graphics.UI.GIO.Controls ! import Graphics.UI.GIO.Process \ No newline at end of file |
From: <kr_...@us...> - 2003-03-30 18:49:10
|
Update of /cvsroot/htoolkit/gio In directory sc8-pr-cvs1:/tmp/cvs-serv19641/gio Modified Files: makefile Log Message: The process related features are extracted into newly created module "Process". Added new process attribute "title" instead of title as parameter. Index: makefile =================================================================== RCS file: /cvsroot/htoolkit/gio/makefile,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** makefile 26 Mar 2003 10:38:32 -0000 1.7 --- makefile 30 Mar 2003 18:49:07 -0000 1.8 *************** *** 36,40 **** GIO/Window.hs GIO/Menu.hs \ GIO/CommonDialogs.hs GIO/Controls.hs \ ! GIO/Messages.hs \ GIO.hs \ --- 36,40 ---- GIO/Window.hs GIO/Menu.hs \ GIO/CommonDialogs.hs GIO/Controls.hs \ ! GIO/Messages.hs GIO/Process.hs \ GIO.hs \ |
From: <kr_...@us...> - 2003-03-30 18:42:45
|
Update of /cvsroot/htoolkit/port/src/cbits/GTK In directory sc8-pr-cvs1:/tmp/cvs-serv17706/port/src/cbits/GTK Modified Files: ColorDialog.c FontDialog.c Log Message: Add include for Internals.h Index: ColorDialog.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/ColorDialog.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ColorDialog.c 29 Mar 2003 08:12:18 -0000 1.2 --- ColorDialog.c 30 Mar 2003 18:42:41 -0000 1.3 *************** *** 1,3 **** --- 1,4 ---- #include "ColorDialog.h" + #include "Internals.h" BOOL osRunColorDialog(unsigned int *color) Index: FontDialog.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/FontDialog.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** FontDialog.c 29 Mar 2003 08:12:18 -0000 1.3 --- FontDialog.c 30 Mar 2003 18:42:41 -0000 1.4 *************** *** 1,3 **** --- 1,4 ---- #include "FontDialog.h" + #include "Internals.h" BOOL osRunFontDialog(char **fname, int *fsize, int *fweight, int *fstyle, BOOL *funderline, BOOL *fstrikeout) |
Update of /cvsroot/htoolkit/port/src/cbits/Win32 In directory sc8-pr-cvs1:/tmp/cvs-serv14355/port/src/cbits/Win32 Modified Files: ColorDialog.c FileDialog.c FontDialog.c Frame.c Message.c Timer.c Util.c Window.c Log Message: The internal implementation is rewritten. The new feature is that we have FrameWindow for both SDI and MDI. This simplify the implementation of the entire backend. Index: ColorDialog.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/ColorDialog.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ColorDialog.c 14 Mar 2003 18:38:43 -0000 1.1 --- ColorDialog.c 29 Mar 2003 08:12:18 -0000 1.2 *************** *** 1,3 **** --- 1,4 ---- #include "ColorDialog.h" + #include "Internals.h" static COLORREF std_colors[] = *************** *** 9,13 **** cc.lStructSize = sizeof(cc); ! cc.hwndOwner = GetActiveWindow(); cc.hInstance = NULL; cc.rgbResult = 0; --- 10,14 ---- cc.lStructSize = sizeof(cc); ! cc.hwndOwner = ghWndFrame; cc.hInstance = NULL; cc.rgbResult = 0; Index: FileDialog.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/FileDialog.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FileDialog.c 23 Jan 2003 20:19:32 -0000 1.2 --- FileDialog.c 29 Mar 2003 08:12:18 -0000 1.3 *************** *** 26,30 **** char title[17] = "Select Directory\0"; ! bi.hwndOwner = GetActiveWindow (); bi.pidlRoot = NULL; bi.pszDisplayName = buffer; --- 26,30 ---- char title[17] = "Select Directory\0"; ! bi.hwndOwner = ghWndFrame; bi.pidlRoot = NULL; bi.pszDisplayName = buffer; *************** *** 54,58 **** ofn.lStructSize = sizeof (OPENFILENAME); ! ofn.hwndOwner = GetActiveWindow (); ofn.hInstance = NULL; ofn.lpstrFilter = NULL; --- 54,58 ---- ofn.lStructSize = sizeof (OPENFILENAME); ! ofn.hwndOwner = ghWndFrame; ofn.hInstance = NULL; ofn.lpstrFilter = NULL; *************** *** 92,96 **** ofn.lStructSize = sizeof (OPENFILENAME); ! ofn.hwndOwner = GetActiveWindow (); ofn.lpstrFilter = NULL; ofn.lpstrCustomFilter = NULL; --- 92,96 ---- ofn.lStructSize = sizeof (OPENFILENAME); ! ofn.hwndOwner = ghWndFrame; ofn.lpstrFilter = NULL; ofn.lpstrCustomFilter = NULL; Index: FontDialog.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/FontDialog.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FontDialog.c 16 Mar 2003 23:48:14 -0000 1.1 --- FontDialog.c 29 Mar 2003 08:12:18 -0000 1.2 *************** *** 1,3 **** --- 1,4 ---- #include "FontDialog.h" + #include "Internals.h" BOOL osRunFontDialog(char **fname, int *fsize, int *fweight, int *fstyle, BOOL *funderline, BOOL *fstrikeout) *************** *** 7,11 **** cf.lStructSize = sizeof(cf); ! cf.hwndOwner = GetActiveWindow(); cf.hDC = NULL; cf.lpLogFont = &lf; --- 8,12 ---- cf.lStructSize = sizeof(cf); ! cf.hwndOwner = ghWndFrame; cf.hDC = NULL; cf.lpLogFont = &lf; Index: Frame.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Frame.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Frame.c 26 Mar 2003 08:45:54 -0000 1.2 --- Frame.c 29 Mar 2003 08:12:19 -0000 1.3 *************** *** 1,9 **** #include "Types.h" #include "Internals.h" #include "Handlers_stub.h" #define OSMenuIDEnd 500 ! LRESULT CALLBACK HMDIFrameFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { --- 1,13 ---- #include "Types.h" + #include "Window.h" #include "Internals.h" #include "Handlers_stub.h" #define OSMenuIDEnd 500 ! ! LRESULT CALLBACK HFrameSharedFunction(int DocumentInterface, HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { + FrameData *pData = (FrameData *) GetWindowLong(hWnd,GWL_USERDATA); + switch (uMsg) { *************** *** 11,14 **** --- 15,101 ---- handleProcessDismiss(); return 0; + case WM_DESTROY: + handleProcessDestroy(); + DeleteObject(pData->hControlFont); + free(pData->lpszAppName); + free(pData); + PostQuitMessage(0); + break; + case WM_CREATE: + { + int nLen; + LOGFONT lf; + HFONT hControlFont; + + // Globally, we create a logical font that is used in all controls. + lf.lfHeight = -8; + lf.lfWidth = 0; + lf.lfWeight = 400; + lf.lfItalic = FALSE; + lf.lfUnderline = FALSE; + lf.lfStrikeOut = FALSE; + lf.lfEscapement = 0; + lf.lfOrientation = 0; + lf.lfCharSet = DEFAULT_CHARSET; + lf.lfOutPrecision = OUT_DEFAULT_PRECIS; + lf.lfClipPrecision = CLIP_DEFAULT_PRECIS; + lf.lfQuality = DEFAULT_QUALITY; + lf.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; + strcpy(lf.lfFaceName, "MS Sans Serif"); + hControlFont = CreateFontIndirect (&lf); + + if (!hControlFont) + return -1; + + pData = (FrameData *) malloc(sizeof(FrameData)); + if (!pData) + { + DeleteObject(hControlFont); + return -1; + } + + pData->hClientWnd = NULL; + pData->DocumentInterface = DocumentInterface; + pData->hControlFont = hControlFont; + pData->lpszAppName = NULL; + + nLen = GetWindowTextLength(hWnd); + if (nLen > 0) + { + pData->lpszAppName = malloc(nLen+1); + if (!pData->lpszAppName) + { + free(pData); + DeleteObject(hControlFont); + return -1; + } + GetWindowText(hWnd,pData->lpszAppName,nLen); + } + + SetWindowLong(hWnd,GWL_USERDATA,(LONG) pData); + } + break; + case WM_SIZE: + { + int nWidth = LOWORD(lParam); + int nHeight = HIWORD(lParam); + SetWindowPos(pData->hClientWnd,NULL,0,0,nWidth,nHeight,SWP_NOZORDER); + } + break; + } + + if (DocumentInterface == 1) + return DefWindowProc (hWnd, uMsg, wParam, lParam); + else + return DefFrameProc (hWnd, pData->hClientWnd, uMsg, wParam, lParam); + }; + + LRESULT CALLBACK HMDIFrameFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) + { + LRESULT result = HFrameSharedFunction(2, hWnd, uMsg, wParam, lParam); + FrameData *pData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); + + switch (uMsg) + { case WM_CREATE: { *************** *** 33,37 **** clientcreate.idFirstChild = OSMenuIDEnd+5; // Window ids must be generated from OSMenuIDEnd+5 ! ghWndClient = CreateWindow ("MDICLIENT", // The MDICLIENT window class NULL, // The window name MDIS_ALLCHILDSTYLES | WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE, --- 120,124 ---- clientcreate.idFirstChild = OSMenuIDEnd+5; // Window ids must be generated from OSMenuIDEnd+5 ! pData->hClientWnd = CreateWindow ("MDICLIENT", // The MDICLIENT window class NULL, // The window name MDIS_ALLCHILDSTYLES | WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE, *************** *** 43,57 **** (LPVOID) &clientcreate // The CLIENTCREATESTRUCT ); ! if (!ghWndClient) return -1; - - gActiveObjects++; - } - break; - case WM_SIZE: - { - int nWidth = LOWORD(lParam); - int nHeight = HIWORD(lParam); - SetWindowPos(GetWindow(hWnd,GW_CHILD),NULL,0,0,nWidth,nHeight,SWP_NOZORDER); } break; --- 130,135 ---- (LPVOID) &clientcreate // The CLIENTCREATESTRUCT ); ! if (!pData->hClientWnd) return -1; } break; *************** *** 64,85 **** { case (OSMenuIDEnd+1): ! SendMessage (GetWindow(hWnd,GW_CHILD),WM_MDIICONARRANGE,0,0); break; case (OSMenuIDEnd+2): ! SendMessage (GetWindow(hWnd,GW_CHILD),WM_MDITILE,(WPARAM) MDITILE_VERTICAL,0); break; case (OSMenuIDEnd+3): ! SendMessage (GetWindow(hWnd,GW_CHILD),WM_MDITILE,(WPARAM) MDITILE_HORIZONTAL,0); break; case (OSMenuIDEnd+4): ! SendMessage (GetWindow(hWnd,GW_CHILD),WM_MDICASCADE,0,0); break; } break; - case WM_DESTROY: - gActiveObjects--; - break; } ! return DefFrameProc (hWnd, GetWindow(hWnd,GW_CHILD), uMsg, wParam, lParam); ! }; \ No newline at end of file --- 142,189 ---- { case (OSMenuIDEnd+1): ! SendMessage (pData->hClientWnd,WM_MDIICONARRANGE,0,0); break; case (OSMenuIDEnd+2): ! SendMessage (pData->hClientWnd,WM_MDITILE,(WPARAM) MDITILE_VERTICAL,0); break; case (OSMenuIDEnd+3): ! SendMessage (pData->hClientWnd,WM_MDITILE,(WPARAM) MDITILE_HORIZONTAL,0); break; case (OSMenuIDEnd+4): ! SendMessage (pData->hClientWnd,WM_MDICASCADE,0,0); break; } break; } ! return result; ! }; ! ! LRESULT CALLBACK HSDIFrameFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ! { ! LRESULT result = HFrameSharedFunction(1, hWnd, uMsg, wParam, lParam); ! FrameData *pFrameData = (FrameData *) GetWindowLong(hWnd,GWL_USERDATA); ! ! switch (uMsg) ! { ! case WM_ACTIVATE: ! if (pFrameData->hClientWnd) ! { ! if (wParam == WA_INACTIVE) ! { ! if (gInKey) ! handleWindowKeyboard(pFrameData->hClientWnd, evKeyLost, gCurChar, GetModifiers()); ! gInKey = FALSE; ! gCurChar = 0; ! handleWindowDeactivate(pFrameData->hClientWnd); ! } ! else ! { ! handleWindowActivate(pFrameData->hClientWnd); ! } ! } ! break; ! } ! ! return result; ! }; Index: Message.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Message.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Message.c 14 Mar 2003 17:14:56 -0000 1.2 --- Message.c 29 Mar 2003 08:12:19 -0000 1.3 *************** *** 4,33 **** void osMessageAlert(char *szText) { ! MessageBox(GetActiveWindow(), szText, gAppName, MB_OK | MB_ICONINFORMATION); }; BOOL osMessageConfirm(char *szText) { ! return (MessageBox(GetActiveWindow(), szText, gAppName, MB_OKCANCEL | MB_ICONINFORMATION) == IDOK); }; void osMessageWarning(char *szText) { ! MessageBox(GetActiveWindow(), szText, gAppName, MB_OK | MB_ICONWARNING); }; BOOL osMessageQuestion(char *szText) { ! return (MessageBox(GetActiveWindow(), szText, gAppName, MB_YESNO | MB_ICONQUESTION) == IDYES); }; BOOL osMessageError(char *szText) { ! return (MessageBox(GetActiveWindow(), szText, gAppName, MB_OKCANCEL | MB_ICONERROR) == IDOK); }; int osMessageCancelQuestion(char *szText) { ! switch (MessageBox(GetActiveWindow(), szText, gAppName, MB_YESNO | MB_ICONQUESTION)) { case IDNO: return 0; --- 4,39 ---- void osMessageAlert(char *szText) { ! FrameData *pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); ! MessageBox(ghWndFrame, szText, pFrameData->lpszAppName, MB_OK | MB_ICONINFORMATION); }; BOOL osMessageConfirm(char *szText) { ! FrameData *pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); ! return (MessageBox(ghWndFrame, szText, pFrameData->lpszAppName, MB_OKCANCEL | MB_ICONINFORMATION) == IDOK); }; void osMessageWarning(char *szText) { ! FrameData *pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); ! MessageBox(ghWndFrame, szText, pFrameData->lpszAppName, MB_OK | MB_ICONWARNING); }; BOOL osMessageQuestion(char *szText) { ! FrameData *pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); ! return (MessageBox(ghWndFrame, szText, pFrameData->lpszAppName, MB_YESNO | MB_ICONQUESTION) == IDYES); }; BOOL osMessageError(char *szText) { ! FrameData *pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); ! return (MessageBox(ghWndFrame, szText, pFrameData->lpszAppName, MB_OKCANCEL | MB_ICONERROR) == IDOK); }; int osMessageCancelQuestion(char *szText) { ! FrameData *pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); ! switch (MessageBox(ghWndFrame, szText, pFrameData->lpszAppName, MB_YESNO | MB_ICONQUESTION)) { case IDNO: return 0; *************** *** 39,43 **** int osMessageConfirmSave(char *szText) { ! switch (MessageBox(GetActiveWindow(), szText, gAppName, MB_YESNO | MB_ICONQUESTION)) { case IDNO: return 0; --- 45,50 ---- int osMessageConfirmSave(char *szText) { ! FrameData *pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); ! switch (MessageBox(ghWndFrame, szText, pFrameData->lpszAppName, MB_YESNO | MB_ICONQUESTION)) { case IDNO: return 0; Index: Timer.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Timer.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Timer.c 26 Mar 2003 02:19:57 -0000 1.3 --- Timer.c 29 Mar 2003 08:12:19 -0000 1.4 *************** *** 56,60 **** timer->enabled = TRUE; timer->id = (msecs > 0) ? SetTimer(ghTimerWnd, (WPARAM) timer, msecs, NULL) : 0; - gActiveObjects++; return timer; } --- 56,59 ---- *************** *** 67,71 **** KillTimer(ghTimerWnd,timer->id); rfree(timer); - gActiveObjects--; } } --- 66,69 ---- Index: Util.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Util.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Util.c 26 Mar 2003 15:39:48 -0000 1.9 --- Util.c 29 Mar 2003 08:12:19 -0000 1.10 *************** *** 4,7 **** --- 4,8 ---- #include "Types.h" #include "Window.h" + #include "Internals.h" #include "Handlers_stub.h" *************** *** 9,18 **** HMODULE ghModule = NULL; ! HFONT ghControlFont = NULL; ! HWND ghWndFrame; ! HWND ghWndClient; ! int gActiveObjects; ! int gDocumentInterface; ! char *gAppName; void *rmalloc (DWORD bytes) --- 10,14 ---- HMODULE ghModule = NULL; ! HWND ghWndFrame = NULL; void *rmalloc (DWORD bytes) *************** *** 34,41 **** } ! extern LRESULT CALLBACK HWindowFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); ! extern LRESULT CALLBACK HDialogFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); extern LRESULT CALLBACK HMDIFrameFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); extern LRESULT CALLBACK HMDIWindowFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); static ATOM classDialog = 0; --- 30,38 ---- } ! extern LRESULT CALLBACK HSDIFrameFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); ! extern LRESULT CALLBACK HSDIWindowFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); extern LRESULT CALLBACK HMDIFrameFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); extern LRESULT CALLBACK HMDIWindowFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); + extern LRESULT CALLBACK HDialogFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); static ATOM classDialog = 0; *************** *** 53,71 **** */ ! void osInit(char *AppName, int DocumentInterface) { if (!ghModule) { WNDCLASS wc; - LOGFONT lf; INITCOMMONCONTROLSEX icc; ghModule = GetModuleHandle(NULL); ! /* DAAN: create two different classes for dialogs and windows so ! that we can call the appropiate default window message handler ! for each window kind */ wc.style = CS_DBLCLKS; ! wc.lpfnWndProc = HWindowFunction; wc.cbClsExtra = 0; wc.cbWndExtra = 0; --- 50,77 ---- */ ! void osInit(char *szAppName, int DocumentInterface) { if (!ghModule) { WNDCLASS wc; INITCOMMONCONTROLSEX icc; ghModule = GetModuleHandle(NULL); ! // Window class for SDIFrame ! wc.style = CS_DBLCLKS; ! wc.lpfnWndProc = HSDIFrameFunction; ! wc.cbClsExtra = 0; ! wc.cbWndExtra = 0; ! wc.hInstance = ghModule; ! wc.hIcon = LoadIcon (NULL, IDI_APPLICATION); ! wc.hCursor = LoadCursor (NULL, IDC_ARROW); ! wc.hbrBackground = (HBRUSH) (COLOR_APPWORKSPACE+1); // For best results (Petzold) ! wc.lpszMenuName = NULL; ! wc.lpszClassName = "HSDIFRAME"; ! RegisterClass(&wc); ! wc.style = CS_DBLCLKS; ! wc.lpfnWndProc = HSDIWindowFunction; wc.cbClsExtra = 0; wc.cbWndExtra = 0; *************** *** 75,81 **** wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1); wc.lpszMenuName = NULL; ! wc.lpszClassName = "HWINDOW"; classWindow = RegisterClass(&wc); wc.style = CS_DBLCLKS; wc.lpfnWndProc = HDialogFunction; --- 81,88 ---- wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1); wc.lpszMenuName = NULL; ! wc.lpszClassName = "HSDIWINDOW"; classWindow = RegisterClass(&wc); + // Window class for Dialogs wc.style = CS_DBLCLKS; wc.lpfnWndProc = HDialogFunction; *************** *** 100,104 **** wc.hbrBackground = (HBRUSH) (COLOR_APPWORKSPACE+1); // For best results (Petzold) wc.lpszMenuName = NULL; ! wc.lpszClassName = "HFRAME"; RegisterClass(&wc); --- 107,111 ---- wc.hbrBackground = (HBRUSH) (COLOR_APPWORKSPACE+1); // For best results (Petzold) wc.lpszMenuName = NULL; ! wc.lpszClassName = "HMDIFRAME"; RegisterClass(&wc); *************** *** 116,149 **** RegisterClass(&wc); - // Globally, we create a logical font that is used in all controls. - lf.lfHeight = -8; - lf.lfWidth = 0; - lf.lfWeight = 400; - lf.lfItalic = FALSE; - lf.lfUnderline = FALSE; - lf.lfStrikeOut = FALSE; - lf.lfEscapement = 0; - lf.lfOrientation = 0; - lf.lfCharSet = DEFAULT_CHARSET; - lf.lfOutPrecision = OUT_DEFAULT_PRECIS; - lf.lfClipPrecision = CLIP_DEFAULT_PRECIS; - lf.lfQuality = DEFAULT_QUALITY; - lf.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; - strcpy(lf.lfFaceName, "MS Sans Serif"); - ghControlFont = CreateFontIndirect (&lf); - icc.dwSize = sizeof(icc); icc.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&icc); ! gActiveObjects = 0; ! gAppName = strdup(AppName); ! gDocumentInterface = DocumentInterface; ! ! if (gDocumentInterface == 2) { ! ghWndClient = NULL; ! ghWndFrame = CreateWindow ( "HFRAME", ! AppName, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT,CW_USEDEFAULT, --- 123,147 ---- RegisterClass(&wc); icc.dwSize = sizeof(icc); icc.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&icc); ! if (DocumentInterface == 1) { ! ghWndFrame = CreateWindow ( "HSDIFRAME", ! szAppName, ! WS_OVERLAPPEDWINDOW, ! CW_USEDEFAULT,CW_USEDEFAULT, ! CW_USEDEFAULT,CW_USEDEFAULT, ! NULL, ! NULL, ! (HANDLE) ghModule, ! NULL ! ); ! } ! else ! { ! ghWndFrame = CreateWindow ( "HMDIFRAME", ! szAppName, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT,CW_USEDEFAULT, *************** *** 154,160 **** NULL ); - ShowWindow(ghWndFrame,SW_MAXIMIZE); - UpdateWindow(ghWndFrame); } } }; --- 152,159 ---- NULL ); } + + ShowWindow(ghWndFrame,SW_NORMAL); + UpdateWindow(ghWndFrame); } }; *************** *** 163,166 **** --- 162,166 ---- { HWND hParent; + FrameData *pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); if (!hWnd) *************** *** 170,177 **** } ! SendMessage(hWnd, WM_SETFONT, (WPARAM)ghControlFont, MAKELPARAM (TRUE,0)); hParent = GetParent(hWnd); - if (hParent && !osGetWindowEnabled(hParent)) EnableWindow(hWnd, FALSE); --- 170,176 ---- } ! SendMessage(hWnd, WM_SETFONT, (WPARAM)pFrameData->hControlFont, MAKELPARAM (TRUE,0)); hParent = GetParent(hWnd); if (hParent && !osGetWindowEnabled(hParent)) EnableWindow(hWnd, FALSE); *************** *** 186,217 **** MSG msg; ! while (gActiveObjects > 0) { ! handleMenusUpdate(); ! ! while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) != 0) ! { ! TranslateMessage(&msg); ! DispatchMessage(&msg); ! ! if (gActiveObjects <= 0) ! return; ! }; ! ! if (gActiveObjects <= 0) ! return; ! ! if (GetMessage(&msg, NULL, 0, 0) != 0) ! { ! TranslateMessage(&msg); ! DispatchMessage(&msg); ! } } - handleProcessDestroy(); - doneGdiPlus(); - - free(gAppName); }; --- 185,195 ---- MSG msg; ! while (GetMessage(&msg, NULL, 0, 0) != 0) { ! TranslateMessage(&msg); ! DispatchMessage(&msg); } doneGdiPlus(); }; *************** *** 220,231 **** void osQuit() { ! if (gDocumentInterface == 2) ! { ! DestroyWindow(ghWndFrame); ! } ! ! if (gActiveObjects > 0) ! { ! printf("WARNING: There are still have active objects\n"); ! } } --- 198,201 ---- void osQuit() { ! DestroyWindow(ghWndFrame); } Index: Window.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Window.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Window.c 27 Mar 2003 14:05:03 -0000 1.16 --- Window.c 29 Mar 2003 08:12:19 -0000 1.17 *************** *** 28,32 **** } WindowData; ! static unsigned int GetModifiers() { return (( GetAsyncKeyState (VK_SHIFT) ? shiftBIT : 0) | --- 28,32 ---- } WindowData; ! unsigned int GetModifiers() { return (( GetAsyncKeyState (VK_SHIFT) ? shiftBIT : 0) | *************** *** 78,83 **** } ! static BOOL gInKey = FALSE; ! static BOOL gCurChar = 0; int CheckVirtualKeyCode (int keycode) --- 78,83 ---- } ! BOOL gInKey = FALSE; ! BOOL gCurChar = 0; int CheckVirtualKeyCode (int keycode) *************** *** 182,187 **** pData->hTooltip = NULL; SetWindowLong(hWnd,GWL_USERDATA,(LONG) pData); - - gActiveObjects++; } break; --- 182,185 ---- *************** *** 190,193 **** --- 188,192 ---- return 0; case WM_DESTROY: + handleWindowDestroy(hWnd); if (pData->hBackBrush) { *************** *** 196,201 **** } ! handleWindowDestroy(hWnd); ! gActiveObjects--; break; case WM_COMMAND: --- 195,199 ---- } ! free(pData); break; case WM_COMMAND: *************** *** 708,732 **** ! LRESULT CALLBACK HWindowFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_LBUTTONDOWN: SetActiveWindow(hWnd); break; ! case WM_ACTIVATE: ! if (wParam == WA_INACTIVE) ! { ! if (gInKey) ! handleWindowKeyboard(hWnd, evKeyLost, gCurChar, GetModifiers()); ! gInKey = FALSE; ! gCurChar = 0; ! handleWindowDeactivate(hWnd); ! } ! else ! { ! handleWindowActivate(hWnd); ! } ! break; } --- 706,752 ---- ! LRESULT CALLBACK HSDIWindowFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { + FrameData *pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); + switch (uMsg) { + case WM_SETTEXT: + { + char *s = (char *) lParam; + + printf("WM_SETTEXT %p %d\n", s, *s); + + if (pFrameData->lpszAppName) + { + if (s && *s) + { + char *title; + int nTextLen; + + s = (char *) lParam; + nTextLen = strlen(s); + title = rmalloc(strlen(pFrameData->lpszAppName)+nTextLen+6); + + strcpy(title, pFrameData->lpszAppName); + strcat(title, " - ["); + strcat(title, s); + strcat(title, "]"); + SetWindowText(ghWndFrame, title); + } + else + SetWindowText(ghWndFrame, pFrameData->lpszAppName); + } + else + SetWindowText(ghWndFrame, s); + } + break; case WM_LBUTTONDOWN: SetActiveWindow(hWnd); break; ! case WM_DESTROY: ! pFrameData->hClientWnd = NULL; ! SetWindowText(ghWndFrame, pFrameData->lpszAppName); ! break; } *************** *** 748,751 **** --- 768,773 ---- LRESULT CALLBACK HMDIWindowFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { + FrameData *pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); + switch (uMsg) { *************** *** 757,763 **** s = (char *) lParam; nTextLen = strlen(s); ! title = rmalloc(strlen(gAppName)+nTextLen+6); ! strcpy(title, gAppName); strcat(title, " - ["); strcat(title, s); --- 779,785 ---- s = (char *) lParam; nTextLen = strlen(s); ! title = rmalloc(strlen(pFrameData->lpszAppName)+nTextLen+6); ! strcpy(title, pFrameData->lpszAppName); strcat(title, " - ["); strcat(title, s); *************** *** 772,778 **** nTextLen = GetWindowTextLength(hWnd); ! title = rmalloc(strlen(gAppName)+nTextLen+6); ! strcpy(title, gAppName); strcat(title, " - ["); GetWindowText(hWnd, title+strlen(title), nTextLen+1); --- 794,800 ---- nTextLen = GetWindowTextLength(hWnd); ! title = rmalloc(strlen(pFrameData->lpszAppName)+nTextLen+6); ! strcpy(title, pFrameData->lpszAppName); strcat(title, " - ["); GetWindowText(hWnd, title+strlen(title), nTextLen+1); *************** *** 788,797 **** break; case WM_DESTROY: ! SetWindowText(ghWndFrame, gAppName); ! SendMessage(ghWndClient, WM_MDIREFRESHMENU, 0, 0); DrawMenuBar(ghWndFrame); break; case WM_LBUTTONDOWN: ! SendMessage(ghWndClient,WM_MDIACTIVATE,(WPARAM) hWnd,0); break; }; --- 810,819 ---- break; case WM_DESTROY: ! SetWindowText(ghWndFrame, pFrameData->lpszAppName); ! SendMessage(pFrameData->hClientWnd, WM_MDIREFRESHMENU, 0, 0); DrawMenuBar(ghWndFrame); break; case WM_LBUTTONDOWN: ! SendMessage(pFrameData->hClientWnd,WM_MDIACTIVATE,(WPARAM) hWnd,0); break; }; *************** *** 818,835 **** { HWND hWnd; ! switch (gDocumentInterface) { case 1: // SDI hWnd = CreateWindow( ! "HWINDOW", ! gAppName, ! WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL, ! CW_USEDEFAULT,0,0,0, NULL, NULL, ghModule, NULL ); break; case 2: // MDI --- 840,861 ---- { HWND hWnd; + RECT rect; + FrameData *pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); ! switch (pFrameData->DocumentInterface) { case 1: // SDI + GetClientRect(ghWndFrame, &rect); hWnd = CreateWindow( ! "HSDIWINDOW", NULL, + WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL, + 0,0,rect.right-rect.left,rect.bottom-rect.top, + ghWndFrame, NULL, ghModule, NULL ); + pFrameData->hClientWnd = hWnd; break; case 2: // MDI *************** *** 839,843 **** /* fill the MDICREATESTRUCT record */ mdicreate.szClass = "HMDIWINDOW"; ! mdicreate.szTitle = gAppName; mdicreate.hOwner = ghModule; mdicreate.x = 0; --- 865,869 ---- /* fill the MDICREATESTRUCT record */ mdicreate.szClass = "HMDIWINDOW"; ! mdicreate.szTitle = NULL; mdicreate.hOwner = ghModule; mdicreate.x = 0; *************** *** 849,853 **** /* create the window */ ! hWnd = (HWND) SendMessage (ghWndClient,WM_MDICREATE,0,(LPARAM) &mdicreate); } break; --- 875,879 ---- /* create the window */ ! hWnd = (HWND) SendMessage (pFrameData->hClientWnd,WM_MDICREATE,0,(LPARAM) &mdicreate); } break; *************** *** 933,942 **** void osSetWindowViewSize(WindowHandle window, int w, int h) { RECT crect, wrect; ! GetClientRect(window,&crect); ! GetWindowRect(window,&wrect); ! SetWindowPos(window,NULL,wrect.left,wrect.top, (wrect.right-wrect.left) + (w - (crect.right-crect.left)), (wrect.bottom-wrect.top) + (h - (crect.bottom - crect.top)), --- 959,972 ---- void osSetWindowViewSize(WindowHandle window, int w, int h) { + HWND hTargetWnd; RECT crect, wrect; + FrameData *pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); ! hTargetWnd = (pFrameData->DocumentInterface == 1) ? ghWndFrame : window; ! GetClientRect(hTargetWnd,&crect); ! GetWindowRect(hTargetWnd,&wrect); ! ! SetWindowPos(hTargetWnd,NULL,wrect.left,wrect.top, (wrect.right-wrect.left) + (w - (crect.right-crect.left)), (wrect.bottom-wrect.top) + (h - (crect.bottom - crect.top)), *************** *** 1330,1336 **** } ! void osSetWindowRect(WindowHandle ctrl, int x0, int y0, int x1, int y1) { ! SetWindowPos(ctrl,HWND_TOP,x0,y0,abs(x1-x0),abs(y1-y0),SWP_SHOWWINDOW); } --- 1360,1367 ---- } ! void osSetWindowRect(WindowHandle window, int x0, int y0, int x1, int y1) { ! FrameData *pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA); ! SetWindowPos((pFrameData->DocumentInterface == 1) ? ghWndFrame : window,NULL,x0,y0,abs(x1-x0),abs(y1-y0),SWP_NOZORDER); } |
From: <kr_...@us...> - 2003-03-29 08:12:25
|
Update of /cvsroot/htoolkit/port/src/include In directory sc8-pr-cvs1:/tmp/cvs-serv14355/port/src/include Modified Files: Internals.h Log Message: The internal implementation is rewritten. The new feature is that we have FrameWindow for both SDI and MDI. This simplify the implementation of the entire backend. Index: Internals.h =================================================================== RCS file: /cvsroot/htoolkit/port/src/include/Internals.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Internals.h 3 Mar 2003 21:09:21 -0000 1.6 --- Internals.h 29 Mar 2003 08:12:19 -0000 1.7 *************** *** 4,10 **** #include <config.h> ! extern int gActiveObjects; ! extern int gDocumentInterface; ! extern char *gAppName; #ifdef WIN32_TARGET --- 4,9 ---- #include <config.h> ! extern BOOL gInKey; ! extern int gCurChar; #ifdef WIN32_TARGET *************** *** 15,21 **** extern HMODULE ghModule; - extern HFONT ghControlFont; extern HWND ghWndFrame; ! extern HWND ghWndClient; extern WindowHandle checkWindow(HWND hWnd, char *className); --- 14,20 ---- extern HMODULE ghModule; extern HWND ghWndFrame; ! ! extern unsigned int GetModifiers(); extern WindowHandle checkWindow(HWND hWnd, char *className); *************** *** 23,37 **** extern void SetupLogBrush(LOGBRUSH *plb, BOOL bSetSolid, int hatchStyle, BitmapHandle patBmp); #else ! extern GtkWidget *gMDIFrameWidget; ! extern GtkWidget *gMDINotebookWidget; ! extern GtkWidget *gActiveTopLevelWindow; - extern GtkBin *GetSW(GtkWidget *window); extern gchar *fromMnemonicString(const gchar *source); extern gchar *toMnemonicString(const gchar *source); void createMDIFrame(); #endif --- 22,45 ---- extern void SetupLogBrush(LOGBRUSH *plb, BOOL bSetSolid, int hatchStyle, BitmapHandle patBmp); + typedef struct + { + HWND hClientWnd; + int DocumentInterface; + HFONT hControlFont; + LPSTR lpszAppName; + } FrameData; + #else ! extern int gDocumentInterface; ! extern char *gAppName; ! extern GtkWidget *gFrameWidget; ! extern GtkWidget *gClientWidget; extern gchar *fromMnemonicString(const gchar *source); extern gchar *toMnemonicString(const gchar *source); void createMDIFrame(); + void createSDIFrame(); #endif |
From: <kr_...@us...> - 2003-03-27 14:05:07
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32 In directory sc8-pr-cvs1:/tmp/cvs-serv28930/port/src/cbits/Win32 Modified Files: Window.c Log Message: bugfixes Index: Window.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Window.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Window.c 27 Mar 2003 13:36:23 -0000 1.15 --- Window.c 27 Mar 2003 14:05:03 -0000 1.16 *************** *** 854,858 **** } ! return checkWindow(hWnd, "HWINDOW"); }; --- 854,858 ---- } ! return hWnd; }; *************** *** 887,891 **** hDlg = CreateDialogIndirectParam (ghModule, (LPCDLGTEMPLATE) dlgtemplate, parent, (DLGPROC) NULL, (LPARAM) 0); ! return checkWindow(hDlg, "HDIALOG"); }; --- 887,891 ---- hDlg = CreateDialogIndirectParam (ghModule, (LPCDLGTEMPLATE) dlgtemplate, parent, (DLGPROC) NULL, (LPARAM) 0); ! return hDlg; }; *************** *** 1222,1226 **** BOOL osGetControlEnabled(WindowHandle ctrl) { ! return IsWindowEnabled(ctrl); } --- 1222,1237 ---- BOOL osGetControlEnabled(WindowHandle ctrl) { ! int i; ! WindowData *pData = (WindowData *) GetWindowLong(GetParent(ctrl),GWL_USERDATA); ! ! if (pData->enabled) ! return IsWindowEnabled(ctrl); ! else ! { ! pData->disabledCtrls[pData->disabledCtrlsCount] = ctrl; ! for (i = 0; pData->disabledCtrls[i] != ctrl; i++); ! ! return (i >= pData->disabledCtrlsCount); ! } } |
From: <kr_...@us...> - 2003-03-27 13:36:55
|
Update of /cvsroot/htoolkit/port/src/Port In directory sc8-pr-cvs1:/tmp/cvs-serv10752/port/src/Port Modified Files: Controls.hs Log Message: Added implementation for ProgressBar and Slider controls Index: Controls.hs =================================================================== RCS file: /cvsroot/htoolkit/port/src/Port/Controls.hs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Controls.hs 26 Mar 2003 22:09:53 -0000 1.12 --- Controls.hs 27 Mar 2003 13:36:21 -0000 1.13 *************** *** 24,27 **** --- 24,31 ---- * Radio item + + * Slider + + * ProgressBar -} ----------------------------------------------------------------------------------------- *************** *** 66,73 **** , getListBoxSingleSelection, setListBoxSingleSelection , getListBoxItemSelectState, setListBoxItemSelectState ) where import Foreign.C - import Foreign.Ptr import Graphics.UI.Port.Types import Graphics.UI.Port.Handlers -- just for haddock --- 70,84 ---- , getListBoxSingleSelection, setListBoxSingleSelection , getListBoxItemSelectState, setListBoxItemSelectState + -- * Slider + , createHorzSlider, createVertSlider, getSliderRequestSize + , getSliderRange, setSliderRange + , getSliderPosition, setSliderPosition + -- * ProgressBar + , createHorzProgressBar, createVertProgressBar, getProgressBarRequestSize + , setProgressBarFraction, getProgressBarFraction ) where + import Foreign import Foreign.C import Graphics.UI.Port.Types import Graphics.UI.Port.Handlers -- just for haddock *************** *** 112,128 **** -- | The minimal size that the label needs. getLabelRequestSize :: WindowHandle -> IO Size ! getLabelRequestSize hwnd ! = withCSizeResult $ \psize -> ! osGetLabelReqSize hwnd psize foreign import ccall osGetLabelReqSize :: WindowHandle -> Ptr CInt -> IO () getLabelText :: WindowHandle -> IO String ! getLabelText hwnd ! = resultCString (osGetLabelText hwnd) foreign import ccall osGetLabelText :: WindowHandle -> IO CString setLabelText :: WindowHandle -> String -> IO () ! setLabelText hwnd txt ! = withCString txt $ \ctxt -> osSetLabelText hwnd ctxt foreign import ccall osSetLabelText :: WindowHandle -> CString -> IO () --- 123,135 ---- -- | The minimal size that the label needs. getLabelRequestSize :: WindowHandle -> IO Size ! getLabelRequestSize hwnd = withCSizeResult (osGetLabelReqSize hwnd) foreign import ccall osGetLabelReqSize :: WindowHandle -> Ptr CInt -> IO () getLabelText :: WindowHandle -> IO String ! getLabelText hwnd = resultCString (osGetLabelText hwnd) foreign import ccall osGetLabelText :: WindowHandle -> IO CString setLabelText :: WindowHandle -> String -> IO () ! setLabelText hwnd txt = withCString txt (osSetLabelText hwnd) foreign import ccall osSetLabelText :: WindowHandle -> CString -> IO () *************** *** 140,156 **** -- | The minimal size that the button needs. getButtonRequestSize :: WindowHandle -> IO Size ! getButtonRequestSize hwnd ! = withCSizeResult $ \psize -> ! osGetButtonReqSize hwnd psize foreign import ccall osGetButtonReqSize :: WindowHandle -> Ptr CInt -> IO () getButtonText :: WindowHandle -> IO String ! getButtonText hwnd ! = resultCString (osGetButtonText hwnd) foreign import ccall osGetButtonText :: WindowHandle -> IO CString setButtonText :: WindowHandle -> String -> IO () ! setButtonText hwnd txt ! = withCString txt $ \ctxt -> osSetButtonText hwnd ctxt foreign import ccall osSetButtonText :: WindowHandle -> CString -> IO () --- 147,159 ---- -- | The minimal size that the button needs. getButtonRequestSize :: WindowHandle -> IO Size ! getButtonRequestSize hwnd = withCSizeResult (osGetButtonReqSize hwnd) foreign import ccall osGetButtonReqSize :: WindowHandle -> Ptr CInt -> IO () getButtonText :: WindowHandle -> IO String ! getButtonText hwnd = resultCString (osGetButtonText hwnd) foreign import ccall osGetButtonText :: WindowHandle -> IO CString setButtonText :: WindowHandle -> String -> IO () ! setButtonText hwnd txt = withCString txt (osSetButtonText hwnd) foreign import ccall osSetButtonText :: WindowHandle -> CString -> IO () *************** *** 166,176 **** -- installed with 'registerCheckBoxClick'. createCheckBox :: WindowHandle -> String -> IO WindowHandle ! createCheckBox hwnd label ! = withCString label $ \clabel -> osCreateCheckBox hwnd clabel foreign import ccall osCreateCheckBox :: WindowHandle -> CString -> IO WindowHandle getCheckBoxRequestSize :: WindowHandle -> IO Size ! getCheckBoxRequestSize hwnd ! = withCSizeResult $ \psize -> osGetCheckBoxReqSize hwnd psize foreign import ccall osGetCheckBoxReqSize :: WindowHandle -> Ptr CInt -> IO () --- 169,177 ---- -- installed with 'registerCheckBoxClick'. createCheckBox :: WindowHandle -> String -> IO WindowHandle ! createCheckBox hwnd label = withCString label (osCreateCheckBox hwnd) foreign import ccall osCreateCheckBox :: WindowHandle -> CString -> IO WindowHandle getCheckBoxRequestSize :: WindowHandle -> IO Size ! getCheckBoxRequestSize hwnd = withCSizeResult (osGetCheckBoxReqSize hwnd) foreign import ccall osGetCheckBoxReqSize :: WindowHandle -> Ptr CInt -> IO () *************** *** 193,198 **** getEditRequestSize :: WindowHandle -> IO Size ! getEditRequestSize hwnd ! = withCSizeResult $ \psize -> osGetEditReqSize hwnd psize foreign import ccall osGetEditReqSize :: WindowHandle -> Ptr CInt -> IO () --- 194,198 ---- getEditRequestSize :: WindowHandle -> IO Size ! getEditRequestSize hwnd = withCSizeResult (osGetEditReqSize hwnd) foreign import ccall osGetEditReqSize :: WindowHandle -> Ptr CInt -> IO () *************** *** 225,236 **** -- installed with 'registerRadioBoxClick'. createRadioBox :: WindowHandle -> Bool -> String -> IO WindowHandle ! createRadioBox hwnd selected label ! = withCString label $ \clabel -> ! osCreateRadioBox hwnd (toCBool selected) clabel ! foreign import ccall osCreateRadioBox :: WindowHandle -> CBool -> CString -> IO WindowHandle getRadioBoxRequestSize :: WindowHandle -> IO Size ! getRadioBoxRequestSize hwnd ! = withCSizeResult $ \psize -> osGetRadioBoxReqSize hwnd psize foreign import ccall osGetRadioBoxReqSize :: WindowHandle -> Ptr CInt -> IO () --- 225,233 ---- -- installed with 'registerRadioBoxClick'. createRadioBox :: WindowHandle -> Bool -> String -> IO WindowHandle ! createRadioBox hwnd selected label = withCString label (osCreateRadioBox hwnd selected) ! foreign import ccall osCreateRadioBox :: WindowHandle -> Bool -> CString -> IO WindowHandle getRadioBoxRequestSize :: WindowHandle -> IO Size ! getRadioBoxRequestSize hwnd = withCSizeResult (osGetRadioBoxReqSize hwnd) foreign import ccall osGetRadioBoxReqSize :: WindowHandle -> Ptr CInt -> IO () *************** *** 253,260 **** -- An event handler for list box clicks can be -- installed with 'registerListBoxClick'. ! createListBox :: WindowHandle -> Bool -> IO WindowHandle ! createListBox hwnd multi ! = osCreateListBox hwnd (toCBool multi) ! foreign import ccall osCreateListBox :: WindowHandle -> CBool -> IO WindowHandle appendListBoxItem :: WindowHandle -> String -> IO () --- 250,254 ---- -- An event handler for list box clicks can be -- installed with 'registerListBoxClick'. ! foreign import ccall "osCreateListBox" createListBox :: WindowHandle -> Bool -> IO WindowHandle appendListBoxItem :: WindowHandle -> String -> IO () *************** *** 277,282 **** getListBoxRequestSize :: WindowHandle -> IO Size ! getListBoxRequestSize hwnd ! = withCSizeResult $ \psize -> osGetListBoxReqSize hwnd psize foreign import ccall osGetListBoxReqSize :: WindowHandle -> Ptr CInt -> IO () --- 271,275 ---- getListBoxRequestSize :: WindowHandle -> IO Size ! getListBoxRequestSize hwnd = withCSizeResult (osGetListBoxReqSize hwnd) foreign import ccall osGetListBoxReqSize :: WindowHandle -> Ptr CInt -> IO () *************** *** 309,316 **** -- An event handler for pop up clicks can be -- installed with 'registerPopUpClick'. ! createPopUp :: WindowHandle -> IO WindowHandle ! createPopUp hwnd ! = osCreatePopUp hwnd ! foreign import ccall osCreatePopUp :: WindowHandle -> IO WindowHandle appendPopUpItem :: WindowHandle -> String -> IO () --- 302,306 ---- -- An event handler for pop up clicks can be -- installed with 'registerPopUpClick'. ! foreign import ccall "osCreatePopUp" createPopUp :: WindowHandle -> IO WindowHandle appendPopUpItem :: WindowHandle -> String -> IO () *************** *** 333,338 **** getPopUpRequestSize :: WindowHandle -> IO Size ! getPopUpRequestSize hwnd ! = withCSizeResult $ \psize -> osGetPopUpReqSize hwnd psize foreign import ccall osGetPopUpReqSize :: WindowHandle -> Ptr CInt -> IO () --- 323,327 ---- getPopUpRequestSize :: WindowHandle -> IO Size ! getPopUpRequestSize hwnd = withCSizeResult (osGetPopUpReqSize hwnd) foreign import ccall osGetPopUpReqSize :: WindowHandle -> Ptr CInt -> IO () *************** *** 347,348 **** --- 336,400 ---- = osSetPopUpSelection hwnd (toCInt i) foreign import ccall osSetPopUpSelection :: WindowHandle -> CInt -> IO () + + ----------------------------------------------------------------------------------------- + -- Slider + ----------------------------------------------------------------------------------------- + + -- | Create a new horizontal slider control. + foreign import ccall "osCreateHorzSlider" createHorzSlider :: WindowHandle -> IO WindowHandle + + -- | Create a new vertical slider control. + foreign import ccall "osCreateVertSlider" createVertSlider :: WindowHandle -> IO WindowHandle + + getSliderRequestSize :: WindowHandle -> IO Size + getSliderRequestSize hwnd = withCSizeResult (osGetSliderReqSize hwnd) + foreign import ccall osGetSliderReqSize :: WindowHandle -> Ptr CInt -> IO () + + setSliderRange :: WindowHandle -> Int -> Int -> IO () + setSliderRange hwnd min max = osSetSliderRange hwnd (toCInt min) (toCInt max) + foreign import ccall osSetSliderRange :: WindowHandle -> CInt -> CInt -> IO () + + getSliderRange :: WindowHandle -> IO (Int, Int) + getSliderRange hwnd = do + ptr <- mallocArray 2 + pos <- osGetSliderRange hwnd ptr (ptr `advancePtr` 1) + min <- peekElemOff ptr 0 + max <- peekElemOff ptr 1 + return (fromCInt min, fromCInt max) + foreign import ccall osGetSliderRange :: WindowHandle -> Ptr CInt -> Ptr CInt -> IO () + + setSliderPosition :: WindowHandle -> Int -> IO () + setSliderPosition hwnd pos = osSetSliderPosition hwnd (toCInt pos) + foreign import ccall osSetSliderPosition :: WindowHandle -> CInt -> IO () + + getSliderPosition :: WindowHandle -> IO Int + getSliderPosition hwnd + = do pos <- osGetSliderPosition hwnd + return (fromCInt pos) + foreign import ccall osGetSliderPosition :: WindowHandle -> IO CInt + + ----------------------------------------------------------------------------------------- + -- ProgressBar + ----------------------------------------------------------------------------------------- + + -- | Create a new horizontal progress bar. + -- The boolean parameter specify whether the bar shows continuous or discrete values. + foreign import ccall "osCreateHorzProgressBar" createHorzProgressBar :: WindowHandle -> Bool -> IO WindowHandle + + -- | Create a new vertical progress bar. + -- The boolean parameter specify whether the bar shows continuous or discrete values. + foreign import ccall "osCreateVertProgressBar" createVertProgressBar :: WindowHandle -> Bool -> IO WindowHandle + + getProgressBarRequestSize :: WindowHandle -> IO Size + getProgressBarRequestSize hwnd = withCSizeResult (osGetProgressBarReqSize hwnd) + foreign import ccall osGetProgressBarReqSize :: WindowHandle -> Ptr CInt -> IO () + + setProgressBarFraction :: WindowHandle -> Int -> Int -> Int -> IO () + setProgressBarFraction hwnd min max pos = osSetProgressBarFraction hwnd (toCInt min) (toCInt max) (toCInt pos) + foreign import ccall osSetProgressBarFraction :: WindowHandle -> CInt -> CInt -> CInt -> IO () + + getProgressBarFraction :: WindowHandle -> Int -> Int -> IO Int + getProgressBarFraction hwnd min max = do + pos <- osGetProgressBarFraction hwnd (toCInt min) (toCInt max) + return (fromCInt pos) + foreign import ccall osGetProgressBarFraction :: WindowHandle -> CInt -> CInt -> IO CInt |
From: <kr_...@us...> - 2003-03-27 13:36:54
|
Update of /cvsroot/htoolkit/port In directory sc8-pr-cvs1:/tmp/cvs-serv10752/port Modified Files: makefile Log Message: Added implementation for ProgressBar and Slider controls Index: makefile =================================================================== RCS file: /cvsroot/htoolkit/port/makefile,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** makefile 16 Mar 2003 23:48:12 -0000 1.14 --- makefile 27 Mar 2003 13:36:21 -0000 1.15 *************** *** 49,53 **** CSRCS = Window.c Util.c Bitmap.c Button.c CheckBox.c EditBox.c \ FileDialog.c ColorDialog.c FontDialog.c PopUp.c Canvas.c Menu.c ListBox.c \ ! Label.c Font.c RadioBox.c Timer.c Frame.c Message.c # package description --- 49,53 ---- CSRCS = Window.c Util.c Bitmap.c Button.c CheckBox.c EditBox.c \ FileDialog.c ColorDialog.c FontDialog.c PopUp.c Canvas.c Menu.c ListBox.c \ ! Label.c Font.c RadioBox.c Timer.c Frame.c Message.c Slider.c ProgressBar.c # package description |
From: <kr_...@us...> - 2003-03-27 13:36:53
|
Update of /cvsroot/htoolkit/gio/src/Graphics/UI/GIO In directory sc8-pr-cvs1:/tmp/cvs-serv10752/gio/src/Graphics/UI/GIO Modified Files: Controls.hs Log Message: Added implementation for ProgressBar and Slider controls Index: Controls.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Controls.hs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Controls.hs 26 Mar 2003 22:10:04 -0000 1.8 --- Controls.hs 27 Mar 2003 13:36:20 -0000 1.9 *************** *** 17,20 **** --- 17,22 ---- , Entry, entry, readOnly, visible , Popup, popup + , Slider, hslider, vslider, sliderRange, sliderPos + , ProgressBar, hProgressBar, vProgressBar, progressRange, progressPos , CheckGroup, checkGroup, checkLayout , RadioGroup, radioGroup, radioLayout *************** *** 368,374 **** pack w = stdPack (cparent w) (Port.getCheckBoxRequestSize (chandle w)) (Port.moveResizeControl (chandle w)) ! {-------------------------------------------------------------------- ! Radio box ! --------------------------------------------------------------------} -- | A single radio control. data Radio = Radio{ rhandle :: !WindowHandle --- 370,376 ---- pack w = stdPack (cparent w) (Port.getCheckBoxRequestSize (chandle w)) (Port.moveResizeControl (chandle w)) ! -------------------------------------------------------------------- ! -- Radio box ! -------------------------------------------------------------------- -- | A single radio control. data Radio = Radio{ rhandle :: !WindowHandle *************** *** 422,424 **** uncheck r = set r [checked =: False] ! minus xs i = take i rs ++ drop (i+1) rs \ No newline at end of file --- 424,525 ---- uncheck r = set r [checked =: False] ! minus xs i = take i rs ++ drop (i+1) rs ! ! -------------------------------------------------------------------- ! -- Slider ! -------------------------------------------------------------------- ! ! -- | A slider control. ! data Slider = Slider{ shandle :: !WindowHandle ! , sparent :: !WindowHandle ! } ! ! -- | Create a horizontal slider control. ! hslider :: [Prop Slider] -> Window -> IO Slider ! hslider props w ! = do r <- do hwnd <- get w windowHandle ! shandle <- Port.createHorzSlider hwnd ! return (Slider shandle hwnd) ! set r props ! return r ! ! -- | Create a vertical slider control. ! vslider :: [Prop Slider] -> Window -> IO Slider ! vslider props w ! = do r <- do hwnd <- get w windowHandle ! shandle <- Port.createVertSlider hwnd ! return (Slider shandle hwnd) ! set r props ! return r ! ! sliderRange :: Attr Slider (Int,Int) ! sliderRange ! = newAttr (\w -> Port.getSliderRange (shandle w)) ! (\w (min,max) -> Port.setSliderRange (shandle w) min max) ! ! sliderPos :: Attr Slider Int ! sliderPos ! = newAttr (Port.getSliderPosition . shandle) ! (Port.setSliderPosition . shandle) ! ! instance Commanding Slider where ! command = newControlCommandEvent shandle ! ! instance Control Slider where ! pack w = stdPack (sparent w) (Port.getSliderRequestSize (shandle w)) (Port.moveResizeControl (shandle w)) ! ! ! -------------------------------------------------------------------- ! -- ProgressBar ! -------------------------------------------------------------------- ! ! -- | A progress bar. ! data ProgressBar = ProgressBar ! { pbhandle :: !WindowHandle ! , pbparent :: !WindowHandle ! , pbrange :: Var (Int,Int) ! } ! ! -- | Create a horizontal progress bar. ! -- The boolean parameter specify whether the bar shows continuous or discrete values. ! hProgressBar :: Bool -> [Prop ProgressBar] -> Window -> IO ProgressBar ! hProgressBar smooth props w ! = do r <- do hwnd <- get w windowHandle ! pbhandle <- Port.createHorzProgressBar hwnd smooth ! pbrange <- newVar (0,100) ! Port.setProgressBarFraction pbhandle 0 100 0 ! return (ProgressBar pbhandle hwnd pbrange) ! set r props ! return r ! ! -- | Create a vertical progress bar. ! -- The boolean parameter specify whether the bar shows continuous or discrete values. ! vProgressBar :: Bool -> [Prop ProgressBar] -> Window -> IO ProgressBar ! vProgressBar smooth props w ! = do r <- do hwnd <- get w windowHandle ! pbhandle <- Port.createVertProgressBar hwnd smooth ! pbrange <- newVar (0,100) ! Port.setProgressBarFraction pbhandle 0 100 0 ! return (ProgressBar pbhandle hwnd pbrange) ! set r props ! return r ! ! progressRange :: Attr ProgressBar (Int,Int) ! progressRange ! = newAttr (\w -> getVar (pbrange w)) ! (\w r@(min,max) -> do ! pos <- Port.getProgressBarFraction (pbhandle w) min max ! Port.setProgressBarFraction (pbhandle w) min max pos ! setVar (pbrange w) r) ! ! progressPos :: Attr ProgressBar Int ! progressPos ! = newAttr (\w -> do ! (min,max) <- getVar (pbrange w) ! Port.getProgressBarFraction (pbhandle w) min max) ! (\w pos -> do ! (min,max) <- getVar (pbrange w) ! Port.setProgressBarFraction (pbhandle w) min max pos) ! ! instance Control ProgressBar where ! pack w = stdPack (pbparent w) (Port.getProgressBarRequestSize (pbhandle w)) (Port.moveResizeControl (pbhandle w)) |
From: <kr_...@us...> - 2003-03-27 13:36:26
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32 In directory sc8-pr-cvs1:/tmp/cvs-serv10752/port/src/cbits/Win32 Modified Files: Window.c Added Files: ProgressBar.c Slider.c Log Message: Added implementation for ProgressBar and Slider controls --- NEW FILE: ProgressBar.c --- #include "ProgressBar.h" #include "Internals.h" #include "Handlers_stub.h" WindowHandle osCreateHorzProgressBar(WindowHandle form, BOOL bSmooth) { HWND hBar; hBar = CreateWindow( PROGRESS_CLASS, NULL, (bSmooth ? PBS_SMOOTH : 0) | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0,0,0,0, form, NULL, ghModule, NULL ); return checkWindow(hBar, PROGRESS_CLASS); }; WindowHandle osCreateVertProgressBar(WindowHandle form, BOOL bSmooth) { HWND hBar; hBar = CreateWindow( PROGRESS_CLASS, NULL, (bSmooth ? PBS_SMOOTH : 0) | PBS_VERTICAL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0,0,0,0, form, NULL, ghModule, NULL ); return checkWindow(hBar, PROGRESS_CLASS); }; void osGetProgressBarReqSize(WindowHandle bar, int *res) { LONG lStyle = GetWindowLong(bar,GWL_STYLE); if (lStyle & PBS_VERTICAL) { res[0] = GetSystemMetrics(SM_CXVSCROLL); res[1] = GetSystemMetrics(SM_CYVSCROLL)*2; } else { res[0] = GetSystemMetrics(SM_CXHSCROLL)*2; res[1] = GetSystemMetrics(SM_CYHSCROLL); } } void osSetProgressBarFraction(WindowHandle bar, int minPos, int maxPos, int pos) { SendMessage(bar, PBM_SETRANGE32, minPos, maxPos); SendMessage(bar, PBM_SETPOS, pos, 0); } int osGetProgressBarFraction(WindowHandle bar, int minPos, int maxPos) { return SendMessage(bar, PBM_GETPOS, 0, 0); } --- NEW FILE: Slider.c --- #include "Slider.h" #include "Internals.h" #include "Handlers_stub.h" WindowHandle osCreateHorzSlider(WindowHandle form) { HWND hSlider; hSlider = CreateWindow( TRACKBAR_CLASS, NULL, TBS_AUTOTICKS | TBS_HORZ | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0,0,0,0, form, NULL, ghModule, NULL ); return checkWindow(hSlider, TRACKBAR_CLASS); }; WindowHandle osCreateVertSlider(WindowHandle form) { HWND hSlider; hSlider = CreateWindow( TRACKBAR_CLASS, NULL, TBS_AUTOTICKS | TBS_VERT | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0,0,0,0, form, NULL, ghModule, NULL ); return checkWindow(hSlider, TRACKBAR_CLASS); }; void osGetSliderReqSize(WindowHandle slider, int *res) { RECT rect; LONG lStyle = GetWindowLong(slider,GWL_STYLE); SendMessage(slider, TBM_GETTHUMBRECT, 0, (LPARAM) &rect); res[0] = rect.right - rect.left + ((lStyle & TBS_HORZ) ? 32 : GetSystemMetrics(SM_CXVSCROLL)); res[1] = rect.bottom - rect.top + ((lStyle & TBS_VERT) ? 32 : GetSystemMetrics(SM_CYHSCROLL)); } void osSetSliderRange(WindowHandle slider, int minPos, int maxPos) { SendMessage(slider, TBM_SETRANGEMAX, FALSE, maxPos); SendMessage(slider, TBM_SETRANGEMIN, TRUE, minPos); } void osGetSliderRange(WindowHandle slider, int *minPos, int *maxPos) { *maxPos = SendMessage(slider, TBM_GETRANGEMAX, 0, 0); *minPos = SendMessage(slider, TBM_GETRANGEMIN, 0, 0); } int osGetSliderPosition(WindowHandle slider) { return SendMessage(slider, TBM_GETPOS, 0, 0); } void osSetSliderPosition(WindowHandle slider, int pos) { SendMessage(slider, TBM_SETPOS, TRUE, pos); } Index: Window.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Window.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Window.c 26 Mar 2003 22:21:58 -0000 1.14 --- Window.c 27 Mar 2003 13:36:23 -0000 1.15 *************** *** 290,293 **** --- 290,294 ---- break; case WM_VSCROLL: + if (lParam == 0) { RECT rect; *************** *** 346,352 **** } } ! break; case WM_HSCROLL: { RECT rect; --- 347,357 ---- } } ! else ! { ! handleControlCommand((WindowHandle) lParam); ! } break; case WM_HSCROLL: + if (lParam == 0) { RECT rect; *************** *** 405,408 **** --- 410,417 ---- } } + else + { + handleControlCommand((WindowHandle) lParam); + } break; case WM_MOUSEWHEEL: |
From: <kr_...@us...> - 2003-03-27 13:36:26
|
Update of /cvsroot/htoolkit/port/src/include In directory sc8-pr-cvs1:/tmp/cvs-serv10752/port/src/include Added Files: ProgressBar.h Slider.h Log Message: Added implementation for ProgressBar and Slider controls --- NEW FILE: ProgressBar.h --- #ifndef PROGRESSBAR_H #define PROGRESSBAR_H #include "Types.h" WindowHandle osCreateHorzProgressBar(WindowHandle form, BOOL bSmooth); WindowHandle osCreateVertProgressBar(WindowHandle form, BOOL bSmooth); void osGetProgressBarReqSize(WindowHandle bar, int *res); void osSetProgressBarFraction(WindowHandle bar, int minPos, int maxPos, int pos); int osGetProgressBarFraction(WindowHandle bar, int minPos, int maxPos); #endif --- NEW FILE: Slider.h --- #ifndef SLIDER_H #define SLIDER_H #include "Types.h" WindowHandle osCreateHorzSlider(WindowHandle form); WindowHandle osCreateVertSlider(WindowHandle form); void osGetSliderReqSize(WindowHandle button, int *res); void osSetSliderRange(WindowHandle slider, int minPos, int maxPos); void osGetSliderRange(WindowHandle slider, int *minPos, int *maxPos); int osGetSliderPosition(WindowHandle slider); void osSetSliderPosition(WindowHandle slider, int pos); #endif |
From: <kr_...@us...> - 2003-03-27 13:36:25
|
Update of /cvsroot/htoolkit/port/src/cbits/GTK In directory sc8-pr-cvs1:/tmp/cvs-serv10752/port/src/cbits/GTK Added Files: ProgressBar.c Slider.c Log Message: Added implementation for ProgressBar and Slider controls --- NEW FILE: ProgressBar.c --- #include "ProgressBar.h" #include "Internals.h" #include "Handlers_stub.h" WindowHandle osCreateHorzProgressBar(WindowHandle window, BOOL bSmooth) { GtkWidget *bar; bar = gtk_progress_bar_new(); gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR(bar), GTK_PROGRESS_LEFT_TO_RIGHT); gtk_progress_bar_set_bar_style(GTK_PROGRESS_BAR(bar), bSmooth ? GTK_PROGRESS_CONTINUOUS : GTK_PROGRESS_DISCRETE); gtk_fixed_put(GTK_FIXED(GTK_BIN(GetSW(window)->child)->child), bar, 0, 0); gtk_widget_show(bar); return bar; }; WindowHandle osCreateVertProgressBar(WindowHandle window, BOOL bSmooth) { GtkWidget *bar; bar = gtk_progress_bar_new(); gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR(bar), GTK_PROGRESS_BOTTOM_TO_TOP); gtk_progress_bar_set_bar_style(GTK_PROGRESS_BAR(bar), bSmooth ? GTK_PROGRESS_CONTINUOUS : GTK_PROGRESS_DISCRETE); gtk_fixed_put(GTK_FIXED(GTK_BIN(GetSW(window)->child)->child), bar, 0, 0); gtk_widget_show(bar); return bar; }; void osGetProgressBarReqSize(WindowHandle bar, int *res) { int w,h; GtkRequisition requisition; gtk_widget_get_size_request(bar, &w,&h); gtk_widget_set_size_request(bar, -1,-1); gtk_widget_size_request(bar, &requisition); gtk_widget_set_size_request(bar, w, h); res[0] = requisition.width; res[1] = requisition.height; } void osSetProgressBarFraction(WindowHandle bar, int minPos, int maxPos, int pos) { if (maxPos!=minPos) { gdouble fraction = ((gdouble) pos)/((gdouble) (maxPos-minPos)); gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(bar), fraction); } gtk_progress_bar_set_discrete_blocks(GTK_PROGRESS_BAR(bar), maxPos-minPos); } int osGetProgressBarFraction(WindowHandle bar, int minPos, int maxPos) { return floor(gtk_progress_bar_get_fraction(GTK_PROGRESS_BAR(bar))*(maxPos-minPos)+0.5);; } --- NEW FILE: Slider.c --- #include "Slider.h" #include "Internals.h" #include "Handlers_stub.h" static void slider_adjustment_value_changed_handler (GtkAdjustment *adjustment, gpointer user_data) { handleControlCommand((WindowHandle) user_data); }; WindowHandle osCreateHorzSlider(WindowHandle window) { GtkWidget *slider; slider = gtk_hscale_new_with_range(0, 100, 1); gtk_signal_connect (GTK_OBJECT (gtk_range_get_adjustment(GTK_RANGE(slider))), "value-changed", GTK_SIGNAL_FUNC(slider_adjustment_value_changed_handler), slider); gtk_fixed_put(GTK_FIXED(GTK_BIN(GetSW(window)->child)->child), slider, 0, 0); gtk_widget_show(slider); return slider; }; WindowHandle osCreateVertSlider(WindowHandle window) { GtkWidget *slider; slider = gtk_vscale_new_with_range(0, 100, 1); gtk_signal_connect (GTK_OBJECT (gtk_range_get_adjustment(GTK_RANGE(slider))), "value-changed", GTK_SIGNAL_FUNC(slider_adjustment_value_changed_handler), slider); gtk_fixed_put(GTK_FIXED(GTK_BIN(GetSW(window)->child)->child), slider, 0, 0); gtk_widget_show(slider); return slider; }; void osGetSliderReqSize(WindowHandle slider, int *res) { int w,h; GtkRequisition requisition; gtk_widget_get_size_request(slider, &w,&h); gtk_widget_set_size_request(slider, -1,-1); gtk_widget_size_request(slider, &requisition); gtk_widget_set_size_request(slider, w, h); res[0] = requisition.width; res[1] = requisition.height; } void osSetSliderRange(WindowHandle slider, int minPos, int maxPos) { GtkAdjustment *adjustment = gtk_range_get_adjustment(GTK_RANGE(slider)); adjustment->lower = minPos; adjustment->upper = maxPos; gtk_adjustment_changed(adjustment); } void osGetSliderRange(WindowHandle slider, int *minPos, int *maxPos) { GtkAdjustment *adjustment = gtk_range_get_adjustment(GTK_RANGE(slider)); *minPos = adjustment->lower; *minPos = adjustment->upper; } void osSetSliderPosition(WindowHandle slider, int pos) { GtkAdjustment *adjustment = gtk_range_get_adjustment(GTK_RANGE(slider)); gtk_adjustment_set_value(adjustment, pos); } int osGetSliderPosition(WindowHandle slider) { GtkAdjustment *adjustment = gtk_range_get_adjustment(GTK_RANGE(slider)); return gtk_adjustment_get_value(adjustment); } |
From: <kr_...@us...> - 2003-03-27 13:36:24
|
Update of /cvsroot/htoolkit/gio/src/examples/simple In directory sc8-pr-cvs1:/tmp/cvs-serv10752/gio/src/examples/simple Added Files: Progress.hs Log Message: Added implementation for ProgressBar and Slider controls --- NEW FILE: Progress.hs --- module Main where import Graphics.UI.GIO main = start "Progress" SDI [] demo maxSpeed = 200 :: Int maxProgress = 200 :: Int demo = do myfont <- createFont defaultFontDef{fontSize=50} w <- window [view =: sz 800 100, domain =: sz 800 80] tm <- timer [interval =: maxSpeed `div` 2] prg <- hProgressBar True [progressRange =: (0,maxProgress)] w lbl <- label [text =: "Speed"] w sld <- hslider [sliderRange =: (0,maxSpeed), sliderPos =: maxSpeed `div` 2] w set w [layout =: (hfill prg ^^^ (lbl <<< hfill sld))] set tm [on command =: set prg [progressPos ~: next]] set sld [on command =: changeSpeed tm sld] set w [on destroy =: destroyTimer tm] return () where next x | x >= maxProgress = 0 | otherwise = x+1 changeSpeed tm sld = do pos <- get sld sliderPos set tm [interval =: maxSpeed-pos+20] |
From: <kr_...@us...> - 2003-03-27 13:35:19
|
Update of /cvsroot/htoolkit/gio/src/Graphics/UI/GIO In directory sc8-pr-cvs1:/tmp/cvs-serv10217/gio/src/Graphics/UI/GIO Modified Files: Timer.hs Log Message: add destroyTimer to export list Index: Timer.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Timer.hs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Timer.hs 26 Mar 2003 02:23:24 -0000 1.4 --- Timer.hs 27 Mar 2003 13:35:09 -0000 1.5 *************** *** 12,16 **** ----------------------------------------------------------------------------------------- module Graphics.UI.GIO.Timer ! ( Timer, timer, interval ) where --- 12,16 ---- ----------------------------------------------------------------------------------------- module Graphics.UI.GIO.Timer ! ( Timer, timer, interval, destroyTimer ) where |
From: <kr_...@us...> - 2003-03-26 22:22:07
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32 In directory sc8-pr-cvs1:/tmp/cvs-serv19951/port/src/cbits/Win32 Modified Files: Window.c Log Message: Enable multiline tooltips under Windows. Under GTK tooltips are multilined by default. Index: Window.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Window.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Window.c 26 Mar 2003 19:20:21 -0000 1.13 --- Window.c 26 Mar 2003 22:21:58 -0000 1.14 *************** *** 1,2 **** --- 1,4 ---- + #define _WIN32_IE 0x0400 + #include "Window.h" #include "Internals.h" *************** *** 1238,1241 **** --- 1240,1244 ---- NULL // No window creation data ); + SendMessage(pData->hTooltip, TTM_SETMAXTIPWIDTH, 0, 400); // Enable multiline tooltips } |
From: <kr_...@us...> - 2003-03-26 22:10:43
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32 In directory sc8-pr-cvs1:/tmp/cvs-serv14592/port/src/cbits/Win32 Modified Files: Button.c EditBox.c Label.c Log Message: The font attribute from Literate class is implemented Index: Button.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Button.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Button.c 10 Feb 2003 22:42:10 -0000 1.3 --- Button.c 26 Mar 2003 22:09:58 -0000 1.4 *************** *** 53,54 **** --- 53,60 ---- handleWindowReLayout(GetParent(button)); }; + + void osChangeButtonFont(WindowHandle button, FontHandle font) + { + SendMessage(button, WM_SETFONT, (WPARAM) font, MAKELPARAM (TRUE,0)); + handleWindowReLayout(GetParent(button)); + }; Index: EditBox.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/EditBox.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** EditBox.c 26 Mar 2003 17:11:48 -0000 1.5 --- EditBox.c 26 Mar 2003 22:09:59 -0000 1.6 *************** *** 86,87 **** --- 86,92 ---- } + void osChangeEditBoxFont(WindowHandle editbox, FontHandle font) + { + SendMessage(editbox, WM_SETFONT, (WPARAM) font, MAKELPARAM (TRUE,0)); + handleWindowReLayout(GetParent(editbox)); + }; \ No newline at end of file Index: Label.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Label.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Label.c 10 Feb 2003 22:42:10 -0000 1.3 --- Label.c 26 Mar 2003 22:10:01 -0000 1.4 *************** *** 53,54 **** --- 53,60 ---- handleWindowReLayout(GetParent(label)); }; + + void osChangeLabelFont(WindowHandle label, FontHandle font) + { + SendMessage(label, WM_SETFONT, (WPARAM) font, MAKELPARAM (TRUE,0)); + handleWindowReLayout(GetParent(label)); + }; \ No newline at end of file |
From: <kr_...@us...> - 2003-03-26 22:10:43
|
Update of /cvsroot/htoolkit/port/src/include In directory sc8-pr-cvs1:/tmp/cvs-serv14592/port/src/include Modified Files: Button.h EditBox.h Label.h Log Message: The font attribute from Literate class is implemented Index: Button.h =================================================================== RCS file: /cvsroot/htoolkit/port/src/include/Button.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Button.h 23 Jan 2003 20:19:32 -0000 1.2 --- Button.h 26 Mar 2003 22:10:02 -0000 1.3 *************** *** 8,11 **** --- 8,12 ---- char *osGetButtonText(WindowHandle button); void osSetButtonText(WindowHandle button, char *txt); + void osChangeButtonFont(WindowHandle button, FontHandle font); #endif Index: EditBox.h =================================================================== RCS file: /cvsroot/htoolkit/port/src/include/EditBox.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** EditBox.h 26 Mar 2003 17:11:48 -0000 1.4 --- EditBox.h 26 Mar 2003 22:10:04 -0000 1.5 *************** *** 12,15 **** --- 12,16 ---- void osSetEditVisibility(WindowHandle editbox, BOOL visible); BOOL osGetEditVisibility(WindowHandle editbox); + void osChangeEditBoxFont(WindowHandle editbox, FontHandle font); #endif Index: Label.h =================================================================== RCS file: /cvsroot/htoolkit/port/src/include/Label.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Label.h 23 Jan 2003 20:19:32 -0000 1.2 --- Label.h 26 Mar 2003 22:10:04 -0000 1.3 *************** *** 8,11 **** --- 8,12 ---- char *osGetLabelText(WindowHandle label); void osSetLabelText(WindowHandle label, char *txt); + void osChangeLabelFont(WindowHandle label, FontHandle font); #endif |
From: <kr_...@us...> - 2003-03-26 22:10:35
|
Update of /cvsroot/htoolkit/port/src/cbits/GTK In directory sc8-pr-cvs1:/tmp/cvs-serv14592/port/src/cbits/GTK Modified Files: Button.c EditBox.c Label.c Log Message: The font attribute from Literate class is implemented Index: Button.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Button.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Button.c 26 Mar 2003 00:41:47 -0000 1.4 --- Button.c 26 Mar 2003 22:09:54 -0000 1.5 *************** *** 1,46 **** ! #include "Button.h" ! #include "Internals.h" ! #include "Handlers_stub.h" ! ! ! WindowHandle osCreateButton(WindowHandle window) ! { ! GtkWidget *button; ! ! button = gtk_button_new_with_mnemonic(""); ! gtk_signal_connect (GTK_OBJECT(button), "clicked", ! GTK_SIGNAL_FUNC(handleControlCommand), ! NULL); ! gtk_fixed_put(GTK_FIXED(GTK_BIN(GetSW(window)->child)->child), button, 0, 0); ! gtk_widget_show(button); ! ! return button; ! }; ! ! void osGetButtonReqSize(WindowHandle button, int *res) ! { ! int w,h; ! GtkRequisition requisition; ! ! gtk_widget_get_size_request(button, &w,&h); ! gtk_widget_set_size_request(button, -1,-1); ! gtk_widget_size_request(button, &requisition); ! gtk_widget_set_size_request(button, w, h); ! ! res[0] = requisition.width; ! res[1] = requisition.height; ! } ! ! char *osGetButtonText(WindowHandle button) ! { ! return fromMnemonicString(gtk_button_get_label(GTK_BUTTON(button))); ! }; ! ! void osSetButtonText(WindowHandle button, char *txt) ! { ! gchar *szText = toMnemonicString(txt); ! GtkWidget *window = gtk_widget_get_toplevel(button); ! gtk_button_set_label(GTK_BUTTON(button), szText); ! handleWindowReLayout(window); ! rfree(szText); ! }; --- 1,52 ---- ! #include "Button.h" ! #include "Internals.h" ! #include "Handlers_stub.h" ! ! ! WindowHandle osCreateButton(WindowHandle window) ! { ! GtkWidget *button; ! ! button = gtk_button_new_with_mnemonic(""); ! gtk_signal_connect (GTK_OBJECT(button), "clicked", ! GTK_SIGNAL_FUNC(handleControlCommand), ! NULL); ! gtk_fixed_put(GTK_FIXED(GTK_BIN(GetSW(window)->child)->child), button, 0, 0); ! gtk_widget_show(button); ! ! return button; ! }; ! ! void osGetButtonReqSize(WindowHandle button, int *res) ! { ! int w,h; ! GtkRequisition requisition; ! ! gtk_widget_get_size_request(button, &w,&h); ! gtk_widget_set_size_request(button, -1,-1); ! gtk_widget_size_request(button, &requisition); ! gtk_widget_set_size_request(button, w, h); ! ! res[0] = requisition.width; ! res[1] = requisition.height; ! } ! ! char *osGetButtonText(WindowHandle button) ! { ! return fromMnemonicString(gtk_button_get_label(GTK_BUTTON(button))); ! }; ! ! void osSetButtonText(WindowHandle button, char *txt) ! { ! gchar *szText = toMnemonicString(txt); ! GtkWidget *window = gtk_widget_get_toplevel(button); ! gtk_button_set_label(GTK_BUTTON(button), szText); ! handleWindowReLayout(window); ! rfree(szText); ! }; ! ! void osChangeButtonFont(WindowHandle button, FontHandle font) ! { ! gtk_widget_modify_font(button, font->font_descr); ! handleWindowReLayout(gtk_widget_get_toplevel(button)); ! }; Index: EditBox.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/EditBox.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** EditBox.c 26 Mar 2003 19:18:12 -0000 1.6 --- EditBox.c 26 Mar 2003 22:09:56 -0000 1.7 *************** *** 56,57 **** --- 56,64 ---- return gtk_entry_get_visibility(GTK_ENTRY(entry)); } + + void osChangeEditBoxFont(WindowHandle entry, FontHandle font) + { + gtk_widget_modify_font(entry, font->font_descr); + // pango_layout_set_font_description(gtk_entry_get_layout(GTK_ENTRY(entry)), font->font_descr); + handleWindowReLayout(gtk_widget_get_toplevel(entry)); + }; Index: Label.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Label.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Label.c 10 Feb 2003 22:42:09 -0000 1.3 --- Label.c 26 Mar 2003 22:09:56 -0000 1.4 *************** *** 1,44 **** ! #include <Types.h> ! #include <Label.h> ! #include "Internals.h" ! #include "Handlers_stub.h" ! ! ! WindowHandle osCreateLabel(WindowHandle window) ! { ! GtkWidget *text; ! ! text = gtk_label_new(""); ! gtk_label_set_line_wrap(GTK_LABEL(text), gtk_false()); ! gtk_fixed_put(GTK_FIXED(GTK_BIN(GetSW(window)->child)->child), text, 0, 0); ! gtk_widget_show(text); ! return text; ! }; ! ! void osGetLabelReqSize(WindowHandle label, int *res) ! { ! int w,h; ! GtkRequisition requisition; ! ! gtk_widget_get_size_request(label, &w,&h); ! gtk_widget_set_size_request(label, -1,-1); ! gtk_widget_size_request(label, &requisition); ! gtk_widget_set_size_request(label, w, h); ! ! res[0] = requisition.width; ! res[1] = requisition.height; ! } ! ! char *osGetLabelText(WindowHandle label) ! { ! return fromMnemonicString(gtk_label_get_text(GTK_LABEL(label))); ! }; ! ! void osSetLabelText(WindowHandle label, char *txt) ! { ! gchar *szText = toMnemonicString(txt); ! GtkWidget *window = gtk_widget_get_toplevel(label); ! gtk_label_set_text_with_mnemonic(GTK_LABEL(label), szText); ! handleWindowReLayout(window); ! rfree(szText); ! }; --- 1,51 ---- ! #include <Types.h> ! #include <Label.h> ! #include "Internals.h" ! #include "Handlers_stub.h" ! ! ! WindowHandle osCreateLabel(WindowHandle window) ! { ! GtkWidget *text; ! ! text = gtk_label_new(""); ! gtk_label_set_line_wrap(GTK_LABEL(text), gtk_false()); ! gtk_fixed_put(GTK_FIXED(GTK_BIN(GetSW(window)->child)->child), text, 0, 0); ! gtk_widget_show(text); ! return text; ! }; ! ! void osGetLabelReqSize(WindowHandle label, int *res) ! { ! int w,h; ! GtkRequisition requisition; ! ! gtk_widget_get_size_request(label, &w,&h); ! gtk_widget_set_size_request(label, -1,-1); ! gtk_widget_size_request(label, &requisition); ! gtk_widget_set_size_request(label, w, h); ! ! res[0] = requisition.width; ! res[1] = requisition.height; ! } ! ! char *osGetLabelText(WindowHandle label) ! { ! return fromMnemonicString(gtk_label_get_text(GTK_LABEL(label))); ! }; ! ! void osSetLabelText(WindowHandle label, char *txt) ! { ! gchar *szText = toMnemonicString(txt); ! GtkWidget *window = gtk_widget_get_toplevel(label); ! gtk_label_set_text_with_mnemonic(GTK_LABEL(label), szText); ! handleWindowReLayout(window); ! rfree(szText); ! }; ! ! void osChangeLabelFont(WindowHandle label, FontHandle font) ! { ! gtk_widget_modify_font(label, font->font_descr); ! //pango_layout_set_font_description(gtk_label_get_layout(GTK_LABEL(label)), font->font_descr); ! handleWindowReLayout(gtk_widget_get_toplevel(label)); ! }; |