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 |