diff --git a/changes.txt b/changes.txt index bdee9194..6ed97635 100644 --- a/changes.txt +++ b/changes.txt @@ -1,9 +1,23 @@ ---------------------------------------------------------------------- Copyright (c) 2003, 2004, 2005 Daan Leijen. + Copyright (c) 2006, 2007, 2008 Jeremy O'Donoghue, + Eric Kow, + Kido Takahiro (Shelarcy), + Mads Lindstroem See license.txt for details. ---------------------------------------------------------------------- +Version 0.10.5 +-------------- + +Backward compatible additions +- Added support for using XRC resource files to load most controls + and menus attached to frames. +- Added sample file showing how to use XRC support to attach command + handlers to menu items +- Added sample file showing how to use properties with many controls. + Version 0.10.4 ------------- Non backward compatible changes: @@ -15,7 +29,7 @@ Non backward compatible changes: 2.8 documentation for wxcore functions - Added "TopLevelWindow", which mainly removes some functionality from "Frame" -- Changed "--with-stc" argument to "--with-cotrib" +- Changed "--with-stc" argument to "--with-contrib" - Removed "Wave" type synonym Backward compatible additions: diff --git a/samples/test/XRCControls/XRCControls_Wx.hs b/samples/test/XRCControls/XRCControls_Wx.hs new file mode 100644 index 00000000..357d2b9b --- /dev/null +++ b/samples/test/XRCControls/XRCControls_Wx.hs @@ -0,0 +1,68 @@ +{-------------------------------------------------------------------------------- + Copyright (c) Daan Leijen 2003 + Copyright (c) Jeremy O'Donoghue 2008 + wxWindows License. + + Demonstrates: + - many different kind of controls + - message logging. +--------------------------------------------------------------------------------} +module Main where + +import Graphics.UI.WX +import Graphics.UI.WXCore + +main :: IO () +main + = start gui + +gui :: IO () +gui = + do -- main gui elements: frame, panel, text control, and the notebook + f <- frameLoadRes "controls.xrc" "f" [] + + -- use text control as logger + textlog <- textCtrlRes f "textlog" [] + textCtrlMakeLogActiveTarget textlog + logMessage "logging enabled" + + -- button page + ok <- buttonRes f "ok" [on command := logMessage "ok button pressed"] + quit <- buttonRes f "ok" [on command := close f] + + -- radio box page + r1 <- radioBoxRes f "r1" [on select ::= logSelect] + r2 <- radioBoxRes f "r2" [on select ::= logSelect] + rb1 <- buttonRes f "rb1" [on command ::= onEnable r1] + + -- choice page + c1 <- choiceRes f "c1" [on select ::= logSelect] + c2 <- choiceRes f "c2" [on select ::= logSelect] + cb1 <- buttonRes f "cb1" [on command ::= onEnable c1] + + -- list box page + sl1 <- singleListBoxRes f "sl1" [on select ::= logSelect] + sl2 <- singleListBoxRes f "sl2" [on select ::= logSelect] + sc1 <- checkBoxRes f "sc1" [on command ::= onEnable sl1] + + -- slider/gauge page + s <- sliderRes f "s" [] + g <- gaugeRes f "g" [] + set s [on command := do { i <- get s selection; set g [selection := i] } ] + + -- specify layout + set f [ clientSize := sz 400 300 ] + windowShow f + return () + + where + -- logSelect :: (Selection w, Items w String) => w -> IO () + logSelect w + = do i <- get w selection + s <- get w (item i) + logMessage ("selected index: " ++ show i ++ ": " ++ s) + + onEnable w b + = do set w [enabled :~ not] + enable <- get w enabled + set b [text := (if enable then "disable" else "enable")] \ No newline at end of file diff --git a/samples/test/XRCControls/XRCMenu.hs b/samples/test/XRCControls/XRCMenu.hs new file mode 100644 index 00000000..f5c4917f --- /dev/null +++ b/samples/test/XRCControls/XRCMenu.hs @@ -0,0 +1,34 @@ +-- Menu from XRC demo +module Main where + +import Graphics.UI.WXCore +import Graphics.UI.WX + +main = start gui + +gui :: IO () +gui = + do + f <- frameLoadRes "xrcmenu.xrc" "menuTest" [] + + -- Attach event handlers to the menu items loaded above. + menuItemOnCommandRes f "new" (onFileNew f) + menuItemOnCommandRes f "open" (onFileOpen f) + + set f [clientSize := sz 400 300] + windowShow f + return () + +onFileNew w = + do + dlg <- dialog w [text := "File New"] + ok <- button dlg [text := "Ok"] + _ <- showModal dlg (\onPress -> set ok [on command := onPress Nothing]) + return () + +onFileOpen w = + do + dlg <- dialog w [text := "File Open"] + ok <- button dlg [text := "Ok"] + _ <- showModal dlg (\onPress -> set ok [on command := onPress Nothing]) + return () \ No newline at end of file diff --git a/samples/test/XRCControls/controls.xrc b/samples/test/XRCControls/controls.xrc new file mode 100644 index 00000000..c0007024 --- /dev/null +++ b/samples/test/XRCControls/controls.xrc @@ -0,0 +1,312 @@ + + + + + 528,367 + Controls + + wxVERTICAL + + + wxEXPAND | wxALL + 1 + + + + 0 + + + + wxHORIZONTAL + + + wxEXPAND + 5 + 0,0 + + + + wxALIGN_CENTER|wxALL + 5 + + + 1 + + + + + wxALIGN_CENTER|wxALL + 5 + + + 0 + + + + + wxEXPAND + 5 + 0,0 + + + + + + + 0 + + + radio group 2 + + wxVERTICAL + + + wxALL + 10 + + + 0 + + + + + wxEXPAND + 10 + 0,0 + + + + wxEXPAND + 5 + + wxHORIZONTAL + + + wxALIGN_CENTER_VERTICAL|wxALL + 10 + + + + 0 + + first + second + third + + 1 + + + + + wxEXPAND + 5 + 0,0 + + + + wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL + 10 + + + + 2 + + first + second + third + + 1 + + + + + + + wxEXPAND + 5 + 0,0 + + + + + + + 1 + + + + wxVERTICAL + + + wxALL + 5 + + + 0 + + + + + wxEXPAND + 5 + 0,0 + + + + wxEXPAND + 5 + + wxHORIZONTAL + + + wxALL + 5 + + unsorted choices + 0 + + mies + noot + aap + + + + + + + 5 + 0,0 + + + + wxALL + 5 + + + + + + + wxALL|wxFIXED_MINSIZE + 5 + + sorted choices + 1 + + aap + mies + noot + + + + + + + + + + + 0 + + + + wxVERTICAL + + + wxALL + 10 + + + 1 + + + + + wxEXPAND + 5 + 0,0 + + + + wxEXPAND + 5 + + wxHORIZONTAL + + + wxALIGN_CENTER_VERTICAL|wxALL + 5 + + + + mies + noot + aap + + + + + + wxALIGN_CENTER_VERTICAL|wxALL + 5 + + + + mies + noot + aap + + + + + + + + + + + 0 + + + + wxVERTICAL + + + wxALL|wxEXPAND + 10 + + + 50 + 1 + 100 + + + + + wxALL|wxEXPAND + 10 + + + 100 + 50 + + + + + + + + + + wxALL|wxEXPAND + 1 + + + 0 + + 0 + + + + + diff --git a/samples/test/XRCControls/xrcmenu.xrc b/samples/test/XRCControls/xrcmenu.xrc new file mode 100644 index 00000000..2bec3e23 --- /dev/null +++ b/samples/test/XRCControls/xrcmenu.xrc @@ -0,0 +1,52 @@ + + + + + wxFRAME_EX_METAL + 500,300 + WxHaskell Menu Test + + + + + + + Open a thrilling new file + + + + Open a file + + + + + Terminate with extreme prejudice + + + + + + + This might do something in a real application + 0 + + + + + + + Credits for this fine and functional sample + + + + + + + 0 + + + + 1 + + + diff --git a/wx/src/Graphics/UI/WX/Controls.hs b/wx/src/Graphics/UI/WX/Controls.hs index a9fc3093..10612a8a 100644 --- a/wx/src/Graphics/UI/WX/Controls.hs +++ b/wx/src/Graphics/UI/WX/Controls.hs @@ -30,33 +30,34 @@ module Graphics.UI.WX.Controls , focusOn -- * Controls -- ** Button - , Button, button, buttonEx, smallButton - , BitmapButton, bitmapButton + , Button, button, buttonEx, smallButton, buttonRes + , BitmapButton, bitmapButton, bitmapButtonRes -- ** Text entry , TextCtrl, entry, textEntry, textCtrl, textCtrlRich, textCtrlEx - , processEnter, processTab + , textCtrlRes, processEnter, processTab -- ** CheckBox - , CheckBox, checkBox + , CheckBox, checkBox, checkBoxRes -- ** Choice - , Choice, choice, choiceEx + , Choice, choice, choiceEx, choiceRes -- ** ComboBox - , ComboBox, comboBox, comboBoxEx + , ComboBox, comboBox, comboBoxEx, comboBoxRes -- ** ListBox - , ListBox, SingleListBox, MultiListBox, singleListBox, multiListBox + , ListBox, SingleListBox, MultiListBox + , singleListBox, singleListBoxRes, multiListBox, multiListBoxRes -- ** RadioBox - , RadioBox, radioBox + , RadioBox, radioBox, radioBoxRes -- ** Spin Control - , SpinCtrl, spinCtrl + , SpinCtrl, spinCtrl, spinCtrlRes -- ** Slider - , Slider, hslider, vslider, sliderEx + , Slider, hslider, vslider, sliderEx, sliderRes -- ** Gauge - , Gauge, hgauge, vgauge, gaugeEx + , Gauge, hgauge, vgauge, gaugeEx, gaugeRes -- ** Tree control - , TreeCtrl, treeCtrl, treeCtrlEx, treeEvent + , TreeCtrl, treeCtrl, treeCtrlEx, treeEvent, treeCtrlRes -- ** List control - , ListCtrl, listCtrl, listCtrlEx, listEvent, columns + , ListCtrl, listCtrl, listCtrlEx, listCtrlRes, listEvent, columns -- ** Static text - , StaticText, staticText + , StaticText, staticText, staticTextRes -- ** SplitterWindow , SplitterWindow, splitterWindow -- ** ImageList @@ -182,6 +183,18 @@ buttonEx parent stl props set b props return b +-- | Complete the construction of a push button instance which has been loaded +-- from a resource file. +-- +-- * Instances: 'Commanding' -- 'Textual', 'Literate', 'Dimensions', 'Colored', 'Visible', 'Child', +-- 'Able', 'Tipped', 'Identity', 'Styled', 'Reactive', 'Paint'. +-- +buttonRes :: Window a -> String -> [Prop (Button ())] -> IO (Button ()) +buttonRes parent name props = + do b <- xmlResourceGetButton parent name + set b props + return b + instance Commanding (Button a) where command = newEvent "command" buttonGetOnCommand buttonOnCommand @@ -199,6 +212,18 @@ bitmapButton parent props set bb props return bb +-- | Complete the construction of a bitmap button instance which has been loaded +-- from a resource file. +-- +-- * Instances: 'Commanding' -- 'Textual', 'Literate', 'Dimensions', 'Colored', 'Visible', 'Child', +-- 'Able', 'Tipped', 'Identity', 'Styled', 'Reactive', 'Paint'. +-- +bitmapButtonRes :: Window a -> String -> [Prop (BitmapButton ())] -> IO (BitmapButton ()) +bitmapButtonRes parent name props = + do b <- xmlResourceGetBitmapButton parent name + set b props + return b + instance Pictured (BitmapButton a) where picture = writeAttr "picture" setter @@ -351,6 +376,17 @@ textCtrlEx parent stl props set e props return e +-- | Complete the construction of a text control instance which has been loaded +-- from a resource file. +-- +-- * Instances: 'Wrap', 'Aligned', 'Commanding' -- 'Textual', 'Literate', 'Dimensions', 'Colored', 'Visible', 'Child', +-- 'Able', 'Tipped', 'Identity', 'Styled', 'Reactive', 'Paint'. +-- +textCtrlRes :: Window a -> String -> [Prop (TextCtrl ())] -> IO (TextCtrl ()) +textCtrlRes parent name props = + do t <- xmlResourceGetTextCtrl parent name + set t props + return t instance Commanding (TextCtrl a) where command = newEvent "command" textCtrlGetOnTextEnter textCtrlOnTextEnter @@ -397,6 +433,13 @@ staticText parent props set t props return t +-- | Complete the construction of a static text label instance which has been loaded +-- from a resource file. +staticTextRes :: Window a -> String -> [Prop (StaticText ())] -> IO (StaticText ()) +staticTextRes parent name props = + do t <- xmlResourceGetStaticText parent name + set t props + return t {-------------------------------------------------------------------------------- Check box @@ -425,6 +468,18 @@ checkBox parent props set c props return c +-- | Complete the construction of a check box instance which has been loaded +-- from a resource file. +-- +-- * Instances: 'Commanding','Checkable' -- 'Textual', 'Literate', 'Dimensions', 'Colored', 'Visible', 'Child', +-- 'Able', 'Tipped', 'Identity', 'Styled', 'Reactive', 'Paint'. +-- +checkBoxRes :: Window a -> String -> [Prop (CheckBox ())] -> IO (CheckBox ()) +checkBoxRes parent name props = + do c <- xmlResourceGetCheckBox parent name + set c props + return c + {-------------------------------------------------------------------------------- Choice --------------------------------------------------------------------------------} @@ -494,6 +549,14 @@ choiceEx parent flags props set c props return c +-- | Complete the construction of a choice instance which has been loaded +-- from a resource file. +choiceRes :: Window a -> String -> [Prop (Choice ())] -> IO (Choice ()) +choiceRes parent name props = + do c <- xmlResourceGetChoice parent name + set c props + return c + {-------------------------------------------------------------------------------- ComboBox --------------------------------------------------------------------------------} @@ -557,6 +620,13 @@ comboBoxEx parent flags props set cb props return cb +-- | Complete the construction of a combo box instance which has been loaded +-- from a resource file. +comboBoxRes :: Window a -> String -> [Prop (ComboBox ())] -> IO (ComboBox ()) +comboBoxRes parent name props = + do c <- xmlResourceGetComboBox parent name + set c props + return c {-------------------------------------------------------------------------------- ListBox @@ -635,6 +705,15 @@ singleListBox parent props set sl props return sl +-- | Complete the construction of a single list box instance which has been loaded +-- from a resource file. +singleListBoxRes :: Window a -> String -> [Prop (SingleListBox ())] -> IO (SingleListBox ()) +singleListBoxRes parent name props = + do l <- xmlResourceGetListBox parent name + let sl = (objectCast l :: SingleListBox()) + set sl props + return sl + -- | Create a multi selection list box. ---- -- * Instances: 'Sorted', 'Selecting','Selections','Items' -- 'Textual', 'Literate', 'Dimensions', 'Colored', 'Visible', 'Child', @@ -650,6 +729,15 @@ multiListBox parent props set ml props return ml +-- | Complete the construction of a single list box instance which has been loaded +-- from a resource file. +multiListBoxRes :: Window a -> String -> [Prop (MultiListBox ())] -> IO (MultiListBox ()) +multiListBoxRes parent name props = + do l <- xmlResourceGetListBox parent name + let ml = (objectCast l :: MultiListBox()) + set ml props + return ml + {-------------------------------------------------------------------------------- RadioBox --------------------------------------------------------------------------------} @@ -690,6 +778,14 @@ radioBox parent direction labels props set r props return r +-- | Complete the construction of a radio box instance which has been loaded +-- from a resource file. +radioBoxRes :: Window a -> String -> [Prop (RadioBox ())] -> IO (RadioBox ()) +radioBoxRes parent name props = + do rb <- xmlResourceGetRadioBox parent name + set rb props + return rb + {-------------------------------------------------------------------------------- Gauge --------------------------------------------------------------------------------} @@ -725,6 +821,13 @@ gaugeEx parent range style props set g props return g +-- | Complete the construction of a gauge instance which has been loaded +-- from a resource file. +gaugeRes :: Window a -> String -> [Prop (Gauge ())] -> IO (Gauge ()) +gaugeRes parent name props = + do g <- xmlResourceGetGauge parent name + set g props + return g instance Selection (Gauge a) where selection @@ -779,6 +882,14 @@ sliderEx parent min max style props set s props return s +-- | Complete the construction of a slider instance which has been loaded +-- from a resource file. +sliderRes :: Window a -> String -> [Prop (Slider ())] -> IO (Slider ()) +sliderRes parent name props = + do s <- xmlResourceGetSlider parent name + set s props + return s + instance Selection (Slider a) where selection = newAttr "selection" getter setter @@ -813,6 +924,15 @@ spinCtrl parent lo hi props set sc props return sc +-- | Complete the construction of a spin control instance which has been loaded +-- from a resource file. +spinCtrlRes :: Window a -> String -> [Prop (SpinCtrl ())] -> IO (SpinCtrl ()) +spinCtrlRes parent name props = + do s <- xmlResourceGetSpinCtrl parent name + set s props + return s + + instance Selection (SpinCtrl a) where selection = newAttr "selection" getter setter @@ -868,6 +988,14 @@ treeCtrlEx parent style props set t props return t +-- | Complete the construction of a tree control instance which has been loaded +-- from a resource file. +treeCtrlRes :: Window a -> String -> [Prop (TreeCtrl ())] -> IO (TreeCtrl ()) +treeCtrlRes parent name props = + do t <- xmlResourceGetTreeCtrl parent name + set t props + return t + {-------------------------------------------------------------------------------- ListCtrl --------------------------------------------------------------------------------} @@ -973,6 +1101,14 @@ listCtrlEx parent style props set l props return l +-- | Complete the construction of a list control instance which has been loaded +-- from a resource file. +listCtrlRes :: Window a -> String -> [Prop (ListCtrl ())] -> IO (ListCtrl ()) +listCtrlRes parent name props = + do l <- xmlResourceGetListCtrl parent name + set l props + return l + {-------------------------------------------------------------------------------- SplitterWindow --------------------------------------------------------------------------------} diff --git a/wx/src/Graphics/UI/WX/Frame.hs b/wx/src/Graphics/UI/WX/Frame.hs index ee623aee..83ceef7d 100644 --- a/wx/src/Graphics/UI/WX/Frame.hs +++ b/wx/src/Graphics/UI/WX/Frame.hs @@ -22,6 +22,7 @@ module Graphics.UI.WX.Frame ( -- * Frames Frame, frame, frameFixed, frameTool, frameEx + , frameLoadRes, frameLoadChildRes , initialFrame -- * MDI Frames , MDIParentFrame, MDIChildFrame @@ -76,6 +77,21 @@ frameEx style props parent set f props return f +-- | Complete the construction of a top level frame which has been loaded +-- from a resource file. +frameLoadRes :: FilePath -> String -> [Prop (Frame ())] -> IO (Frame ()) +frameLoadRes rc name props = + frameLoadChildRes objectNull rc name props + +-- | Complete the construction of a frame whcih is the child of some +-- existing parent window. +frameLoadChildRes :: Window a -> FilePath -> String -> [Prop (Frame ())] -> IO (Frame ()) +frameLoadChildRes parent rc name props = + do res <- xmlResourceCreateFromFile rc wxXRC_USE_LOCALE + f <- xmlResourceLoadFrame res parent name + set f props + return f + -- | initial Frame flags initialFrame :: (Id -> Rect -> String -> [Prop (Window w)] -> Style -> a) -> [Prop (Window w)] -> Style -> a initialFrame cont diff --git a/wx/src/Graphics/UI/WX/Menu.hs b/wx/src/Graphics/UI/WX/Menu.hs index ede4d7d5..eef725c3 100644 --- a/wx/src/Graphics/UI/WX/Menu.hs +++ b/wx/src/Graphics/UI/WX/Menu.hs @@ -36,11 +36,12 @@ module Graphics.UI.WX.Menu ( -- * Menu -- ** Menu containers MenuBar, Menu, menuBar, menuPopup, menuPane, menuHelp + , menuRes, menuBarLoadRes -- ** Menu events , menu, menuId -- ** Menu items , MenuItem, menuItem, menuQuit, menuAbout, menuItemEx - , menuLine, menuSub, menuRadioItem + , menuItemOnCommandRes, menuLine, menuSub, menuRadioItem -- * Tool bar , ToolBar, toolBar, toolBarEx , ToolBarItem, toolMenu, toolItem, toolControl, tool @@ -95,6 +96,15 @@ menuBar menuSetTitle menu "" menuBarAppend mb menu title +-- | Retrieve a menu bar instance which has been constructed by loading +-- a resource file for a given top level window. +menuBarLoadRes :: Window a -> FilePath -> String -> IO (MenuBar ()) +menuBarLoadRes parent rc name = + do + res <- xmlResourceCreateFromFile rc wxXRC_USE_LOCALE + m <- xmlResourceLoadMenuBar res parent name + return m + -- | Show a popup menu for a certain window. menuPopup :: Menu b -> Point -> Window a -> IO () menuPopup menu pt parent @@ -125,6 +135,19 @@ menuHelp :: [Prop (Menu ())] -> IO (Menu ()) menuHelp props = menuPane ([text := "&Help"] ++ props) +-- | Complete the construction of a menu which has been loaded +-- from a resource file. +-- | Get a menu by name from a menu loaded from a resource file, +-- given the frame which owns the menu. You +-- can directly set properties on the item as part of the call, which +-- enables simple connection of event handlers (e.g. on command). +menuRes :: Window a -> String -> [Prop (Menu ())] -> IO (Menu ()) +menuRes parent menu_name props = + do + menu <- xmlResourceGetMenu parent menu_name + set menu props + return menu + instance Textual (Menu a) where text = newAttr "text" menuGetTitle menuSetTitle @@ -145,7 +168,7 @@ menuSub parent menu props menuSetTitle menu "" -- remove title on submenus menuAppendSub parent id label menu "" menuPropagateEvtHandlers menu -- move the evtHandlers to the parent - item <- menuFindItem parent id nullPtr + item <- menuFindItem parent id set item props return item @@ -240,7 +263,7 @@ menuItemEx menu id label kind props = do if (kind == wxITEM_RADIO) then menuAppendRadioItem menu id label "" else menuAppend menu id label "" (kind == wxITEM_CHECK) - item <- menuFindItem menu id nullPtr + item <- menuFindItem menu id set item props return item @@ -317,6 +340,20 @@ menuItemOnCommand item io insert key val ((k,v):xs) | key == k = (key,val):xs | otherwise = (k,v):insert key val xs +-- | When setting event handlers on menu items which have been loaded from +-- XRC resource files, properties cannot be used as the menu item +-- instances are opaque to wxHaskell. +-- +-- This function offers a convenient way to attach menu item event +-- handlers, given the identity of the window which owns the menu containing +-- the menu item, and the name of the menu item + +menuItemOnCommandRes :: Window a -> String -> IO () -> IO () +menuItemOnCommandRes win item_name handler = + do + res <- xmlResourceGet + item_id <- xmlResourceGetXRCID res item_name + evtHandlerOnMenuCommand win item_id handler -- Propagate the (delayed) event handlers of a submenu to the parent menu. -- This is necessary for event handlers set on menu items in a submenu that diff --git a/wxc/eiffel/wx_defs.e b/wxc/eiffel/wx_defs.e index 82c00167..95507b7b 100644 --- a/wxc/eiffel/wx_defs.e +++ b/wxc/eiffel/wx_defs.e @@ -768,6 +768,12 @@ feature {NONE} wxSASH_STATUS_OK: INTEGER is 0 wxSASH_STATUS_OUT_OF_RANGE: INTEGER is 1 + -- from: xmlres.h + wxXRC_NONE: INTEGER is 0 + wxXRC_USE_LOCALE: INTEGER is 1 + wxXRC_NO_SUBCLASSING: INTEGER is 2 + wxXRC_NO_RELOADING: INTEGER is 4 + -- from: settings.h wxSYS_WHITE_BRUSH : INTEGER is 0 diff --git a/wxc/include/stc.h b/wxc/include/stc.h index 5ff8ce07..b2de5fd5 100644 --- a/wxc/include/stc.h +++ b/wxc/include/stc.h @@ -108,3 +108,7 @@ int expEVT_STC_HOTSPOT_CLICK(); int expEVT_STC_HOTSPOT_DCLICK(); int expEVT_STC_CALLTIP_CLICK(); int expEVT_STC_AUTOCOMP_SELECTION(); + +/* Styled Text Control as an XML Resource */ +TClassDefExtend(wxXmlResource,wxObject) +TClass(wxStyledTextCtrl) wxXmlResource_GetStyledTextCtrl( TSelf(wxWindow) _obj, TClass(wxString) str_id ); diff --git a/wxc/include/wxc_glue.h b/wxc/include/wxc_glue.h index f7228dad..4aa7eb51 100644 --- a/wxc/include/wxc_glue.h +++ b/wxc/include/wxc_glue.h @@ -3156,7 +3156,7 @@ void wxMenu_DeletePointer( TSelf(wxMenu) _obj ); void wxMenu_DestroyById( TSelf(wxMenu) _obj, int id ); void wxMenu_DestroyByItem( TSelf(wxMenu) _obj, TClass(wxMenuItem) _itm ); void wxMenu_Enable( TSelf(wxMenu) _obj, int id, TBool enable ); -TClass(wxMenuItem) wxMenu_FindItem( TSelf(wxMenu) _obj, int id, TClass(wxMenu)* menu ); +TClass(wxMenuItem) wxMenu_FindItem( TSelf(wxMenu) _obj, int id); int wxMenu_FindItemByLabel( TSelf(wxMenu) _obj, TString itemString ); TClass(wxClientData) wxMenu_GetClientData( TSelf(wxMenu) _obj ); TStringLen wxMenu_GetHelpString( TSelf(wxMenu) _obj, int id, TStringOutVoid _buf ); @@ -3196,7 +3196,7 @@ void wxMenuBar_DeletePointer( TSelf(wxMenuBar) _obj ); int wxMenuBar_Enable( TSelf(wxMenuBar) _obj, TBool enable ); void wxMenuBar_EnableItem( TSelf(wxMenuBar) _obj, int id, TBool enable ); void wxMenuBar_EnableTop( TSelf(wxMenuBar) _obj, int pos, TBool enable ); -void* wxMenuBar_FindItem( TSelf(wxMenuBar) _obj, int id, TClass(wxMenu) menu ); +TClass(wxMenuItem) wxMenuBar_FindItem( TSelf(wxMenuBar) _obj, int id); int wxMenuBar_FindMenu( TSelf(wxMenuBar) _obj, TString title ); int wxMenuBar_FindMenuItem( TSelf(wxMenuBar) _obj, TString menuString, TString itemString ); TStringLen wxMenuBar_GetHelpString( TSelf(wxMenuBar) _obj, int id, TStringOutVoid _buf ); @@ -3207,8 +3207,8 @@ int wxMenuBar_GetMenuCount( TSelf(wxMenuBar) _obj ); int wxMenuBar_Insert( TSelf(wxMenuBar) _obj, int pos, TClass(wxMenu) menu, TString title ); TBool wxMenuBar_IsChecked( TSelf(wxMenuBar) _obj, int id ); TBool wxMenuBar_IsEnabled( TSelf(wxMenuBar) _obj, int id ); -void* wxMenuBar_Remove( TSelf(wxMenuBar) _obj, int pos ); -void* wxMenuBar_Replace( TSelf(wxMenuBar) _obj, int pos, TClass(wxMenu) menu, TString title ); +TClass(wxMenu) wxMenuBar_Remove( TSelf(wxMenuBar) _obj, int pos ); +TClass(wxMenu) wxMenuBar_Replace( TSelf(wxMenuBar) _obj, int pos, TClass(wxMenu) menu, TString title ); void wxMenuBar_SetHelpString( TSelf(wxMenuBar) _obj, int id, TString helpString ); void wxMenuBar_SetItemLabel( TSelf(wxMenuBar) _obj, int id, TString label ); void wxMenuBar_SetLabel( TSelf(wxMenuBar) _obj, TString s ); @@ -3230,7 +3230,7 @@ int wxMenuItem_GetId( TSelf(wxMenuItem) _obj ); TStringLen wxMenuItem_GetLabel( TSelf(wxMenuItem) _obj, TStringOutVoid _buf ); TStringLen wxMenuItem_GetLabelFromText( TStringVoid text, TStringOutVoid _buf ); TClass(wxMenu) wxMenuItem_GetMenu( TSelf(wxMenuItem) _obj ); -void* wxMenuItem_GetSubMenu( TSelf(wxMenuItem) _obj ); +TClass(wxMenu) wxMenuItem_GetSubMenu( TSelf(wxMenuItem) _obj ); TStringLen wxMenuItem_GetText( TSelf(wxMenuItem) _obj, TStringOutVoid _buf ); TBool wxMenuItem_IsCheckable( TSelf(wxMenuItem) _obj ); TBool wxMenuItem_IsChecked( TSelf(wxMenuItem) _obj ); @@ -4924,7 +4924,7 @@ void wxWizardPageSimple_SetPrev( TSelf(wxWizardPageSimple) _obj, TClass(wx TClassDefExtend(wxXmlResource,wxObject) void wxXmlResource_AddHandler( TSelf(wxXmlResource) _obj, TClass(wxEvtHandler) handler ); void wxXmlResource_AddSubclassFactory( TSelf(wxXmlResource) _obj, void* factory ); -int wxXmlResource_AttachUnknownControl( TSelf(wxXmlResource) _obj, TClass(wxString) name, TClass(wxControl) control, TClass(wxWindow) parent ); +int wxXmlResource_AttachUnknownControl( TSelf(wxXmlResource) _obj, TClass(wxControl) control, TClass(wxWindow) parent ); void wxXmlResource_ClearHandlers( TSelf(wxXmlResource) _obj ); int wxXmlResource_CompareVersion( TSelf(wxXmlResource) _obj, int major, int minor, int release, int revision ); TClass(wxXmlResource) wxXmlResource_Create( int flags ); @@ -4934,20 +4934,56 @@ TClass(wxXmlResource) wxXmlResource_Get( ); TStringLen wxXmlResource_GetDomain( TSelf(wxXmlResource) _obj, TStringOut domain ); int wxXmlResource_GetFlags( TSelf(wxXmlResource) _obj ); long wxXmlResource_GetVersion( TSelf(wxXmlResource) _obj ); -int wxXmlResource_GetXRCID( TSelf(wxXmlResource) _obj, TSelf(wxXmlResource) str_id ); +int wxXmlResource_GetXRCID( TSelf(wxXmlResource) _obj, TClass(wxString) str_id ); void wxXmlResource_InitAllHandlers( TSelf(wxXmlResource) _obj ); -int wxXmlResource_InitializeObject( TSelf(wxXmlResource) _obj, TSelf(wxObject) _inst, TClass(wxWindow) parent, TClass(wxString) name, TClass(wxString) classname ); void wxXmlResource_InsertHandler( TSelf(wxXmlResource) _obj, TClass(wxEvtHandler) handler ); -int wxXmlResource_Load( TSelf(wxXmlResource) _obj, TClass(wxString) filemask ); +TBool wxXmlResource_Load( TSelf(wxXmlResource) _obj, TClass(wxString) filemask ); void wxXmlResource_LoadBitmap( TSelf(wxXmlResource) _obj, TClass(wxString) name, TClassRef(wxBitmap) _ref ); TClass(wxDialog) wxXmlResource_LoadDialog( TSelf(wxXmlResource) _obj, TClass(wxWindow) parent, TClass(wxString) name ); TClass(wxFrame) wxXmlResource_LoadFrame( TSelf(wxXmlResource) _obj, TClass(wxWindow) parent, TClass(wxString) name ); void wxXmlResource_LoadIcon( TSelf(wxXmlResource) _obj, TClass(wxString) name, TClassRef(wxIcon) _ref ); TClass(wxMenu) wxXmlResource_LoadMenu( TSelf(wxXmlResource) _obj, TClass(wxString) name ); TClass(wxMenuBar) wxXmlResource_LoadMenuBar( TSelf(wxXmlResource) _obj, TClass(wxWindow) parent, TClass(wxString) name ); -TClass(wxObject) wxXmlResource_LoadObject( TSelf(wxXmlResource) _obj, TClass(wxWindow) parent, TClass(wxString) name, TClass(wxString) classname ); TClass(wxPanel) wxXmlResource_LoadPanel( TSelf(wxXmlResource) _obj, TClass(wxWindow) parent, TClass(wxString) name ); TClass(wxToolBar) wxXmlResource_LoadToolBar( TSelf(wxXmlResource) _obj, TClass(wxWindow) parent, TClass(wxString) name ); +TClass(wxSizer) wxXmlResource_GetSizer( TSelf(wxWindow) _obj, TClass(wxString) str_id ); +TClass(wxBoxSizer) wxXmlResource_GetBoxSizer( TSelf(wxWindow) _obj, TClass(wxString) str_id ); +TClass(wxStaticBoxSizer) wxXmlResource_GetStaticBoxSizer( TSelf(wxWindow) _obj, TClass(wxString) str_id ); +TClass(wxGridSizer) wxXmlResource_GetGridSizer( TSelf(wxWindow) _obj, TClass(wxString) str_id ); +TClass(wxFlexGridSizer) wxXmlResource_GetFlexGridSizer( TSelf(wxWindow) _obj, TClass(wxString) str_id ); +TClass(wxBitmapButton) wxXmlResource_GetBitmapButton( TSelf(wxWindow) _obj, TClass(wxString) str_id ); +TClass(wxButton) wxXmlResource_GetButton( TSelf(wxWindow) _obj, TClass(wxString) str_id ); +TClass(wxCalendarCtrl) wxXmlResource_GetCalendarCtrl( TSelf(wxWindow) _obj, TClass(wxString) str_id ); +TClass(wxCheckBox) wxXmlResource_GetCheckBox( TSelf(wxWindow) _obj, TClass(wxString) str_id ); +TClass(wxCheckListBox) wxXmlResource_GetCheckListBox( TSelf(wxWindow) _obj, TClass(wxString) str_id ); +TClass(wxChoice) wxXmlResource_GetChoice( TSelf(wxWindow) _obj, TClass(wxString) str_id ); +TClass(wxComboBox) wxXmlResource_GetComboBox( TSelf(wxWindow) _obj, TClass(wxString) str_id ); +TClass(wxGauge) wxXmlResource_GetGauge( TSelf(wxWindow) _obj, TClass(wxString) str_id ); +TClass(wxGrid) wxXmlResource_GetGrid( TSelf(wxWindow) _obj, TClass(wxString) str_id ); +TClass(wxHtmlWindow) wxXmlResource_GetHtmlWindow( TSelf(wxWindow) _obj, TClass(wxString) str_id ); +TClass(wxListBox) wxXmlResource_GetListBox( TSelf(wxWindow) _obj, TClass(wxString) str_id ); +TClass(wxListCtrl) wxXmlResource_GetListCtrl( TSelf(wxWindow) _obj, TClass(wxString) str_id ); +TClass(wxMDIChildFrame) wxXmlResource_GetMDIChildFrame( TSelf(wxWindow) _obj, TClass(wxString) str_id ); +TClass(wxMDIParentFrame) wxXmlResource_GetMDIParentFrame( TSelf(wxWindow) _obj, TClass(wxString) str_id ); +TClass(wxMenu) wxXmlResource_GetMenu( TSelf(wxWindow) _obj, TClass(wxString) str_id ); +TClass(wxMenuBar) wxXmlResource_GetMenuBar( TSelf(wxWindow) _obj, TClass(wxString) str_id ); +TClass(wxMenuItem) wxXmlResource_GetMenuItem( TSelf(wxWindow) _obj, TClass(wxString) str_id ); +TClass(wxNotebook) wxXmlResource_GetNotebook( TSelf(wxWindow) _obj, TClass(wxString) str_id ); +TClass(wxPanel) wxXmlResource_GetPanel( TSelf(wxWindow) _obj, TClass(wxString) str_id ); +TClass(wxRadioButton) wxXmlResource_GetRadioButton( TSelf(wxWindow) _obj, TClass(wxString) str_id ); +TClass(wxRadioBox) wxXmlResource_GetRadioBox( TSelf(wxWindow) _obj, TClass(wxString) str_id ); +TClass(wxScrollBar) wxXmlResource_GetScrollBar( TSelf(wxWindow) _obj, TClass(wxString) str_id ); +TClass(wxScrolledWindow) wxXmlResource_GetScrolledWindow( TSelf(wxWindow) _obj, TClass(wxString) str_id ); +TClass(wxSlider) wxXmlResource_GetSlider( TSelf(wxWindow) _obj, TClass(wxString) str_id ); +TClass(wxSpinButton) wxXmlResource_GetSpinButton( TSelf(wxWindow) _obj, TClass(wxString) str_id ); +TClass(wxSpinCtrl) wxXmlResource_GetSpinCtrl( TSelf(wxWindow) _obj, TClass(wxString) str_id ); +TClass(wxSplitterWindow) wxXmlResource_GetSplitterWindow( TSelf(wxWindow) _obj, TClass(wxString) str_id ); +TClass(wxStaticBitmap) wxXmlResource_GetStaticBitmap( TSelf(wxWindow) _obj, TClass(wxString) str_id ); +TClass(wxStaticBox) wxXmlResource_GetStaticBox( TSelf(wxWindow) _obj, TClass(wxString) str_id ); +TClass(wxStaticLine) wxXmlResource_GetStaticLine( TSelf(wxWindow) _obj, TClass(wxString) str_id ); +TClass(wxStaticText) wxXmlResource_GetStaticText( TSelf(wxWindow) _obj, TClass(wxString) str_id ); +TClass(wxTextCtrl) wxXmlResource_GetTextCtrl( TSelf(wxWindow) _obj, TClass(wxString) str_id ); +TClass(wxTreeCtrl) wxXmlResource_GetTreeCtrl( TSelf(wxWindow) _obj, TClass(wxString) str_id ); TBool wxXmlResource_Unload( TSelf(wxXmlResource) _obj, TClass(wxString) filemask ); TClass(wxXmlResource) wxXmlResource_Set( TSelf(wxXmlResource) _obj, TSelf(wxXmlResource) res ); void wxXmlResource_SetDomain( TSelf(wxXmlResource) _obj, TString domain ); diff --git a/wxc/src/eljmenu.cpp b/wxc/src/eljmenu.cpp index bfdca5ff..9b021170 100644 --- a/wxc/src/eljmenu.cpp +++ b/wxc/src/eljmenu.cpp @@ -118,9 +118,10 @@ EWXWEXPORT(int, wxMenu_FindItemByLabel)(void* _obj, wxChar* itemString) return ((wxMenu*)_obj)->FindItem(itemString); } -EWXWEXPORT(void*, wxMenu_FindItem)(void* _obj, int id, void* menu) +EWXWEXPORT(void*, wxMenu_FindItem)(void* _obj, int id) { - return (void*)((wxMenu*)_obj)->FindItem(id, (wxMenu**) menu); + wxMenu* _foo = new wxMenu; + return (void*)((wxMenu*)_obj)->FindItem(id, &_foo); } EWXWEXPORT(void, wxMenu_Enable)(void* _obj, int id, int enable) diff --git a/wxc/src/eljmenubar.cpp b/wxc/src/eljmenubar.cpp index eb95e787..fda674c4 100644 --- a/wxc/src/eljmenubar.cpp +++ b/wxc/src/eljmenubar.cpp @@ -64,9 +64,10 @@ EWXWEXPORT(int, wxMenuBar_FindMenuItem)(void* _obj, wxChar* menuString, wxChar* return ((wxMenuBar*)_obj)->FindMenuItem(menuString, itemString); } -EWXWEXPORT(void*, wxMenuBar_FindItem)(void* _obj, int id, void *menu) +EWXWEXPORT(void*, wxMenuBar_FindItem)(void* _obj, int id) { - return (void*)((wxMenuBar*)_obj)->FindItem(id, (wxMenu**) menu); + wxMenu* _foo = new wxMenu; + return (void*)((wxMenuBar*)_obj)->FindItem(id, &_foo); } EWXWEXPORT(int, wxMenuBar_FindMenu)(void* _obj, wxChar* title) diff --git a/wxc/src/eljrc.cpp b/wxc/src/eljrc.cpp index 542c60e2..05783a54 100644 --- a/wxc/src/eljrc.cpp +++ b/wxc/src/eljrc.cpp @@ -283,164 +283,226 @@ bool wxGridXmlHandler::CanHandle(wxXmlNode *node) extern "C" { -EWXWEXPORT(wxXmlResource*,wxXmlResource_Create)(int flags) -{ - return new wxXmlResource(flags); -} - -EWXWEXPORT(wxXmlResource*,wxXmlResource_CreateFromFile)(wxString* filemask, int flags) -{ - return new wxXmlResource(*filemask, flags); -} - -EWXWEXPORT(void,wxXmlResource_Delete)(wxXmlResource* self) -{ - delete self; -} - -EWXWEXPORT(bool,wxXmlResource_Load)(wxXmlResource* self, wxString* filemask) +EWXWEXPORT(bool,wxXmlResource_Load)(wxXmlResource* _obj, wxString* filemask) { wxGetApp().InitZipFileSystem(); - return self->Load(*filemask); + return _obj->Load(*filemask); } -EWXWEXPORT(void,wxXmlResource_InitAllHandlers)(wxXmlResource* self) +EWXWEXPORT(void,wxXmlResource_InitAllHandlers)(wxXmlResource* _obj) { - self->InitAllHandlers(); - self->AddHandler(new wxMDIParentFrameXmlHandler()); - self->AddHandler(new wxMDIChildFrameXmlHandler()); - self->AddHandler(new wxSplitterWindowXmlHandler()); + _obj->InitAllHandlers(); + _obj->AddHandler(new wxMDIParentFrameXmlHandler()); + _obj->AddHandler(new wxMDIChildFrameXmlHandler()); + _obj->AddHandler(new wxSplitterWindowXmlHandler()); #ifdef wxUSE_STC - self->AddHandler(new wxStyledTextCtrlXmlHandler()); + _obj->AddHandler(new wxStyledTextCtrlXmlHandler()); #endif - self->AddHandler(new wxGridXmlHandler()); + _obj->AddHandler(new wxGridXmlHandler()); } -EWXWEXPORT(void,wxXmlResource_AddHandler)(wxXmlResource* self, wxXmlResourceHandler* handler) +EWXWEXPORT(wxXmlResource*, wxXmlResource_Create)(int flags) { - self->AddHandler(handler); + wxXmlResource* _obj = wxXmlResource::Get(); + + // Calling the wxc variant of InitAllHandlers() ensures additional + // handlers for splitters etc. get initialized as well. + wxXmlResource_InitAllHandlers(_obj); + _obj->SetFlags(flags); + return _obj; } -EWXWEXPORT(void,wxXmlResource_InsertHandler)(wxXmlResource* self, wxXmlResourceHandler* handler) +EWXWEXPORT(wxXmlResource*, wxXmlResource_CreateFromFile)(wxString* filemask, int flags) { - self->InsertHandler(handler); + wxXmlResource* _obj = wxXmlResource_Create(flags); + if (_obj->Load(*filemask)) { + return _obj; + } + else { + delete _obj; + return NULL; + } } -EWXWEXPORT(void,wxXmlResource_ClearHandlers)(wxXmlResource* self) +EWXWEXPORT(void,wxXmlResource_AddHandler)(wxXmlResource* _obj, wxXmlResourceHandler* handler) { - self->ClearHandlers(); + _obj->AddHandler(handler); } -EWXWEXPORT(void,wxXmlResource_AddSubclassFactory)(wxXmlResource* self, wxXmlSubclassFactory* factory) +EWXWEXPORT(void,wxXmlResource_InsertHandler)(wxXmlResource* _obj, wxXmlResourceHandler* handler) { - self->AddSubclassFactory(factory); + _obj->InsertHandler(handler); } -EWXWEXPORT(wxMenu*,wxXmlResource_LoadMenu)(wxXmlResource* self, wxString* name) +EWXWEXPORT(void,wxXmlResource_ClearHandlers)(wxXmlResource* _obj) { - return self->LoadMenu(*name); + _obj->ClearHandlers(); } -EWXWEXPORT(wxMenuBar*,wxXmlResource_LoadMenuBar)(wxXmlResource* self, wxWindow* parent, wxString* name) +EWXWEXPORT(void,wxXmlResource_AddSubclassFactory)(wxXmlResource* _obj, wxXmlSubclassFactory* factory) { - return self->LoadMenuBar(parent, *name); + _obj->AddSubclassFactory(factory); } - -EWXWEXPORT(wxToolBar*,wxXmlResource_LoadToolBar)(wxXmlResource* self, wxWindow* parent, wxString* name) + +EWXWEXPORT(wxMenu*,wxXmlResource_LoadMenu)(wxXmlResource* _obj, wxString* name) { - return self->LoadToolBar(parent, *name); + return _obj->LoadMenu(*name); } -EWXWEXPORT(wxDialog*,wxXmlResource_LoadDialog)(wxXmlResource* self, wxWindow* parent, wxString* name) +EWXWEXPORT(wxMenuBar*,wxXmlResource_LoadMenuBar)(wxXmlResource* _obj, wxWindow* parent, wxString* name) { - return self->LoadDialog(parent, *name); + return _obj->LoadMenuBar(parent, *name); } -EWXWEXPORT(wxPanel*,wxXmlResource_LoadPanel)(wxXmlResource* self, wxWindow* parent, wxString* name) +EWXWEXPORT(wxToolBar*,wxXmlResource_LoadToolBar)(wxXmlResource* _obj, wxWindow* parent, wxString* name) { - return self->LoadPanel(parent, *name); + return _obj->LoadToolBar(parent, *name); } -EWXWEXPORT(wxFrame*,wxXmlResource_LoadFrame)(wxXmlResource* self, wxWindow* parent, wxString* name) +EWXWEXPORT(wxDialog*,wxXmlResource_LoadDialog)(wxXmlResource* _obj, wxWindow* parent, wxString* name) { - return self->LoadFrame(parent, *name); + wxDialog* dlg = new wxDialog; + if (!_obj->LoadDialog(dlg, parent, *name)) { + delete dlg; + return NULL; + } else { + return dlg; + } } -EWXWEXPORT(wxObject*,wxXmlResource_LoadObject)(wxXmlResource* self, wxWindow* parent, wxString* name, wxString* classname) +EWXWEXPORT(wxPanel*,wxXmlResource_LoadPanel)(wxXmlResource* _obj, wxWindow* parent, wxString* name) { - return self->LoadObject(parent, *name, *classname); + return _obj->LoadPanel(parent, *name); } -EWXWEXPORT(bool,wxXmlResource_InitializeObject)( wxXmlResource* self, wxObject* _inst, wxWindow* parent, - wxString* name, wxString* classname) +EWXWEXPORT(wxFrame*,wxXmlResource_LoadFrame)(wxXmlResource* _obj, wxWindow* parent, wxString* name) { - return self->LoadObject(_inst, (wxWindow*)parent, *name, *classname); + wxFrame* frame = new wxFrame; + if (!_obj->LoadFrame(frame, parent, *name)) { + delete frame; + return NULL; + } else { + return frame; + } } -EWXWEXPORT(void,wxXmlResource_LoadBitmap)(wxXmlResource* self, wxString* name, void* _ref) +EWXWEXPORT(void,wxXmlResource_LoadBitmap)(wxXmlResource* _obj, wxString* name, void* _ref) { - *((wxBitmap*)_ref) = self->LoadBitmap(*name); + *((wxBitmap*)_ref) = _obj->LoadBitmap(*name); } -EWXWEXPORT(void,wxXmlResource_LoadIcon)(wxXmlResource* self, wxString* name, void* _ref) +EWXWEXPORT(void,wxXmlResource_LoadIcon)(wxXmlResource* _obj, wxString* name, void* _ref) { - *((wxIcon*)_ref) = self->LoadIcon(*name); + *((wxIcon*)_ref) = _obj->LoadIcon(*name); } -EWXWEXPORT(bool,wxXmlResource_Unload)(wxXmlResource* self, wxString* name) +EWXWEXPORT(bool,wxXmlResource_Unload)(wxXmlResource* _obj, wxString* name) { - return self->Unload(*name); + return _obj->Unload(*name); } -EWXWEXPORT(bool,wxXmlResource_AttachUnknownControl)(wxXmlResource* self, wxString* name, wxWindow* control, wxWindow* parent) +EWXWEXPORT(bool,wxXmlResource_AttachUnknownControl)(wxXmlResource* _obj, wxString* name, wxWindow* control, wxWindow* parent) { - return self->AttachUnknownControl(*name, control, parent); + return _obj->AttachUnknownControl(*name, control, parent); } -EWXWEXPORT(int,wxXmlResource_GetXRCID)(wxXmlResource* self, wxChar* str_id) +EWXWEXPORT(int,wxXmlResource_GetXRCID)(wxXmlResource* _obj, wxString* str_id) { - return self->GetXRCID(str_id); + return _obj->GetXRCID(*str_id); } -EWXWEXPORT(long,wxXmlResource_GetVersion)(wxXmlResource* self) +EWXWEXPORT(long,wxXmlResource_GetVersion)(wxXmlResource* _obj) { - return self->GetVersion(); + return _obj->GetVersion(); } -EWXWEXPORT(int,wxXmlResource_CompareVersion)(wxXmlResource* self, int major, int minor, int release, int revision) +EWXWEXPORT(int,wxXmlResource_CompareVersion)(wxXmlResource* _obj, int major, int minor, int release, int revision) { - return self->CompareVersion(major, minor, release, revision); + return _obj->CompareVersion(major, minor, release, revision); } -EWXWEXPORT(wxXmlResource*,wxXmlResource_Get)(wxXmlResource* self) +EWXWEXPORT(wxXmlResource*,wxXmlResource_Get)(wxXmlResource* _obj) +{ + return wxXmlResource::Get(); +} + +// BUILD_XRCGETCTRL_FN constructs functions for geting control pointers out of +// window hierarchies created from XRC files. The functions themselves +#define BUILD_XRCGETCTRL_FN(_typ) \ + EWXWEXPORT(wx##_typ##*, wxXmlResource_Get##_typ)(wxWindow* _win, wxString* _str_id) \ + { \ + return reinterpret_cast(_win->FindWindow(wxXmlResource::GetXRCID(*_str_id))); \ + } +// Construct the XRC control getter functions +BUILD_XRCGETCTRL_FN(Sizer) +BUILD_XRCGETCTRL_FN(BoxSizer) +BUILD_XRCGETCTRL_FN(StaticBoxSizer) +BUILD_XRCGETCTRL_FN(GridSizer) +BUILD_XRCGETCTRL_FN(FlexGridSizer) +BUILD_XRCGETCTRL_FN(BitmapButton) +BUILD_XRCGETCTRL_FN(Button) +BUILD_XRCGETCTRL_FN(CalendarCtrl) +BUILD_XRCGETCTRL_FN(CheckBox) +BUILD_XRCGETCTRL_FN(CheckListBox) +BUILD_XRCGETCTRL_FN(Choice) +BUILD_XRCGETCTRL_FN(ComboBox) +BUILD_XRCGETCTRL_FN(Gauge) +BUILD_XRCGETCTRL_FN(Grid) +BUILD_XRCGETCTRL_FN(HtmlWindow) +BUILD_XRCGETCTRL_FN(ListBox) +BUILD_XRCGETCTRL_FN(ListCtrl) +BUILD_XRCGETCTRL_FN(MDIChildFrame) +BUILD_XRCGETCTRL_FN(MDIParentFrame) +BUILD_XRCGETCTRL_FN(Menu) +BUILD_XRCGETCTRL_FN(MenuBar) +BUILD_XRCGETCTRL_FN(MenuItem) { return self->Get(); } +BUILD_XRCGETCTRL_FN(Notebook) +BUILD_XRCGETCTRL_FN(Panel) +BUILD_XRCGETCTRL_FN(RadioButton) +BUILD_XRCGETCTRL_FN(RadioBox) +BUILD_XRCGETCTRL_FN(ScrollBar) +BUILD_XRCGETCTRL_FN(ScrolledWindow) +BUILD_XRCGETCTRL_FN(Slider) +BUILD_XRCGETCTRL_FN(SpinButton) +BUILD_XRCGETCTRL_FN(SpinCtrl) +BUILD_XRCGETCTRL_FN(SplitterWindow) +#ifdef wxUSE_STC +BUILD_XRCGETCTRL_FN(StyledTextCtrl) +#endif +BUILD_XRCGETCTRL_FN(StaticBitmap) +BUILD_XRCGETCTRL_FN(StaticBox) +BUILD_XRCGETCTRL_FN(StaticLine) +BUILD_XRCGETCTRL_FN(StaticText) +BUILD_XRCGETCTRL_FN(TextCtrl) +BUILD_XRCGETCTRL_FN(TreeCtrl) -EWXWEXPORT(wxXmlResource*,wxXmlResource_Set)(wxXmlResource* self, wxXmlResource* res) +EWXWEXPORT(wxXmlResource*,wxXmlResource_Set)(wxXmlResource* _obj, wxXmlResource* res) { - return self->Set(res); + return _obj->Set(res); } -EWXWEXPORT(int,wxXmlResource_GetDomain)(wxXmlResource* self, wxChar* buf) +EWXWEXPORT(int,wxXmlResource_GetDomain)(wxXmlResource* _obj, wxChar* buf) { - buf = self->GetDomain(); + buf = _obj->GetDomain(); return wxStrlen(buf); } -EWXWEXPORT(void,wxXmlResource_SetDomain)(wxXmlResource* self, wxChar* domain) +EWXWEXPORT(void,wxXmlResource_SetDomain)(wxXmlResource* _obj, wxString* domain) { - self->SetDomain(domain); + _obj->SetDomain(*domain); } -EWXWEXPORT(int,wxXmlResource_GetFlags)(wxXmlResource* self) +EWXWEXPORT(int,wxXmlResource_GetFlags)(wxXmlResource* _obj) { - return self->GetFlags(); + return _obj->GetFlags(); } -EWXWEXPORT(void,wxXmlResource_SetFlags)(wxXmlResource* self, int flags) +EWXWEXPORT(void,wxXmlResource_SetFlags)(wxXmlResource* _obj, int flags) { - self->SetFlags(flags); + _obj->SetFlags(flags); } }