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-26 22:10:29
|
Update of /cvsroot/htoolkit/port/src/Port In directory sc8-pr-cvs1:/tmp/cvs-serv14592/port/src/Port Modified Files: Controls.hs Log Message: The font attribute from Literate class is implemented Index: Controls.hs =================================================================== RCS file: /cvsroot/htoolkit/port/src/Port/Controls.hs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Controls.hs 26 Mar 2003 19:20:18 -0000 1.11 --- Controls.hs 26 Mar 2003 22:09:53 -0000 1.12 *************** *** 36,42 **** --- 36,44 ---- , createLabel, getLabelRequestSize , getLabelText, setLabelText + , changeLabelFont -- * Button , createButton, getButtonRequestSize , getButtonText, setButtonText + , changeButtonFont -- * Edit box , createEdit, getEditRequestSize *************** *** 44,47 **** --- 46,50 ---- , getEditReadOnly, setEditReadOnly , getEditVisibility,setEditVisibility + , changeEditBoxFont -- * Check box , createCheckBox, getCheckBoxRequestSize *************** *** 124,127 **** --- 127,134 ---- foreign import ccall osSetLabelText :: WindowHandle -> CString -> IO () + changeLabelFont :: WindowHandle -> Font -> IO () + changeLabelFont hwnd font = withCFont font (osChangeLabelFont hwnd) + foreign import ccall osChangeLabelFont :: WindowHandle -> FontHandle -> IO () + ----------------------------------------------------------------------------------------- -- Button *************** *** 148,151 **** --- 155,162 ---- foreign import ccall osSetButtonText :: WindowHandle -> CString -> IO () + changeButtonFont :: WindowHandle -> Font -> IO () + changeButtonFont hwnd font = withCFont font (osChangeButtonFont hwnd) + foreign import ccall osChangeButtonFont :: WindowHandle -> FontHandle -> IO () + ----------------------------------------------------------------------------------------- -- CheckBox *************** *** 201,204 **** --- 212,219 ---- foreign import ccall "osSetEditVisibility" setEditVisibility :: WindowHandle -> Bool -> IO () foreign import ccall "osGetEditVisibility" getEditVisibility :: WindowHandle -> IO Bool + + changeEditBoxFont :: WindowHandle -> Font -> IO () + changeEditBoxFont hwnd font = withCFont font (osChangeEditBoxFont hwnd) + foreign import ccall osChangeEditBoxFont :: WindowHandle -> FontHandle -> IO () ----------------------------------------------------------------------------------------- |
From: <kr_...@us...> - 2003-03-26 22:10:14
|
Update of /cvsroot/htoolkit/gio/src/Graphics/UI/GIO In directory sc8-pr-cvs1:/tmp/cvs-serv14592/gio/src/Graphics/UI/GIO Modified Files: Controls.hs Log Message: The font attribute from Literate class is implemented Index: Controls.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Controls.hs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Controls.hs 26 Mar 2003 19:20:23 -0000 1.7 --- Controls.hs 26 Mar 2003 22:10:04 -0000 1.8 *************** *** 37,40 **** --- 37,41 ---- data Label = Label { lhandle :: !WindowHandle , lparent :: !WindowHandle + , lfont :: Var Font } *************** *** 44,55 **** = do lab <- do hwnd <- get w windowHandle hlab <- Port.createLabel hwnd ! return (Label hlab hwnd) set lab props return lab instance Literate Label where ! text = newAttr (\w -> Port.getLabelText (lhandle w)) ! (\w txt -> Port.setLabelText (lhandle w) txt) ! font = readAttr "Label.font" (\w -> return Port.defaultFont) instance Dimensions Label where --- 45,56 ---- = do lab <- do hwnd <- get w windowHandle hlab <- Port.createLabel hwnd ! lfont <- newVar Port.defaultFont ! return (Label hlab hwnd lfont) set lab props return lab instance Literate Label where ! text = newAttr (Port.getLabelText . lhandle) (Port.setLabelText . lhandle) ! font = newAttr (getVar . lfont) (\w font -> Port.changeLabelFont (lhandle w) font >> setVar (lfont w) font) instance Dimensions Label where *************** *** 73,76 **** --- 74,78 ---- data Button = Button { bhandle :: !WindowHandle , bparent :: !WindowHandle + , bfont :: Var Font } *************** *** 80,92 **** = do but <- do hwnd <- get w windowHandle hbut <- Port.createButton hwnd ! return (Button hbut hwnd) set but props return but - instance Literate Button where text = newAttr (\b -> Port.getButtonText (bhandle b)) (\b txt -> Port.setButtonText (bhandle b) txt) ! font = readAttr "Button.font" (\b -> return Port.defaultFont) instance Dimensions Button where --- 82,94 ---- = do but <- do hwnd <- get w windowHandle hbut <- Port.createButton hwnd ! bfont <- newVar Port.defaultFont ! return (Button hbut hwnd bfont) set but props return but instance Literate Button where text = newAttr (\b -> Port.getButtonText (bhandle b)) (\b txt -> Port.setButtonText (bhandle b) txt) ! font = newAttr (getVar . bfont) (\w font -> Port.changeButtonFont (bhandle w) font >> setVar (bfont w) font) instance Dimensions Button where *************** *** 114,117 **** --- 116,120 ---- data Entry = Entry { ehandle :: !WindowHandle , eparent :: !WindowHandle + , efont :: Var Font } *************** *** 121,133 **** = do e <- do hwnd <- get w windowHandle hentry <- Port.createEdit hwnd ! return (Entry hentry hwnd) set e props return e - instance Literate Entry where ! text = newAttr (\w -> Port.getEditText (ehandle w)) ! (\w txt -> Port.setEditText (ehandle w) txt) ! font = readAttr "Entry.font" (\w -> return Port.defaultFont) instance Dimensions Entry where --- 124,135 ---- = do e <- do hwnd <- get w windowHandle hentry <- Port.createEdit hwnd ! efont <- newVar Port.defaultFont ! return (Entry hentry hwnd efont) set e props return e instance Literate Entry where ! text = newAttr (Port.getEditText . ehandle) (Port.setEditText . ehandle) ! font = newAttr (getVar . efont) (\w font -> Port.changeEditBoxFont (ehandle w) font >> setVar (efont w) font) instance Dimensions Entry where |
From: <kr_...@us...> - 2003-03-26 19:20:56
|
Update of /cvsroot/htoolkit/port/src/include In directory sc8-pr-cvs1:/tmp/cvs-serv31265/port/src/include Modified Files: Window.h Log Message: Added implementation for tooltips Index: Window.h =================================================================== RCS file: /cvsroot/htoolkit/port/src/include/Window.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Window.h 26 Mar 2003 15:39:49 -0000 1.4 --- Window.h 26 Mar 2003 19:20:22 -0000 1.5 *************** *** 60,63 **** --- 60,66 ---- void osSetControlEnabled(WindowHandle ctrl, BOOL enabled); BOOL osGetControlEnabled(WindowHandle ctrl); + void osSetControlTip(WindowHandle ctrl, char *text); + char *osGetControlTip(WindowHandle ctrl); + void osInvalidateWindow(WindowHandle window); void osInvalidateWindowRect(WindowHandle window, int left, int top, int right, int bottom); |
From: <kr_...@us...> - 2003-03-26 19:20:55
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32 In directory sc8-pr-cvs1:/tmp/cvs-serv31265/port/src/cbits/Win32 Modified Files: Window.c Log Message: Added implementation for tooltips Index: Window.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Window.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Window.c 26 Mar 2003 15:39:48 -0000 1.12 --- Window.c 26 Mar 2003 19:20:21 -0000 1.13 *************** *** 22,25 **** --- 22,27 ---- int disabledCtrlsCount; HWND *disabledCtrls; + + HWND hTooltip; } WindowData; *************** *** 176,180 **** pData->disabledCtrlsCount = 0; pData->disabledCtrls = NULL; ! SetWindowLong(hWnd,GWL_USERDATA,(LONG) pData); gActiveObjects++; --- 178,183 ---- pData->disabledCtrlsCount = 0; pData->disabledCtrls = NULL; ! pData->hTooltip = NULL; ! SetWindowLong(hWnd,GWL_USERDATA,(LONG) pData); gActiveObjects++; *************** *** 470,474 **** handleWindowMouse(hWnd,evMouseLeave,pData->Origin.x+cx,pData->Origin.y+cy,GetModifiers()); pData->bInMouseMoveMode = FALSE; ! ReleaseCapture(); } else --- 473,477 ---- handleWindowMouse(hWnd,evMouseLeave,pData->Origin.x+cx,pData->Origin.y+cy,GetModifiers()); pData->bInMouseMoveMode = FALSE; ! //ReleaseCapture(); } else *************** *** 478,482 **** { pData->bInMouseMoveMode = TRUE; ! SetCapture(hWnd); handleWindowMouse(hWnd,evMouseEnter,pData->Origin.x+cx,pData->Origin.y+cy,GetModifiers()); } --- 481,485 ---- { pData->bInMouseMoveMode = TRUE; ! //SetCapture(hWnd); handleWindowMouse(hWnd,evMouseEnter,pData->Origin.x+cx,pData->Origin.y+cy,GetModifiers()); } *************** *** 504,508 **** { pData->bInDragMode = TRUE; ! if (!pData->bInMouseMoveMode) SetCapture(hWnd); handleWindowMouse(hWnd,evMouseLeftDown,pos.x,pos.y,GetModifiers()); } --- 507,511 ---- { pData->bInDragMode = TRUE; ! //if (!pData->bInMouseMoveMode) SetCapture(hWnd); handleWindowMouse(hWnd,evMouseLeftDown,pos.x,pos.y,GetModifiers()); } *************** *** 555,563 **** handleWindowMouse(hWnd,evMouseLeave,pData->Origin.x+cx,pData->Origin.y+cy,GetModifiers()); pData->bInMouseMoveMode = FALSE; ! ReleaseCapture(); } } ! else ! ReleaseCapture(); hCtrl = checkMousePosition(hWnd, &pos); --- 558,566 ---- handleWindowMouse(hWnd,evMouseLeave,pData->Origin.x+cx,pData->Origin.y+cy,GetModifiers()); pData->bInMouseMoveMode = FALSE; ! //ReleaseCapture(); } } ! //else ! // ReleaseCapture(); hCtrl = checkMousePosition(hWnd, &pos); *************** *** 1209,1212 **** --- 1212,1308 ---- { return IsWindowEnabled(ctrl); + } + + void osSetControlTip(WindowHandle ctrl, char *text) + { + TOOLINFO ti; /* The tool information that is sent to the tooltip control. */ + HWND hParent; + WindowData *pData; + + hParent = GetParent(ctrl); + pData = (WindowData *) GetWindowLong(GetParent(ctrl),GWL_USERDATA); + + if (!pData->hTooltip) + { + pData->hTooltip = CreateWindowEx (WS_EX_TOPMOST, // Apply the topmost style for this window + TOOLTIPS_CLASS, // Class name + NULL, // Title (NULL) + WS_POPUP | TTS_ALWAYSTIP, // Style *must* be WS_POPUP + CW_USEDEFAULT, // Default position (x,y) + CW_USEDEFAULT, + CW_USEDEFAULT, // Default size (w,h) + CW_USEDEFAULT, + hParent, // Parent + (HMENU) NULL, // No menu + (HANDLE) ghModule, // The instance + NULL // No window creation data + ); + } + + if (text && *text) + { + text[256] = 0; // Truncate the tip text to 255 chars because the osGetControlTip function + //uses 256 bytes long buffer + + /* Fill the tooltip info with the appropriate information. */ + ti.cbSize = sizeof(TOOLINFO); + ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS; + ti.hwnd = hParent; + ti.uId = (UINT) ctrl; + ti.rect.left = 0; + ti.rect.top = 0; + ti.rect.right = 0; + ti.rect.bottom= 0; + ti.hinst = ghModule; + ti.lpszText = text; + + SendMessage (pData->hTooltip, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO)&ti); + } + else + { + /* Fill the tooltip info with the appropriate information. */ + ti.cbSize = sizeof(TOOLINFO); + ti.uFlags = TTF_IDISHWND; + ti.hwnd = hParent; + ti.uId = (UINT) ctrl; + + SendMessage (pData->hTooltip, TTM_DELTOOL, 0, (LPARAM) (LPTOOLINFO)&ti); + } + } + + char *osGetControlTip(WindowHandle ctrl) + { + TOOLINFO ti; /* The tool information that is sent to the tooltip control. */ + HWND hParent; + WindowData *pData; + + hParent = GetParent(ctrl); + pData = (WindowData *) GetWindowLong(GetParent(ctrl),GWL_USERDATA); + + if (pData->hTooltip) + { + /* Fill the tooltip info with the appropriate information. */ + ti.cbSize = sizeof(TOOLINFO); + ti.uFlags = TTF_IDISHWND; + ti.hwnd = hParent; + ti.uId = (UINT) ctrl; + ti.lpszText = malloc(256); + + if (ti.lpszText) + { + *ti.lpszText = 0; + SendMessage (pData->hTooltip, TTM_GETTEXT, 0, (LPARAM) (LPTOOLINFO)&ti); + + if (*ti.lpszText == 0) + { + free(ti.lpszText); + ti.lpszText = NULL; + } + } + + return ti.lpszText; + } + else + return NULL; } |
From: <kr_...@us...> - 2003-03-26 19:20:54
|
Update of /cvsroot/htoolkit/port/src/cbits/GTK In directory sc8-pr-cvs1:/tmp/cvs-serv31265/port/src/cbits/GTK Modified Files: Window.c Log Message: Added implementation for tooltips Index: Window.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Window.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Window.c 26 Mar 2003 15:39:48 -0000 1.9 --- Window.c 26 Mar 2003 19:20:20 -0000 1.10 *************** *** 733,736 **** --- 733,756 ---- } + static GtkTooltips *gTooltips; + + void osSetControlTip(WindowHandle ctrl, char *text) + { + if (!gTooltips) + gTooltips = gtk_tooltips_new(); + + gtk_tooltips_set_tip(gTooltips, ctrl, text, NULL); + } + + char *osGetControlTip(WindowHandle ctrl) + { + GtkTooltipsData *tips_data; + if (!gTooltips) + return NULL; + + tips_data = gtk_tooltips_data_get(ctrl); + return strdup(tips_data->tip_text); + } + void osSetWindowRect(WindowHandle window, int x0, int y0, int x1, int y1) { |
From: <kr_...@us...> - 2003-03-26 19:20:53
|
Update of /cvsroot/htoolkit/port/src/Port In directory sc8-pr-cvs1:/tmp/cvs-serv31265/port/src/Port Modified Files: Controls.hs Log Message: Added implementation for tooltips Index: Controls.hs =================================================================== RCS file: /cvsroot/htoolkit/port/src/Port/Controls.hs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Controls.hs 26 Mar 2003 17:11:48 -0000 1.10 --- Controls.hs 26 Mar 2003 19:20:18 -0000 1.11 *************** *** 32,35 **** --- 32,36 ---- , getControlFrame , setControlEnabled, getControlEnabled + , setControlTip, getControlTip -- * Label , createLabel, getLabelRequestSize *************** *** 89,92 **** --- 90,103 ---- foreign import ccall unsafe "osSetControlEnabled" setControlEnabled :: WindowHandle -> Bool -> IO () foreign import ccall unsafe "osGetControlEnabled" getControlEnabled :: WindowHandle -> IO Bool + + getControlTip :: WindowHandle -> IO String + getControlTip hwnd + = resultCString (osGetControlTip hwnd) + foreign import ccall osGetControlTip :: WindowHandle -> IO CString + + setControlTip :: WindowHandle -> String -> IO () + setControlTip hwnd txt + = withCString txt (osSetControlTip hwnd) + foreign import ccall osSetControlTip :: WindowHandle -> CString -> IO () ----------------------------------------------------------------------------------------- |
From: <kr_...@us...> - 2003-03-26 19:20:31
|
Update of /cvsroot/htoolkit/gio/src/Graphics/UI/GIO In directory sc8-pr-cvs1:/tmp/cvs-serv31265/gio/src/Graphics/UI/GIO Modified Files: Attributes.hs Controls.hs Log Message: Added implementation for tooltips Index: Attributes.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Attributes.hs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Attributes.hs 26 Mar 2003 08:54:55 -0000 1.6 --- Attributes.hs 26 Mar 2003 19:20:23 -0000 1.7 *************** *** 67,70 **** --- 67,73 ---- -- ** Able , Able, enabled + + -- ** ToolTip + , ToolTip, tooltip -- ** Selection *************** *** 257,260 **** --- 260,268 ---- -- | Enable, or disable, the widget. enabled :: Attr w Bool + + -- | Widgets that supports tooltips. + class ToolTip w where + -- | The tip text + tooltip :: Attr w String -- | Widgets that can be checked. Index: Controls.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Controls.hs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Controls.hs 26 Mar 2003 17:11:47 -0000 1.6 --- Controls.hs 26 Mar 2003 19:20:23 -0000 1.7 *************** *** 59,62 **** --- 59,65 ---- instance Able Label where enabled = newAttr (Port.getControlEnabled . lhandle) (Port.setControlEnabled . lhandle) + + instance ToolTip Label where + tooltip = newAttr (Port.getControlTip . lhandle) (Port.setControlTip . lhandle) instance Control Label where *************** *** 93,96 **** --- 96,102 ---- instance Able Button where enabled = newAttr (Port.getControlEnabled . bhandle) (Port.setControlEnabled . bhandle) + + instance ToolTip Button where + tooltip = newAttr (Port.getControlTip . bhandle) (Port.setControlTip . bhandle) instance Control Button where *************** *** 131,134 **** --- 137,143 ---- instance Able Entry where enabled = newAttr (Port.getControlEnabled . ehandle) (Port.setControlEnabled . ehandle) + + instance ToolTip Entry where + tooltip = newAttr (Port.getControlTip . ehandle) (Port.setControlTip . ehandle) instance Control Entry where *************** *** 196,199 **** --- 205,211 ---- instance Able Popup where enabled = newAttr (Port.getControlEnabled . phandle) (Port.setControlEnabled . phandle) + + instance ToolTip Popup where + tooltip = newAttr (Port.getControlTip . phandle) (Port.setControlTip . phandle) instance Control Popup where *************** *** 347,350 **** --- 359,365 ---- instance Able Check where enabled = newAttr (Port.getControlEnabled . chandle) (Port.setControlEnabled . chandle) + + instance ToolTip Check where + tooltip = newAttr (Port.getControlTip . chandle) (Port.setControlTip . chandle) instance Control Check where *************** *** 384,387 **** --- 399,405 ---- instance Able Radio where enabled = newAttr (Port.getControlEnabled . rhandle) (Port.setControlEnabled . rhandle) + + instance ToolTip Radio where + tooltip = newAttr (Port.getControlTip . rhandle) (Port.setControlTip . rhandle) instance Control Radio where |
From: <kr_...@us...> - 2003-03-26 19:18:20
|
Update of /cvsroot/htoolkit/port/src/cbits/GTK In directory sc8-pr-cvs1:/tmp/cvs-serv30680/src/cbits/GTK Modified Files: EditBox.c Log Message: fix Index: EditBox.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/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 19:18:12 -0000 1.6 *************** *** 1,60 **** ! #include "EditBox.h" ! #include "Internals.h" ! #include "Handlers_stub.h" ! ! WindowHandle osCreateEdit(WindowHandle window) ! { ! GtkWidget *entry; ! ! entry = gtk_entry_new(); ! gtk_fixed_put(GTK_FIXED(GTK_BIN(GetSW(window)->child)->child), entry, 0, 0); ! gtk_widget_show(entry); ! return entry; ! }; ! ! void osGetEditReqSize(WindowHandle edit, int *res) ! { ! int w,h; ! GtkRequisition requisition; ! ! gtk_widget_get_size_request(edit, &w,&h); ! gtk_widget_set_size_request(edit, -1,-1); ! gtk_widget_size_request(edit, &requisition); ! gtk_widget_set_size_request(edit, w, h); ! ! res[0] = requisition.width; ! res[1] = requisition.height; ! } ! ! char *osGetEditText(WindowHandle entry) ! { ! char *text = gtk_entry_get_text(GTK_ENTRY(entry)); ! char *buffer = (char *) rmalloc(strlen(text)+1); ! strcpy(text,buffer); ! return buffer; ! }; ! ! void osSetEditText(WindowHandle entry, char *txt) ! { ! gtk_entry_set_text(GTK_ENTRY(entry), txt); ! }; ! ! void osSetEditReadOnly(WindowHandle entry, BOOL readOnly) ! { ! gtk_editable_set_editable(GTK_EDITABLE(entry), !readOnly); ! } ! ! BOOL osGetEditReadOnly(WindowHandle entry) ! { ! return !gtk_editable_get_editable(GTK_EDITABLE(entry)); ! } ! ! void osSetEditVisibility(WindowHandle entry, BOOL visible) ! { ! gtk_entry_set_visibility(GTK_ENTRY(entry), visible); ! } ! ! BOOL osGetEditVisibility(WindowHandle editbox) ! { ! return gtk_entry_get_visibility(GTK_ENTRY(entry)); ! } \ No newline at end of file --- 1,57 ---- ! #include "EditBox.h" ! #include "Internals.h" ! #include "Handlers_stub.h" ! ! WindowHandle osCreateEdit(WindowHandle window) ! { ! GtkWidget *entry; ! ! entry = gtk_entry_new(); ! gtk_fixed_put(GTK_FIXED(GTK_BIN(GetSW(window)->child)->child), entry, 0, 0); ! gtk_widget_show(entry); ! return entry; ! }; ! ! void osGetEditReqSize(WindowHandle edit, int *res) ! { ! int w,h; ! GtkRequisition requisition; ! ! gtk_widget_get_size_request(edit, &w,&h); ! gtk_widget_set_size_request(edit, -1,-1); ! gtk_widget_size_request(edit, &requisition); ! gtk_widget_set_size_request(edit, w, h); ! ! res[0] = requisition.width; ! res[1] = requisition.height; ! } ! ! char *osGetEditText(WindowHandle entry) ! { ! return strdup(gtk_entry_get_text(GTK_ENTRY(entry))); ! }; ! ! void osSetEditText(WindowHandle entry, char *txt) ! { ! gtk_entry_set_text(GTK_ENTRY(entry), txt); ! }; ! ! void osSetEditReadOnly(WindowHandle entry, BOOL readOnly) ! { ! gtk_editable_set_editable(GTK_EDITABLE(entry), !readOnly); ! } ! ! BOOL osGetEditReadOnly(WindowHandle entry) ! { ! return !gtk_editable_get_editable(GTK_EDITABLE(entry)); ! } ! ! void osSetEditVisibility(WindowHandle entry, BOOL visible) ! { ! gtk_entry_set_visibility(GTK_ENTRY(entry), visible); ! } ! ! BOOL osGetEditVisibility(WindowHandle entry) ! { ! return gtk_entry_get_visibility(GTK_ENTRY(entry)); ! } |
From: <kr_...@us...> - 2003-03-26 18:35:46
|
Update of /cvsroot/htoolkit/gio/src/examples/simple In directory sc8-pr-cvs1:/tmp/cvs-serv8433 Modified Files: Able.hs Log Message: Return to original example Index: Able.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/examples/simple/Able.hs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Able.hs 26 Mar 2003 17:11:48 -0000 1.2 --- Able.hs 26 Mar 2003 18:35:42 -0000 1.3 *************** *** 15,26 **** set w2 [layout =: (hfill bctrl ^^^ hfill bwnd)] enable "Control" bctrl ent ! --enable "Window" bwnd w1 return () where enable title b w = do ! set w [visible =: True] set b [text =: "Disable " ++ title, on command =: disable title b w] disable title b w = do ! set w [visible =: False] set b [text =: "Enable " ++ title, on command =: enable title b w] --- 15,26 ---- set w2 [layout =: (hfill bctrl ^^^ hfill bwnd)] enable "Control" bctrl ent ! enable "Window" bwnd w1 return () where enable title b w = do ! set w [enabled =: True] set b [text =: "Disable " ++ title, on command =: disable title b w] disable title b w = do ! set w [enabled =: False] set b [text =: "Enable " ++ title, on command =: enable title b w] |
From: <kr_...@us...> - 2003-03-26 18:20:55
|
Update of /cvsroot/htoolkit/port/src/Port In directory sc8-pr-cvs1:/tmp/cvs-serv872/src/Port Modified Files: Types.hs Log Message: fix Index: Types.hs =================================================================== RCS file: /cvsroot/htoolkit/port/src/Port/Types.hs,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Types.hs 26 Mar 2003 18:11:31 -0000 1.15 --- Types.hs 26 Mar 2003 18:20:35 -0000 1.16 *************** *** 1054,1058 **** peekCStrings :: CString -> IO [String] peekCStrings cstrs ! | ptr == nullPtr = return [] | otherwise = do str <- peekCString cstrs --- 1054,1058 ---- peekCStrings :: CString -> IO [String] peekCStrings cstrs ! | cstrs == nullPtr = return [] | otherwise = do str <- peekCString cstrs *************** *** 1067,1071 **** = bracket io free safePeekCString where ! safePeekCString ptr | ptr == nullPtr = "" | otherwise = peekCString ptr --- 1067,1071 ---- = bracket io free safePeekCString where ! safePeekCString ptr | ptr == nullPtr = return "" | otherwise = peekCString ptr |
From: <kr_...@us...> - 2003-03-26 18:11:38
|
Update of /cvsroot/htoolkit/port/src/Port In directory sc8-pr-cvs1:/tmp/cvs-serv28720/port/src/Port Modified Files: Types.hs Log Message: Use safe peekCString Index: Types.hs =================================================================== RCS file: /cvsroot/htoolkit/port/src/Port/Types.hs,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Types.hs 15 Mar 2003 01:06:32 -0000 1.14 --- Types.hs 26 Mar 2003 18:11:31 -0000 1.15 *************** *** 1054,1058 **** peekCStrings :: CString -> IO [String] peekCStrings cstrs ! = do str <- peekCString cstrs if (null str) then return [] --- 1054,1060 ---- peekCStrings :: CString -> IO [String] peekCStrings cstrs ! | ptr == nullPtr = return [] ! | otherwise = do ! str <- peekCString cstrs if (null str) then return [] *************** *** 1063,1067 **** resultCString :: IO CString -> IO String resultCString io ! = bracket io free peekCString -- | Convert and free a c-string of c-strings. --- 1065,1072 ---- resultCString :: IO CString -> IO String resultCString io ! = bracket io free safePeekCString ! where ! safePeekCString ptr | ptr == nullPtr = "" ! | otherwise = peekCString ptr -- | Convert and free a c-string of c-strings. |
From: <kr_...@us...> - 2003-03-26 17:12:05
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32 In directory sc8-pr-cvs1:/tmp/cvs-serv30880/port/src/cbits/Win32 Modified Files: EditBox.c Log Message: Implement readOnly and visible attributes for Entry control Index: EditBox.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/EditBox.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** EditBox.c 10 Feb 2003 22:42:10 -0000 1.4 --- EditBox.c 26 Mar 2003 17:11:48 -0000 1.5 *************** *** 50,51 **** --- 50,87 ---- SetWindowText(editbox, txt); }; + + void osSetEditReadOnly(WindowHandle editbox, BOOL readOnly) + { + SendMessage(editbox,EM_SETREADONLY,readOnly,0); + } + + BOOL osGetEditReadOnly(WindowHandle editbox) + { + return (GetWindowLong(editbox, GWL_STYLE) & ES_READONLY) != 0; + } + + void osSetEditVisibility(WindowHandle editbox, BOOL visible) + { + LONG lStyle; + + lStyle = GetWindowLong(editbox, GWL_STYLE); + + if (visible) + { + SetWindowLong(editbox, GWL_STYLE, lStyle & ~ES_PASSWORD); + SendMessage(editbox, EM_SETPASSWORDCHAR, 0, 0); + } + else + { + SetWindowLong(editbox, GWL_STYLE, lStyle | ES_PASSWORD); + SendMessage(editbox, EM_SETPASSWORDCHAR, (WPARAM) '*', 0); + } + + InvalidateRect(editbox,NULL,TRUE); + } + + BOOL osGetEditVisibility(WindowHandle editbox) + { + return (GetWindowLong(editbox, GWL_STYLE) & ES_PASSWORD) == 0; + } + |
From: <kr_...@us...> - 2003-03-26 17:12:05
|
Update of /cvsroot/htoolkit/port/src/cbits/GTK In directory sc8-pr-cvs1:/tmp/cvs-serv30880/port/src/cbits/GTK Modified Files: EditBox.c Log Message: Implement readOnly and visible attributes for Entry control Index: EditBox.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/EditBox.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** EditBox.c 10 Feb 2003 22:42:09 -0000 1.4 --- EditBox.c 26 Mar 2003 17:11:48 -0000 1.5 *************** *** 39,40 **** --- 39,60 ---- gtk_entry_set_text(GTK_ENTRY(entry), txt); }; + + void osSetEditReadOnly(WindowHandle entry, BOOL readOnly) + { + gtk_editable_set_editable(GTK_EDITABLE(entry), !readOnly); + } + + BOOL osGetEditReadOnly(WindowHandle entry) + { + return !gtk_editable_get_editable(GTK_EDITABLE(entry)); + } + + void osSetEditVisibility(WindowHandle entry, BOOL visible) + { + gtk_entry_set_visibility(GTK_ENTRY(entry), visible); + } + + BOOL osGetEditVisibility(WindowHandle editbox) + { + return gtk_entry_get_visibility(GTK_ENTRY(entry)); + } \ No newline at end of file |
From: <kr_...@us...> - 2003-03-26 17:12:05
|
Update of /cvsroot/htoolkit/port/src/include In directory sc8-pr-cvs1:/tmp/cvs-serv30880/port/src/include Modified Files: EditBox.h Log Message: Implement readOnly and visible attributes for Entry control Index: EditBox.h =================================================================== RCS file: /cvsroot/htoolkit/port/src/include/EditBox.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** EditBox.h 27 Jan 2003 22:02:45 -0000 1.3 --- EditBox.h 26 Mar 2003 17:11:48 -0000 1.4 *************** *** 8,11 **** --- 8,15 ---- char *osGetEditText(WindowHandle editbox); void osSetEditText(WindowHandle editbox, char *txt); + void osSetEditReadOnly(WindowHandle editbox, BOOL readOnly); + BOOL osGetEditReadOnly(WindowHandle editbox); + void osSetEditVisibility(WindowHandle editbox, BOOL visible); + BOOL osGetEditVisibility(WindowHandle editbox); #endif |
From: <kr_...@us...> - 2003-03-26 17:12:04
|
Update of /cvsroot/htoolkit/port/src/Port In directory sc8-pr-cvs1:/tmp/cvs-serv30880/port/src/Port Modified Files: Controls.hs Log Message: Implement readOnly and visible attributes for Entry control Index: Controls.hs =================================================================== RCS file: /cvsroot/htoolkit/port/src/Port/Controls.hs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Controls.hs 26 Mar 2003 15:39:47 -0000 1.9 --- Controls.hs 26 Mar 2003 17:11:48 -0000 1.10 *************** *** 40,44 **** -- * Edit box , createEdit, getEditRequestSize ! , getEditText, setEditText -- * Check box , createCheckBox, getCheckBoxRequestSize --- 40,46 ---- -- * Edit box , createEdit, getEditRequestSize ! , getEditText, setEditText ! , getEditReadOnly, setEditReadOnly ! , getEditVisibility,setEditVisibility -- * Check box , createCheckBox, getCheckBoxRequestSize *************** *** 182,185 **** --- 184,193 ---- = withCString txt $ \ctxt -> osSetEditText hwnd ctxt foreign import ccall osSetEditText :: WindowHandle -> CString -> IO () + + foreign import ccall "osSetEditReadOnly" setEditReadOnly :: WindowHandle -> Bool -> IO () + foreign import ccall "osGetEditReadOnly" getEditReadOnly :: WindowHandle -> IO Bool + + foreign import ccall "osSetEditVisibility" setEditVisibility :: WindowHandle -> Bool -> IO () + foreign import ccall "osGetEditVisibility" getEditVisibility :: WindowHandle -> IO Bool ----------------------------------------------------------------------------------------- |
From: <kr_...@us...> - 2003-03-26 17:11:53
|
Update of /cvsroot/htoolkit/gio/src/Graphics/UI/GIO In directory sc8-pr-cvs1:/tmp/cvs-serv30880/gio/src/Graphics/UI/GIO Modified Files: Controls.hs Log Message: Implement readOnly and visible attributes for Entry control Index: Controls.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Controls.hs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Controls.hs 26 Mar 2003 15:39:46 -0000 1.5 --- Controls.hs 26 Mar 2003 17:11:47 -0000 1.6 *************** *** 15,19 **** Button, button , Label, label ! , Entry, entry , Popup, popup , CheckGroup, checkGroup, checkLayout --- 15,19 ---- Button, button , Label, label ! , Entry, entry, readOnly, visible , Popup, popup , CheckGroup, checkGroup, checkLayout *************** *** 135,139 **** pack w = stdPack (eparent w) (Port.getEditRequestSize (ehandle w)) (Port.moveResizeControl (ehandle w)) ! {-------------------------------------------------------------------- --- 135,146 ---- pack w = stdPack (eparent w) (Port.getEditRequestSize (ehandle w)) (Port.moveResizeControl (ehandle w)) ! ! -- | Determines if the user can edit the text in the editable widget or not. ! readOnly :: Attr Entry Bool ! readOnly = newAttr (Port.getEditReadOnly . ehandle) (Port.setEditReadOnly . ehandle) ! ! -- | Determines if the user can edit the text in the editable widget or not. ! visible :: Attr Entry Bool ! visible = newAttr (Port.getEditVisibility . ehandle) (Port.setEditVisibility . ehandle) {-------------------------------------------------------------------- |
From: <kr_...@us...> - 2003-03-26 17:11:52
|
Update of /cvsroot/htoolkit/gio/src/examples/simple In directory sc8-pr-cvs1:/tmp/cvs-serv30880/gio/src/examples/simple Modified Files: Able.hs Log Message: Implement readOnly and visible attributes for Entry control Index: Able.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/examples/simple/Able.hs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Able.hs 26 Mar 2003 15:39:47 -0000 1.1 --- Able.hs 26 Mar 2003 17:11:48 -0000 1.2 *************** *** 15,26 **** set w2 [layout =: (hfill bctrl ^^^ hfill bwnd)] enable "Control" bctrl ent ! enable "Window" bwnd w1 return () where enable title b w = do ! set w [enabled =: True] set b [text =: "Disable " ++ title, on command =: disable title b w] disable title b w = do ! set w [enabled =: False] set b [text =: "Enable " ++ title, on command =: enable title b w] --- 15,26 ---- set w2 [layout =: (hfill bctrl ^^^ hfill bwnd)] enable "Control" bctrl ent ! --enable "Window" bwnd w1 return () where enable title b w = do ! set w [visible =: True] set b [text =: "Disable " ++ title, on command =: disable title b w] disable title b w = do ! set w [visible =: False] set b [text =: "Enable " ++ title, on command =: enable title b w] |
From: <kr_...@us...> - 2003-03-26 15:40:23
|
Update of /cvsroot/htoolkit/port/src/Port In directory sc8-pr-cvs1:/tmp/cvs-serv16051/port/src/Port Modified Files: Controls.hs Window.hs Log Message: This commit implements instances for Able type class for all kinds of windows and controls. Index: Controls.hs =================================================================== RCS file: /cvsroot/htoolkit/port/src/Port/Controls.hs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Controls.hs 27 Jan 2003 22:02:38 -0000 1.8 --- Controls.hs 26 Mar 2003 15:39:47 -0000 1.9 *************** *** 31,34 **** --- 31,35 ---- moveResizeControl , getControlFrame + , setControlEnabled, getControlEnabled -- * Label , createLabel, getLabelRequestSize *************** *** 67,72 **** ! {----------------------------------------------------------------------------------------- ! -----------------------------------------------------------------------------------------} -- | Change the position and size of a control. --- 68,73 ---- ! ----------------------------------------------------------------------------------------- ! -- Generic -----------------------------------------------------------------------------------------} -- | Change the position and size of a control. *************** *** 84,90 **** foreign import ccall osGetControlRect :: WindowHandle -> Ptr CInt -> IO () ! {----------------------------------------------------------------------------------------- ! ! -----------------------------------------------------------------------------------------} -- | Create a label (i.e. just text). foreign import ccall "osCreateLabel" createLabel :: WindowHandle -> IO WindowHandle --- 85,94 ---- foreign import ccall osGetControlRect :: WindowHandle -> Ptr CInt -> IO () ! foreign import ccall unsafe "osSetControlEnabled" setControlEnabled :: WindowHandle -> Bool -> IO () ! foreign import ccall unsafe "osGetControlEnabled" getControlEnabled :: WindowHandle -> IO Bool ! ! ----------------------------------------------------------------------------------------- ! -- Label ! ----------------------------------------------------------------------------------------- -- | Create a label (i.e. just text). foreign import ccall "osCreateLabel" createLabel :: WindowHandle -> IO WindowHandle *************** *** 107,113 **** foreign import ccall osSetLabelText :: WindowHandle -> CString -> IO () ! {----------------------------------------------------------------------------------------- ! ! -----------------------------------------------------------------------------------------} -- | Create a button control. An event handler for button clicks can be -- installed with 'registerButtonClick'. --- 111,117 ---- foreign import ccall osSetLabelText :: WindowHandle -> CString -> IO () ! ----------------------------------------------------------------------------------------- ! -- Button ! ----------------------------------------------------------------------------------------- -- | Create a button control. An event handler for button clicks can be -- installed with 'registerButtonClick'. *************** *** 131,137 **** foreign import ccall osSetButtonText :: WindowHandle -> CString -> IO () ! {----------------------------------------------------------------------------------------- ! ! -----------------------------------------------------------------------------------------} -- | Create a check box with a label. -- An event handler for check box clicks can be --- 135,141 ---- foreign import ccall osSetButtonText :: WindowHandle -> CString -> IO () ! ----------------------------------------------------------------------------------------- ! -- CheckBox ! ----------------------------------------------------------------------------------------- -- | Create a check box with a label. -- An event handler for check box clicks can be *************** *** 158,164 **** ! {----------------------------------------------------------------------------------------- ! ! -----------------------------------------------------------------------------------------} -- | Create an edit control. foreign import ccall "osCreateEdit" createEdit :: WindowHandle -> IO WindowHandle --- 162,168 ---- ! ----------------------------------------------------------------------------------------- ! -- EditBox ! ----------------------------------------------------------------------------------------- -- | Create an edit control. foreign import ccall "osCreateEdit" createEdit :: WindowHandle -> IO WindowHandle *************** *** 179,185 **** foreign import ccall osSetEditText :: WindowHandle -> CString -> IO () ! {----------------------------------------------------------------------------------------- ! Radio box ! -----------------------------------------------------------------------------------------} -- | Create a radio box. Takes a parent window handle, whether it is the first -- radio control of its group and a label as its arguments. --- 183,189 ---- foreign import ccall osSetEditText :: WindowHandle -> CString -> IO () ! ----------------------------------------------------------------------------------------- ! -- RadioBox ! ----------------------------------------------------------------------------------------- -- | Create a radio box. Takes a parent window handle, whether it is the first -- radio control of its group and a label as its arguments. *************** *** 208,214 **** ! {----------------------------------------------------------------------------------------- ! List box ! -----------------------------------------------------------------------------------------} -- | Create a new list box. Takes an boolean argument that is 'True' when multiple -- selection are allowed. --- 212,218 ---- ! ----------------------------------------------------------------------------------------- ! -- ListBox ! ----------------------------------------------------------------------------------------- -- | Create a new list box. Takes an boolean argument that is 'True' when multiple -- selection are allowed. *************** *** 265,271 **** foreign import ccall osSetListBoxItemSelectState :: WindowHandle -> CInt -> CBool -> IO () ! {----------------------------------------------------------------------------------------- ! Popup ! -----------------------------------------------------------------------------------------} -- | Create a new popup box. -- An event handler for pop up clicks can be --- 269,275 ---- foreign import ccall osSetListBoxItemSelectState :: WindowHandle -> CInt -> CBool -> IO () ! ----------------------------------------------------------------------------------------- ! -- Popup ! ----------------------------------------------------------------------------------------- -- | Create a new popup box. -- An event handler for pop up clicks can be Index: Window.hs =================================================================== RCS file: /cvsroot/htoolkit/port/src/Port/Window.hs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Window.hs 24 Mar 2003 16:58:33 -0000 1.6 --- Window.hs 26 Mar 2003 15:39:48 -0000 1.7 *************** *** 28,35 **** , setWindowColor , setWindowDomainSize ! , setWindowViewSize, getWindowViewSize ! , setWindowTitle, getWindowTitle ! , setWindowPageSize, getWindowPageSize ! , setWindowLineSize, getWindowLineSize -- * Canvas , getWindowCanvasHandle --- 28,36 ---- , setWindowColor , setWindowDomainSize ! , setWindowViewSize, getWindowViewSize ! , setWindowTitle, getWindowTitle ! , setWindowPageSize, getWindowPageSize ! , setWindowLineSize, getWindowLineSize ! , setWindowEnabled, getWindowEnabled -- * Canvas , getWindowCanvasHandle *************** *** 212,215 **** --- 213,219 ---- osSetWindowLineSize hwnd cw ch foreign import ccall osSetWindowLineSize :: WindowHandle -> CInt -> CInt -> IO () + + foreign import ccall unsafe "osSetWindowEnabled" setWindowEnabled :: WindowHandle -> Bool -> IO () + foreign import ccall unsafe "osGetWindowEnabled" getWindowEnabled :: WindowHandle -> IO Bool -- | Get a canvas handle to draw directly on the window. In general however, one should |
From: <kr_...@us...> - 2003-03-26 15:40:22
|
Update of /cvsroot/htoolkit/gio/src/Graphics/UI/GIO In directory sc8-pr-cvs1:/tmp/cvs-serv16051/gio/src/Graphics/UI/GIO Modified Files: Controls.hs Window.hs Log Message: This commit implements instances for Able type class for all kinds of windows and controls. Index: Controls.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Controls.hs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Controls.hs 25 Mar 2003 23:37:01 -0000 1.4 --- Controls.hs 26 Mar 2003 15:39:46 -0000 1.5 *************** *** 1,8 **** ----------------------------------------------------------------------------------------- {-| Module : Controls ! Copyright : (c) Daan Leijen 2003 License : BSD-style ! Maintainer : da...@cs... Stability : provisional Portability : portable --- 1,8 ---- ----------------------------------------------------------------------------------------- {-| Module : Controls ! Copyright : (c) Krasimir Angelov & Daan Leijen 2003 License : BSD-style ! Maintainer : ka2...@ya... da...@cs... Stability : provisional Portability : portable *************** *** 31,37 **** import Graphics.UI.GIO.Layout ! {-------------------------------------------------------------------- ! Label ! --------------------------------------------------------------------} -- | A simple text label. data Label = Label { lhandle :: !WindowHandle --- 31,37 ---- import Graphics.UI.GIO.Layout ! -------------------------------------------------------------------- ! -- Label ! -------------------------------------------------------------------- -- | A simple text label. data Label = Label { lhandle :: !WindowHandle *************** *** 56,59 **** --- 56,62 ---- frame = newAttr (\w -> Port.getControlFrame (lhandle w)) (\w r -> Port.moveResizeControl (lhandle w) r) + + instance Able Label where + enabled = newAttr (Port.getControlEnabled . lhandle) (Port.setControlEnabled . lhandle) instance Control Label where *************** *** 61,67 **** = stdPack (lparent w) (Port.getLabelRequestSize (lhandle w)) (Port.moveResizeControl (lhandle w)) ! {-------------------------------------------------------------------- ! Button ! --------------------------------------------------------------------} -- | A standard push button. data Button = Button { bhandle :: !WindowHandle --- 64,70 ---- = stdPack (lparent w) (Port.getLabelRequestSize (lhandle w)) (Port.moveResizeControl (lhandle w)) ! -------------------------------------------------------------------- ! -- Button ! -------------------------------------------------------------------- -- | A standard push button. data Button = Button { bhandle :: !WindowHandle *************** *** 88,91 **** --- 91,97 ---- (\b r -> Port.moveResizeControl (bhandle b) r) + instance Able Button where + enabled = newAttr (Port.getControlEnabled . bhandle) (Port.setControlEnabled . bhandle) + instance Control Button where pack b *************** *** 96,102 **** = newControlCommandEvent bhandle ! {-------------------------------------------------------------------- ! Entry ! --------------------------------------------------------------------} -- | A standard text entry control. data Entry = Entry { ehandle :: !WindowHandle --- 102,108 ---- = newControlCommandEvent bhandle ! -------------------------------------------------------------------- ! -- Entry ! -------------------------------------------------------------------- -- | A standard text entry control. data Entry = Entry { ehandle :: !WindowHandle *************** *** 123,126 **** --- 129,135 ---- (\w r -> Port.moveResizeControl (ehandle w) r) + instance Able Entry where + enabled = newAttr (Port.getControlEnabled . ehandle) (Port.setControlEnabled . ehandle) + instance Control Entry where pack w *************** *** 174,183 **** popupCommand w) -- pretend an event - - instance Dimensions Popup where frame = newAttr (\p -> Port.getControlFrame (phandle p)) (\p r -> Port.moveResizeControl (phandle p) r) instance Control Popup where pack p = stdPack (pparent p) (Port.getPopUpRequestSize (phandle p)) (Port.moveResizeControl (phandle p)) --- 183,193 ---- popupCommand w) -- pretend an event instance Dimensions Popup where frame = newAttr (\p -> Port.getControlFrame (phandle p)) (\p r -> Port.moveResizeControl (phandle p) r) + instance Able Popup where + enabled = newAttr (Port.getControlEnabled . phandle) (Port.setControlEnabled . phandle) + instance Control Popup where pack p = stdPack (pparent p) (Port.getPopUpRequestSize (phandle p)) (Port.moveResizeControl (phandle p)) *************** *** 327,330 **** --- 337,343 ---- instance Commanding Check where command = newControlCommandEvent chandle + + instance Able Check where + enabled = newAttr (Port.getControlEnabled . chandle) (Port.setControlEnabled . chandle) instance Control Check where *************** *** 361,364 **** --- 374,380 ---- instance Commanding Radio where command = newControlCommandEvent rhandle + + instance Able Radio where + enabled = newAttr (Port.getControlEnabled . rhandle) (Port.setControlEnabled . rhandle) instance Control Radio where Index: Window.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Window.hs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Window.hs 26 Mar 2003 08:54:55 -0000 1.7 --- Window.hs 26 Mar 2003 15:39:46 -0000 1.8 *************** *** 195,198 **** --- 195,201 ---- hat <- get w hatch withCanvas hcanvas col bgcol hat $ \can -> paintfun can updArea [] + + instance Able Window where + enabled = newAttr (Lib.getWindowEnabled . hwindow) (Lib.setWindowEnabled . hwindow) |
From: <kr_...@us...> - 2003-03-26 15:40:22
|
Update of /cvsroot/htoolkit/port/src/cbits/GTK In directory sc8-pr-cvs1:/tmp/cvs-serv16051/port/src/cbits/GTK Modified Files: Window.c Log Message: This commit implements instances for Able type class for all kinds of windows and controls. Index: Window.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Window.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Window.c 3 Mar 2003 19:03:24 -0000 1.8 --- Window.c 26 Mar 2003 15:39:48 -0000 1.9 *************** *** 149,153 **** break; } ! return gtk_true(); } --- 149,153 ---- break; } ! return gtk_true(); } *************** *** 637,640 **** --- 637,650 ---- } + void osSetWindowEnabled(WindowHandle ctrl, BOOL enabled) + { + gtk_widget_set_sensitive(ctrl,enabled); + } + + BOOL osGetWindowEnabled(WindowHandle ctrl) + { + return GTK_WIDGET_SENSITIVE(ctrl); + } + CanvasHandle osGetWindowCanvas(WindowHandle window) { *************** *** 711,714 **** --- 721,734 ---- res[2] = requisition.width; res[3] = requisition.height; + } + + void osSetControlEnabled(WindowHandle ctrl, BOOL enabled) + { + gtk_widget_set_sensitive(ctrl,enabled); + } + + BOOL osGetControlEnabled(WindowHandle ctrl) + { + return GTK_WIDGET_SENSITIVE(ctrl); } |
From: <kr_...@us...> - 2003-03-26 15:39:53
|
Update of /cvsroot/htoolkit/port/src/include In directory sc8-pr-cvs1:/tmp/cvs-serv16051/port/src/include Modified Files: Window.h Log Message: This commit implements instances for Able type class for all kinds of windows and controls. Index: Window.h =================================================================== RCS file: /cvsroot/htoolkit/port/src/include/Window.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Window.h 10 Feb 2003 22:42:11 -0000 1.3 --- Window.h 26 Mar 2003 15:39:49 -0000 1.4 *************** *** 58,61 **** --- 58,63 ---- void osMoveResizeControl(WindowHandle ctrl, int x, int y, int w, int h); void osGetControlRect(WindowHandle ctrl, int *res); + void osSetControlEnabled(WindowHandle ctrl, BOOL enabled); + BOOL osGetControlEnabled(WindowHandle ctrl); void osInvalidateWindow(WindowHandle window); void osInvalidateWindowRect(WindowHandle window, int left, int top, int right, int bottom); *************** *** 78,81 **** --- 80,85 ---- BOOL osDismissWindow(WindowHandle window); void osDestroyWindow(WindowHandle window); + void osSetWindowEnabled(WindowHandle ctrl, BOOL enabled); + BOOL osGetWindowEnabled(WindowHandle ctrl); CanvasHandle osGetWindowCanvas(WindowHandle window); void osReleaseWindowCanvas(WindowHandle window,CanvasHandle canvas); |
From: <kr_...@us...> - 2003-03-26 15:39:52
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32 In directory sc8-pr-cvs1:/tmp/cvs-serv16051/port/src/cbits/Win32 Modified Files: Util.c Window.c Log Message: This commit implements instances for Able type class for all kinds of windows and controls. Index: Util.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Util.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Util.c 26 Mar 2003 08:45:56 -0000 1.8 --- Util.c 26 Mar 2003 15:39:48 -0000 1.9 *************** *** 3,6 **** --- 3,7 ---- #include "RtsAPI.h" #include "Types.h" + #include "Window.h" #include "Handlers_stub.h" *************** *** 161,164 **** --- 162,167 ---- WindowHandle checkWindow(HWND hWnd, char *className) { + HWND hParent; + if (!hWnd) { *************** *** 168,171 **** --- 171,180 ---- SendMessage(hWnd, WM_SETFONT, (WPARAM)ghControlFont, MAKELPARAM (TRUE,0)); + + hParent = GetParent(hWnd); + + if (hParent && !osGetWindowEnabled(hParent)) + EnableWindow(hWnd, FALSE); + return hWnd; } Index: Window.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Window.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Window.c 26 Mar 2003 00:41:46 -0000 1.11 --- Window.c 26 Mar 2003 15:39:48 -0000 1.12 *************** *** 18,21 **** --- 18,25 ---- int hatchStyle; BitmapHandle patBmp; + + BOOL enabled; + int disabledCtrlsCount; + HWND *disabledCtrls; } WindowData; *************** *** 117,135 **** while (hCtrl) { ! GetWindowRect(hCtrl,&rect); ! upLeft.x = rect.left; ! upLeft.y = rect.top; ! ScreenToClient(hWnd,&upLeft); ! downRight.x = rect.right; ! downRight.y = rect.bottom; ! ScreenToClient(hWnd,&downRight); ! if (pos->x >= upLeft.x && ! pos->x <= downRight.x && ! pos->y >= upLeft.y && ! pos->y <= downRight.y) ! { ! return hCtrl; ! } hCtrl = GetNextWindow(hCtrl,GW_HWNDNEXT); --- 121,142 ---- while (hCtrl) { ! if (IsWindowEnabled(hCtrl)) ! { ! GetWindowRect(hCtrl,&rect); ! upLeft.x = rect.left; ! upLeft.y = rect.top; ! ScreenToClient(hWnd,&upLeft); ! downRight.x = rect.right; ! downRight.y = rect.bottom; ! ScreenToClient(hWnd,&downRight); ! if (pos->x >= upLeft.x && ! pos->x <= downRight.x && ! pos->y >= upLeft.y && ! pos->y <= downRight.y) ! { ! return hCtrl; ! } ! } hCtrl = GetNextWindow(hCtrl,GW_HWNDNEXT); *************** *** 166,169 **** --- 173,179 ---- pData->hBackBrush = CreateSolidBrush (pData->backColor); pData->nWindowKind = ((int) lpcs->lpCreateParams); + pData->enabled = TRUE; + pData->disabledCtrlsCount = 0; + pData->disabledCtrls = NULL; SetWindowLong(hWnd,GWL_USERDATA,(LONG) pData); *************** *** 423,426 **** --- 433,437 ---- break; case WM_CAPTURECHANGED: + if (pData->enabled) { int cx = GET_X_LPARAM(lParam); *************** *** 441,444 **** --- 452,456 ---- break; case WM_MOUSEMOVE: + if (pData->enabled) { int cx = GET_X_LPARAM(lParam); *************** *** 473,476 **** --- 485,489 ---- break; case WM_LBUTTONDOWN: + if (pData->enabled) { POINT pos; *************** *** 497,500 **** --- 510,514 ---- break; case WM_LBUTTONDBLCLK: + if (pData->enabled) { POINT pos; *************** *** 517,520 **** --- 531,535 ---- break; case WM_LBUTTONUP: + if (pData->enabled) { POINT pos; *************** *** 557,560 **** --- 572,576 ---- break; case WM_RBUTTONDOWN: + if (pData->enabled) { POINT pos; *************** *** 579,582 **** --- 595,599 ---- break; case WM_RBUTTONUP: + if (pData->enabled) { POINT pos; *************** *** 600,603 **** --- 617,621 ---- case WM_SYSKEYDOWN: case WM_KEYDOWN: + if (pData->enabled) { int c = CheckVirtualKeyCode ((int) wParam); *************** *** 628,631 **** --- 646,650 ---- case WM_SYSCHAR: case WM_CHAR: + if (pData->enabled) { if (GetKeyState(VK_MENU) < 0) *************** *** 653,660 **** case WM_SYSKEYUP: case WM_KEYUP: ! if (gInKey) ! handleWindowKeyboard(hWnd, evKeyUp, gCurChar, GetModifiers()); ! gInKey = FALSE; ! gCurChar = 0; break; case WM_CTLCOLORSTATIC: --- 672,682 ---- case WM_SYSKEYUP: case WM_KEYUP: ! if (pData->enabled) ! { ! if (gInKey) ! handleWindowKeyboard(hWnd, evKeyUp, gCurChar, GetModifiers()); ! gInKey = FALSE; ! gCurChar = 0; ! } break; case WM_CTLCOLORSTATIC: *************** *** 1017,1020 **** --- 1039,1102 ---- } + void osSetWindowEnabled(WindowHandle window, BOOL enabled) + { + int i; + HWND hCtrl; + WindowData *pData; + + pData = (WindowData *) GetWindowLong(window,GWL_USERDATA); + + if (pData->enabled != enabled) + { + pData->enabled = enabled; + + if (enabled) + { + hCtrl = GetTopWindow(window); + while (hCtrl) + { + if (pData->disabledCtrlsCount == 0) + EnableWindow(hCtrl, TRUE); + else + { + pData->disabledCtrls[pData->disabledCtrlsCount] = hCtrl; + for (i = 0; pData->disabledCtrls[i] != hCtrl; i++); + EnableWindow(hCtrl, i >= pData->disabledCtrlsCount); + } + + hCtrl = GetNextWindow(hCtrl,GW_HWNDNEXT); + } + free(pData->disabledCtrls); + pData->disabledCtrls = NULL; + pData->disabledCtrlsCount = 0; + } + else + { + hCtrl = GetTopWindow(window); + while (hCtrl) + { + if (!IsWindowEnabled(hCtrl)) + { + if (pData->disabledCtrlsCount % 8 == 0) + { + pData->disabledCtrls = realloc(pData->disabledCtrls, (pData->disabledCtrlsCount+9)*sizeof(HWND)); + } + + pData->disabledCtrls[pData->disabledCtrlsCount++] = hCtrl; + } + + EnableWindow(hCtrl, FALSE); + hCtrl = GetNextWindow(hCtrl,GW_HWNDNEXT); + } + } + } + } + + BOOL osGetWindowEnabled(WindowHandle window) + { + WindowData *pData = (WindowData *) GetWindowLong(window,GWL_USERDATA); + return pData->enabled; + } + CanvasHandle osGetWindowCanvas(WindowHandle window) { *************** *** 1090,1093 **** --- 1172,1212 ---- res[2] = rect.right+pData->Origin.x; res[3] = rect.bottom+pData->Origin.y; + } + + void osSetControlEnabled(WindowHandle ctrl, BOOL enabled) + { + int i; + WindowData *pData = (WindowData *) GetWindowLong(GetParent(ctrl),GWL_USERDATA); + + if (pData->enabled) + EnableWindow(ctrl, enabled); + else + { + if (enabled) + { + pData->disabledCtrls[pData->disabledCtrlsCount] = ctrl; + for (i = 0; pData->disabledCtrls[i] != ctrl; i++); + + if (i < pData->disabledCtrlsCount) + { + pData->disabledCtrlsCount--; + memmove(pData->disabledCtrls+i, pData->disabledCtrls+i+1, (pData->disabledCtrlsCount-i)*sizeof(HWND)); + } + } + else + { + if (pData->disabledCtrlsCount % 8 == 0) + { + pData->disabledCtrls = realloc(pData->disabledCtrls, (pData->disabledCtrlsCount+9)*sizeof(HWND)); + } + + pData->disabledCtrls[pData->disabledCtrlsCount++] = ctrl; + } + } + } + + BOOL osGetControlEnabled(WindowHandle ctrl) + { + return IsWindowEnabled(ctrl); } |
From: <kr_...@us...> - 2003-03-26 15:39:50
|
Update of /cvsroot/htoolkit/gio/src/examples/simple In directory sc8-pr-cvs1:/tmp/cvs-serv16051/gio/src/examples/simple Added Files: Able.hs Log Message: This commit implements instances for Able type class for all kinds of windows and controls. --- NEW FILE: Able.hs --- module Main where import Graphics.UI.GIO main = start "Able" SDI [] demo demo = do w1 <- window [title =: "Slave", view =: sz 200 100, domain =: sz 200 80] ent <- entry [text =: "Test!"] w1 btn <- button [text =: "Button"] w1 set w1 [layout =: (hfix 80 ent <<< btn)] w2 <- window [title =: "Master", view =: sz 200 80, domain =: sz 200 80] bctrl <- button [] w2 bwnd <- button [] w2 set w2 [layout =: (hfill bctrl ^^^ hfill bwnd)] enable "Control" bctrl ent enable "Window" bwnd w1 return () where enable title b w = do set w [enabled =: True] set b [text =: "Disable " ++ title, on command =: disable title b w] disable title b w = do set w [enabled =: False] set b [text =: "Enable " ++ title, on command =: enable title b w] |
From: <kr_...@us...> - 2003-03-26 13:03:52
|
Update of /cvsroot/htoolkit/port/src/Port In directory sc8-pr-cvs1:/tmp/cvs-serv32752/port/src/Port Modified Files: Menu.hs Log Message: Additional functions for menu item state Index: Menu.hs =================================================================== RCS file: /cvsroot/htoolkit/port/src/Port/Menu.hs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Menu.hs 31 Jan 2003 01:01:42 -0000 1.4 --- Menu.hs 26 Mar 2003 13:03:49 -0000 1.5 *************** *** 21,29 **** -- * Menu items , addMenuItem ! , addMenuSeparatorItem ! , setMenuItemState ! , setMenuItemLabel , addMenuCheckItem ! , setCheckMenuItemState ) where --- 21,29 ---- -- * Menu items , addMenuItem ! , addMenuSeparatorItem , addMenuCheckItem ! , setMenuItemEnabled, getMenuItemEnabled ! , setMenuItemLabel ! , setMenuItemChecked, getMenuItemChecked ) where *************** *** 86,97 **** -- | Enable or disable a menu item. ! setMenuItemState :: MenuHandle -> MenuHandle -> Bool -> IO () ! setMenuItemState parent item enable ! = osSetMenuItemSelectState parent item (toCBool enable) ! foreign import ccall osSetMenuItemSelectState :: MenuHandle -> MenuHandle -> CBool -> IO () ! -- | Mark or unmark a checkable menu item. ! setCheckMenuItemState :: MenuHandle -> MenuHandle -> Bool -> IO () ! setCheckMenuItemState parent item enable ! = osSetCheckMenuItemState parent item (toCBool enable) ! foreign import ccall osSetCheckMenuItemState :: MenuHandle -> MenuHandle -> CBool -> IO () --- 86,97 ---- -- | Enable or disable a menu item. ! foreign import ccall unsafe "osSetMenuItemEnabled" setMenuItemEnabled :: MenuHandle -> MenuHandle -> Bool -> IO () ! -- | returns True if the menu item is enabled. ! foreign import ccall unsafe "osGetMenuItemEnabled" getMenuItemEnabled :: MenuHandle -> MenuHandle -> IO Bool ! ! -- | Check or uncheck a checkable menu item. ! foreign import ccall "osSetMenuItemChecked" setMenuItemChecked :: MenuHandle -> MenuHandle -> Bool -> IO () ! ! -- | returns True if the menu item is checked. ! foreign import ccall "osGetMenuItemChecked" getMenuItemChecked :: MenuHandle -> MenuHandle -> IO Bool |
From: <kr_...@us...> - 2003-03-26 12:59:28
|
Update of /cvsroot/htoolkit/gio/src/Graphics/UI/GIO In directory sc8-pr-cvs1:/tmp/cvs-serv30647/gio/src/Graphics/UI/GIO Modified Files: Menu.hs Log Message: Additional functions for menu item state Index: Menu.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Menu.hs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Menu.hs 25 Mar 2003 23:37:03 -0000 1.3 --- Menu.hs 26 Mar 2003 12:59:24 -0000 1.4 *************** *** 77,81 **** , mtext :: String , vkey :: Var Key - , venabled :: Var Bool } --- 77,80 ---- *************** *** 85,91 **** = do mitem <- do hitem <- Lib.addMenuItem (hmenu menu) Lib.KeyNull title Lib.registerWindowMenu (hwindow menu) hitem - venabled <- newVar True vkey <- newVar Lib.KeyNull ! return (MenuItem hitem menu title vkey venabled) set mitem props return mitem --- 84,89 ---- = do mitem <- do hitem <- Lib.addMenuItem (hmenu menu) Lib.KeyNull title Lib.registerWindowMenu (hwindow menu) hitem vkey <- newVar Lib.KeyNull ! return (MenuItem hitem menu title vkey) set mitem props return mitem *************** *** 94,100 **** instance Able MenuItem where ! enabled = newAttr (\w -> getVar (venabled w)) ! (\w b -> do Lib.setMenuItemState (hmenu (parent w)) (hitem w) b ! setVar (venabled w) b) instance Commanding MenuItem where --- 92,97 ---- instance Able MenuItem where ! enabled = newAttr (\w -> Lib.getMenuItemEnabled (hmenu (parent w)) (hitem w)) ! (\w -> Lib.setMenuItemEnabled (hmenu (parent w)) (hitem w)) instance Commanding MenuItem where |