From 95b4a59e67af301bb6ff061055ac5a9a09b96d6c Mon Sep 17 00:00:00 2001 From: Francesco Montorsi Date: Sat, 27 Sep 2008 20:26:28 +0000 Subject: [PATCH] even more interface fixes git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55923 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- interface/wx/html/winpars.h | 15 +++-- interface/wx/wfstream.h | 2 +- interface/wx/window.h | 108 ++++++++++++++++++------------------ interface/wx/wizard.h | 19 +++---- interface/wx/wrapsizer.h | 7 +-- interface/wx/xml/xml.h | 8 +-- interface/wx/xrc/xmlres.h | 82 +++++++++++++++------------ 7 files changed, 124 insertions(+), 117 deletions(-) diff --git a/interface/wx/html/winpars.h b/interface/wx/html/winpars.h index e7fb5d627d..232ba50760 100644 --- a/interface/wx/html/winpars.h +++ b/interface/wx/html/winpars.h @@ -31,7 +31,7 @@ public: @param parser Pointer to the parser that requested tables filling. */ - virtual void FillHandlersTable(wxHtmlWinParser parser); + virtual void FillHandlersTable(wxHtmlWinParser*); }; @@ -113,7 +113,7 @@ public: /** Returns actual text colour. */ - const wxColour GetActualColor() const; + const wxColour& GetActualColor() const; /** Returns default horizontal alignment. @@ -195,12 +195,12 @@ public: if the parser is between @c A and @c /A tags, wxEmptyString otherwise.) */ - const wxHtmlLinkInfo GetLink() const; + const wxHtmlLinkInfo& GetLink() const; /** Returns the colour of hypertext link text. */ - const wxColour GetLinkColor() const; + const wxColour& GetLinkColor() const; /** Returns output encoding, i.e. closest match to document's input encoding @@ -247,7 +247,7 @@ public: HTML are given in pixels -- e.g. image sizes. 300x300 image would be only one inch wide on typical printer. With pixel_scale = 3.0 it would be 3 inches.) */ - virtual void SetDC(wxDC dc, double pixel_scale = 1.0); + virtual void SetDC(wxDC* dc, double pixel_scale = 1.0e+0); /** Sets bold flag of actualfont. @a x is either @true of @false. @@ -285,9 +285,8 @@ public: Sets fonts. See wxHtmlWindow::SetFonts for detailed description. */ - void SetFonts(const wxString& normal_face, - const wxString& fixed_face, - const int sizes = NULL); + void SetFonts(const wxString& normal_face, const wxString& fixed_face, + const int* sizes = 0); /** Sets input encoding. The parser uses this information to build conversion diff --git a/interface/wx/wfstream.h b/interface/wx/wfstream.h index 489551294d..596152b5fe 100644 --- a/interface/wx/wfstream.h +++ b/interface/wx/wfstream.h @@ -72,7 +72,7 @@ public: Initializes a file stream in write-only mode using the file descriptor @e fp. */ wxFFileOutputStream(const wxString& filename, - const wxString& mode = "w+b"); + const wxString& mode = "wb"); /** Initializes a file stream in write-only mode using the file I/O object file. diff --git a/interface/wx/window.h b/interface/wx/window.h index 42ad351c86..518dcb614d 100644 --- a/interface/wx/window.h +++ b/interface/wx/window.h @@ -319,7 +319,7 @@ public: @remarks This function is currently only implemented under Mac/Carbon. */ - void AlwaysShowScrollbars(bool hflag, bool vflag); + virtual void AlwaysShowScrollbars(bool = true, bool = true); /** Sets the cached best size value. @@ -354,12 +354,12 @@ public: /** A synonym for Centre(). */ - void Center(int direction); + void Center(int dir = wxBOTH); /** A synonym for CentreOnParent(). */ - void CenterOnParent(int direction); + void CenterOnParent(int dir = wxBOTH); /** Centres the window. @@ -545,7 +545,7 @@ public: /** Destroys all children of a window. Called automatically by the destructor. */ - virtual void DestroyChildren(); + bool DestroyChildren(); /** Returns true if this window is in process of being destroyed. @@ -569,27 +569,6 @@ public: */ bool Disable(); - /** - Gets the size which best suits the window: for a control, it would be - the minimal size which doesn't truncate the control, for a panel - the - same size as it would have after a call to Fit(). - - The default implementation of this function is designed for use in container - windows, such as wxPanel, and works something like this: - -# If the window has a sizer then it is used to calculate the best size. - -# Otherwise if the window has layout constraints then those are used to - calculate the best size. - -# Otherwise if the window has children then the best size is set to be large - enough to show all the children. - -# Otherwise if there are no children then the window's minimal size will be - used as its best size. - -# Otherwise if there is no minimal size set, then the current size is used - for the best size. - - @see @ref overview_windowsizing - */ - virtual wxSize DoGetBestSize() const; - /** Does the window-specific updating after processing the update event. This function is called by UpdateWindowUI() in order to check return @@ -969,7 +948,7 @@ public: Cast it to an appropriate handle, such as @b HWND for Windows, @b Widget for Motif, @b GtkWidget for GTK or @b WinHandle for PalmOS. */ - void* GetHandle() const; + virtual WXWidget GetHandle() const; /** Gets the help text to be used as context-sensitive help for this window. @@ -1002,7 +981,7 @@ public: @see SetId(), @ref overview_windowids */ - int GetId() const; + wxWindowID GetId() const; /** Generic way of getting a label from any window, for @@ -1241,14 +1220,11 @@ public: Return value for external leading (optional). @param font Font to use instead of the current window font (optional). - @param use16 - If @true, string contains 16-bit characters. The default is @false. */ virtual void GetTextExtent(const wxString& string, int* w, int* h, int* descent = NULL, int* externalLeading = NULL, - const wxFont* font = NULL, - bool use16 = false) const; + const wxFont* font = NULL) const; /** Gets the dimensions of the string as it would be drawn on the @@ -1267,7 +1243,7 @@ public: @see wxRegion, wxRegionIterator */ - virtual wxRegion GetUpdateRegion() const; + const wxRegion& GetUpdateRegion() const; /** Returns a pointer to the current validator for the window, or @NULL if @@ -1398,7 +1374,7 @@ public: @since 2.9.0 */ virtual bool HideWithEffect(wxShowEffect effect, - unsigned timeout = 0); + unsigned int timeout = 0); /** This function is (or should be, in case of custom controls) called during @@ -1533,7 +1509,7 @@ public: @see @ref overview_windowsizing */ - void Layout(); + virtual bool Layout(); /** Lowers the window to the bottom of the window hierarchy (Z-order). @@ -1551,7 +1527,7 @@ public: the user can only interact with this window. If @false, the effect is reversed. */ - virtual void MakeModal(bool flag); + virtual void MakeModal(bool modal = true); /** Moves the window to the given position. @@ -1569,7 +1545,7 @@ public: @see SetSize() */ - void Move(int x, int y); + void Move(int x, int y, int flags = 0); /** Moves the window to the given position. @@ -1585,7 +1561,7 @@ public: @see SetSize() */ - void Move(const wxPoint& pt); + void Move(const wxPoint& pt, int flags = 0); /** Moves this window in the tab navigation order after the specified @e win. @@ -1628,13 +1604,13 @@ public: control. See also wxNavigationKeyEvent and HandleAsNavigationKey. */ - bool Navigate(int flags = wxNavigationKeyEvent::IsForward); + bool Navigate(int flags = IsForward); /** Performs a keyboard navigation action inside this window. See Navigate() for more information. */ - bool NavigateIn(int flags = wxNavigationKeyEvent::IsForward); + bool NavigateIn(int flags = IsForward); /** Create a new ID or range of IDs that are not currently in use. @@ -2043,7 +2019,7 @@ public: @see SetBackgroundColour(), GetForegroundColour(), SetTransparent() */ - virtual void SetBackgroundStyle(wxBackgroundStyle style); + virtual bool SetBackgroundStyle(wxBackgroundStyle style); /** This method is only implemented by ports which have support for @@ -2119,7 +2095,7 @@ public: @see ::wxSetCursor, wxCursor */ - virtual void SetCursor(const wxCursor& cursor); + virtual bool SetCursor(const wxCursor& cursor); /** Associates a drop target with this window. @@ -2213,7 +2189,7 @@ public: @see GetForegroundColour(), SetBackgroundColour(), GetBackgroundColour(), ShouldInheritColours() */ - virtual void SetForegroundColour(const wxColour& colour); + virtual bool SetForegroundColour(const wxColour& colour); /** Sets the help text to be used as context-sensitive help for this window. @@ -2234,13 +2210,7 @@ public: @see GetId(), @ref overview_windowids */ - void SetId(int id); - - /** - Sets the initial window size if none is given (i.e. at least one of the - components of the size passed to ctor/Create() is wxDefaultCoord). - */ - virtual void SetInitialBestSize(const wxSize& size); + void SetId(wxWindowID winid); /** A @e smart SetSize that will fill in default size components with the @@ -2354,7 +2324,7 @@ public: /** @deprecated use wxDC::SetPalette instead. */ - virtual void SetPalette(wxPalette* palette); + void SetPalette(const wxPalette& pal); /** Sets the position of one of the built-in scrollbars. @@ -2458,8 +2428,8 @@ public: @see Move() */ - virtual void SetSize(int x, int y, int width, int height, - int sizeFlags = wxSIZE_AUTO); + void SetSize(int x, int y, int width, int height, + int sizeFlags = wxSIZE_AUTO); //@{ /** @@ -2629,7 +2599,7 @@ public: @see HideWithEffect() */ virtual bool ShowWithEffect(wxShowEffect effect, - unsigned timeout = 0); + unsigned int timeout = 0); /** Reenables window updating after a previous call to Freeze(). @@ -2789,6 +2759,38 @@ public: The new y position for the cursor. */ virtual void WarpPointer(int x, int y); + + +protected: + + /** + Gets the size which best suits the window: for a control, it would be + the minimal size which doesn't truncate the control, for a panel - the + same size as it would have after a call to Fit(). + + The default implementation of this function is designed for use in container + windows, such as wxPanel, and works something like this: + -# If the window has a sizer then it is used to calculate the best size. + -# Otherwise if the window has layout constraints then those are used to + calculate the best size. + -# Otherwise if the window has children then the best size is set to be large + enough to show all the children. + -# Otherwise if there are no children then the window's minimal size will be + used as its best size. + -# Otherwise if there is no minimal size set, then the current size is used + for the best size. + + @see @ref overview_windowsizing + */ + virtual wxSize DoGetBestSize() const; + + + /** + Sets the initial window size if none is given (i.e. at least one of the + components of the size passed to ctor/Create() is wxDefaultCoord). + @deprecated @todo provide deprecation description + */ + virtual void SetInitialBestSize(const wxSize& size); }; diff --git a/interface/wx/wizard.h b/interface/wx/wizard.h index 921527cafb..fb0fd893d8 100644 --- a/interface/wx/wizard.h +++ b/interface/wx/wizard.h @@ -71,7 +71,7 @@ public: @see GetPrev() */ - wxWizardPage* GetNext() const; + virtual wxWizardPage* GetNext() const = 0; /** Get the page which should be shown when the user chooses the @c "Back" @@ -81,7 +81,7 @@ public: @see GetNext() */ - wxWizardPage* GetPrev() const; + virtual wxWizardPage* GetPrev() const = 0; }; @@ -120,8 +120,8 @@ public: It is not normally used by the user code as the objects of this type are constructed by wxWizard. */ - wxWizardEvent(wxEventType type = wxEVT_NULL, int id = -1, - bool direction = true); + wxWizardEvent(wxEventType type = wxEVT_NULL, int id = wxID_ANY, + bool direction = true, wxWizardPage* page = 0); /** Return the direction in which the page is changing: for @@ -162,7 +162,7 @@ public: Constructor takes the previous and next pages. They may be modified later by SetPrev() or SetNext(). */ - wxWizardPageSimple(wxWizard* parent = NULL, + wxWizardPageSimple(wxWizard* parent, wxWizardPage* prev = NULL, wxWizardPage* next = NULL, const wxBitmap& bitmap = wxNullBitmap); @@ -280,7 +280,7 @@ public: @param parent The parent window, may be @NULL. @param id - The id of the dialog, will usually be just -1. + The id of the dialog, will usually be just wxID_ANY. @param title The title of the dialog. @param bitmap @@ -290,7 +290,7 @@ public: @param style Window style is passed to wxDialog. */ - wxWizard(wxWindow* parent, int id = -1, + wxWizard(wxWindow* parent, int id = wxID_ANY, const wxString& title = wxEmptyString, const wxBitmap& bitmap = wxNullBitmap, const wxPoint& pos = wxDefaultPosition, @@ -318,11 +318,10 @@ public: @param style Window style is passed to wxDialog. */ - bool Create(wxWindow* parent, int id = -1, + bool Create(wxWindow* parent, int id = wxID_ANY, const wxString& title = wxEmptyString, const wxBitmap& bitmap = wxNullBitmap, - const wxPoint& pos = wxDefaultPosition, - long style = wxDEFAULT_DIALOG_STYLE); + const wxPoint& pos = wxDefaultPosition, long style = 536877056); /** This method is obsolete, use GetPageAreaSizer() instead. diff --git a/interface/wx/wrapsizer.h b/interface/wx/wrapsizer.h index f48092e3fd..0900e6fe88 100644 --- a/interface/wx/wrapsizer.h +++ b/interface/wx/wrapsizer.h @@ -37,8 +37,7 @@ public: Both of these flags are on by default. */ wxWrapSizer(int orient = wxHORIZONTAL, - int flags = wxEXTEND_LAST_ON_EACH_LINE | - wxREMOVE_LEADING_SPACES); + int flags = wxWRAPSIZER_DEFAULT_FLAGS); /** Not used by an application. @@ -50,8 +49,8 @@ public: Returns @true if the information was used (and the sub-item min size was updated). */ - bool InformFirstDirection(int direction, int size, - int availableOtherDir); + virtual bool InformFirstDirection(int direction, int size, + int availableOtherDir); protected: /** diff --git a/interface/wx/xml/xml.h b/interface/wx/xml/xml.h index c9f79375f2..c66ce74ca5 100644 --- a/interface/wx/xml/xml.h +++ b/interface/wx/xml/xml.h @@ -170,7 +170,7 @@ public: Be aware that for nodes of type @c wxXML_ELEMENT_NODE (the most used node type) the content is an empty string. See GetNodeContent() for more details. */ - wxString GetContent() const; + const wxString& GetContent() const; /** Returns the number of nodes which separe this node from @c grandparent. @@ -191,7 +191,7 @@ public: Can be an empty string (e.g. for nodes of type @c wxXML_TEXT_NODE or @c wxXML_CDATA_SECTION_NODE). */ - wxString GetName() const; + const wxString& GetName() const; /** Returns a pointer to the sibling of this node or @NULL if there are no @@ -541,7 +541,7 @@ public: @note This is the encoding original file was saved in, @b not the encoding of in-memory representation! */ - wxString GetFileEncoding() const; + const wxString& GetFileEncoding() const; /** Returns the root node of the document. @@ -555,7 +555,7 @@ public: If the version attribute was not explicitely given in the header, this function returns an empty string. */ - wxString GetVersion() const; + const wxString& GetVersion() const; /** Returns @true if the document has been loaded successfully. diff --git a/interface/wx/xrc/xmlres.h b/interface/wx/xrc/xmlres.h index a178f1a0dc..1144d5773e 100644 --- a/interface/wx/xrc/xmlres.h +++ b/interface/wx/xrc/xmlres.h @@ -108,7 +108,7 @@ public: Returns the domain (message catalog) that will be used to load translatable strings in the XRC. */ - wxChar* GetDomain(); + const wxString& GetDomain() const; /** Returns flags, which may be a bitlist of ::wxXmlResourceFlags @@ -238,7 +238,7 @@ public: Sets the domain (message catalog) that will be used to load translatable strings in the XRC. */ - wxChar* SetDomain(const wxChar* domain); + void SetDomain(const wxString& domain); /** Sets flags (bitlist of ::wxXmlResourceFlags enumeration values). @@ -281,15 +281,21 @@ public: virtual ~wxXmlResourceHandler(); /** - Add a style flag (e.g. @c wxMB_DOCKABLE) to the list of flags - understood by this handler. + Creates an object (menu, dialog, control, ...) from an XML node. + Should check for validity. @a parent is a higher-level object + (usually window, dialog or panel) that is often necessary to + create the resource. + + If @b instance is non-@NULL it should not create a new instance via + 'new' but should rather use this one, and call its Create method. */ - void AddStyle(const wxString& name, int value); + wxObject* CreateResource(wxXmlNode* node, wxObject* parent, + wxObject* instance); /** - Add styles common to all wxWindow-derived classes. + Called from CreateResource after variables were filled. */ - void AddWindowStyles(); + virtual wxObject* DoCreateResource() = 0; /** Returns @true if it understands this node and can create @@ -301,7 +307,26 @@ public: at the time CanHandle() is called and it is only safe to operate on node directly or to call IsOfClass(). */ - bool CanHandle(wxXmlNode* node); + virtual bool CanHandle(wxXmlNode* node) = 0; + + /** + Sets the parent resource. + */ + void SetParentResource(wxXmlResource* res); + + +protected: + + /** + Add a style flag (e.g. @c wxMB_DOCKABLE) to the list of flags + understood by this handler. + */ + void AddStyle(const wxString& name, int value); + + /** + Add styles common to all wxWindow-derived classes. + */ + void AddWindowStyles(); /** Creates children. @@ -320,23 +345,6 @@ public: wxObject* CreateResFromNode(wxXmlNode* node, wxObject* parent, wxObject* instance = NULL); - /** - Creates an object (menu, dialog, control, ...) from an XML node. - Should check for validity. @a parent is a higher-level object - (usually window, dialog or panel) that is often necessary to - create the resource. - - If @b instance is non-@NULL it should not create a new instance via 'new' - but should rather use this one, and call its Create method. - */ - wxObject* CreateResource(wxXmlNode* node, wxObject* parent, - wxObject* instance); - - /** - Called from CreateResource after variables were filled. - */ - wxObject* DoCreateResource(); - /** Creates an animation (see wxAnimation) from the filename specified in @a param. */ @@ -345,7 +353,9 @@ public: /** Gets a bitmap. */ - wxBitmap GetBitmap(const wxString& param = wxT("bitmap"), wxSize size = wxDefaultSize); + wxBitmap GetBitmap(const wxString& param = "bitmap", + const wxArtClient& defaultArtClient = wxART_OTHER, + wxSize size = wxDefaultSize); /** Gets a bool flag (1, t, yes, on, true are @true, everything else is @false). @@ -361,17 +371,18 @@ public: /** Returns the current file system. */ - wxFileSystem GetCurFileSystem(); + wxFileSystem& GetCurFileSystem(); /** Gets a dimension (may be in dialog units). */ - wxCoord GetDimension(const wxString& param, wxCoord defaultv = 0); + wxCoord GetDimension(const wxString& param, wxCoord defaultv = 0, + wxWindow* windowToUse = 0); /** Gets a font. */ - wxFont GetFont(); + wxFont GetFont(const wxString& param = "font"); /** Returns the XRCID. @@ -381,7 +392,9 @@ public: /** Returns an icon. */ - wxIcon GetIcon(const wxString& param = wxT("icon"), wxSize size = wxDefaultSize); + wxIcon GetIcon(const wxString& param = "icon", + const wxArtClient& defaultArtClient = wxART_OTHER, + wxSize size = wxDefaultSize); /** Gets the integer value from the parameter. @@ -416,7 +429,7 @@ public: /** Gets the size (may be in dialog units). */ - wxSize GetSize(const wxString& param = wxT("size")); + wxSize GetSize(const wxString& param = "size", wxWindow* windowToUse = 0); /** Gets style flags from text in form "flag | flag2| flag3 |..." @@ -431,7 +444,7 @@ public: translation because of XML syntax) - calls wxGetTranslations (unless disabled in wxXmlResource) */ - wxString GetText(const wxString& param); + wxString GetText(const wxString& param, bool translate = true); /** Check to see if a parameter exists. @@ -445,11 +458,6 @@ public: */ bool IsOfClass(wxXmlNode* node, const wxString& classname); - /** - Sets the parent resource. - */ - void SetParentResource(wxXmlResource* res); - /** Sets common window options. */ -- 2.47.2