From 05b0355af838c4407bf977923d82f07abc098d91 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Mon, 27 Dec 2010 20:47:12 +0000 Subject: [PATCH] Fix various missing or broken stuff needed for Project Phoenix git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66474 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/versioninfo.h | 8 +-- interface/wx/frame.h | 5 ++ interface/wx/power.h | 17 +++++ interface/wx/toplevel.h | 7 +- interface/wx/utils.h | 8 +-- interface/wx/validate.h | 2 +- interface/wx/window.h | 145 +++++++++++++++++++++++++++++++++------ 7 files changed, 161 insertions(+), 31 deletions(-) diff --git a/include/wx/versioninfo.h b/include/wx/versioninfo.h index 40bd5a1e25..654faff9a7 100644 --- a/include/wx/versioninfo.h +++ b/include/wx/versioninfo.h @@ -3,7 +3,7 @@ // Purpose: declaration of wxVersionInfo class // Author: Troels K // Created: 2010-11-22 -// RCS-ID: $Id:$ +// RCS-ID: $Id$ // Copyright: (c) 2010 wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -20,9 +20,9 @@ class wxVersionInfo { public: - wxVersionInfo(const wxString& name, - int major, - int minor, + wxVersionInfo(const wxString& name = wxString(), + int major = 0, + int minor = 0, int micro = 0, const wxString& description = wxString(), const wxString& copyright = wxString()) diff --git a/interface/wx/frame.h b/interface/wx/frame.h index a8bcda572a..d3104c2cc3 100644 --- a/interface/wx/frame.h +++ b/interface/wx/frame.h @@ -436,5 +436,10 @@ public: Associates a toolbar with the frame. */ virtual void SetToolBar(wxToolBar* toolBar); + + + void PushStatusText(const wxString &text, int number = 0); + void PopStatusText(int number = 0); + }; diff --git a/interface/wx/power.h b/interface/wx/power.h index fd488ed12e..da34f5c416 100644 --- a/interface/wx/power.h +++ b/interface/wx/power.h @@ -6,6 +6,23 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// +enum wxPowerType +{ + wxPOWER_SOCKET, + wxPOWER_BATTERY, + wxPOWER_UNKNOWN +}; + +enum wxBatteryState +{ + wxBATTERY_NORMAL_STATE, // system is fully usable + wxBATTERY_LOW_STATE, // start to worry + wxBATTERY_CRITICAL_STATE, // save quickly + wxBATTERY_SHUTDOWN_STATE, // too late + wxBATTERY_UNKNOWN_STATE +}; + + /** @class wxPowerEvent diff --git a/interface/wx/toplevel.h b/interface/wx/toplevel.h index bb8bdea42f..7452c04083 100644 --- a/interface/wx/toplevel.h +++ b/interface/wx/toplevel.h @@ -80,7 +80,7 @@ public: Constructor creating the top level window. */ wxTopLevelWindow(wxWindow *parent, - wxWindowID winid, + wxWindowID id, const wxString& title, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, @@ -288,6 +288,11 @@ public: */ wxWindow* SetDefaultItem(wxWindow* win); + + wxWindow* SetTmpDefaultItem(wxWindow * win); + wxWindow* GetTmpDefaultItem() const; + + /** Sets the icon for this window. diff --git a/interface/wx/utils.h b/interface/wx/utils.h index de5aae9748..b0f11b9f8b 100644 --- a/interface/wx/utils.h +++ b/interface/wx/utils.h @@ -106,7 +106,7 @@ public: @header{wx/utils.h} */ -void wxBeginBusyCursor(wxCursor* cursor = wxHOURGLASS_CURSOR); +void wxBeginBusyCursor(const wxCursor* cursor = wxHOURGLASS_CURSOR); /** Changes the cursor back to the original cursor, for all windows in the @@ -1070,8 +1070,8 @@ unsigned long wxGetProcessId(); @header{wx/utils.h} */ -int wxKill(long pid, int sig = wxSIGTERM, - wxKillError rc = NULL, int flags = 0); +int wxKill(long pid, wxSignal sig = wxSIGTERM, + wxKillError* rc = NULL, int flags = wxKILL_NOCHILDREN); /** Executes a command in an interactive shell window. If no command is @@ -1081,7 +1081,7 @@ int wxKill(long pid, int sig = wxSIGTERM, @header{wx/utils.h} */ -bool wxShell(const wxString& command = NULL); +bool wxShell(const wxString& command = wxEmptyString); /** This function shuts down or reboots the computer depending on the value of diff --git a/interface/wx/validate.h b/interface/wx/validate.h index 7b458300fb..bdbe3aeea4 100644 --- a/interface/wx/validate.h +++ b/interface/wx/validate.h @@ -131,5 +131,5 @@ public: /** An empty, "null" wxValidator instance. */ -wxValidator wxDefaultValidator; +const wxValidator wxDefaultValidator; diff --git a/interface/wx/window.h b/interface/wx/window.h index ac715f76f7..4fe83f8585 100644 --- a/interface/wx/window.h +++ b/interface/wx/window.h @@ -50,6 +50,25 @@ enum wxShowEffect wxSHOW_EFFECT_EXPAND }; + + +/** + struct containing all the visual attributes of a control +*/ +struct wxVisualAttributes +{ + // the font used for control label/text inside it + wxFont font; + + // the foreground colour + wxColour colFg; + + // the background colour, may be wxNullColour if the controls background + // colour is not solid + wxColour colBg; +}; + + /** Different window variants, on platforms like eg mac uses different rendering sizes. @@ -295,6 +314,13 @@ public: virtual ~wxWindow(); + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxPanelNameStr); + /** @name Focus functions @@ -849,6 +875,11 @@ public: */ virtual wxSize GetMinSize() const; + int GetMinWidth() const; + int GetMinHeight() const; + int GetMaxWidth() const; + int GetMaxHeight() const; + /** Returns the size of the entire window in pixels, including title bar, border, scrollbars, etc. @@ -894,12 +925,31 @@ public: */ void GetVirtualSize(int* width, int* height) const; + /** + Return the largest of ClientSize and BestSize (as determined + by a sizer, interior children, or other means) + */ + virtual wxSize GetBestVirtualSize() const; + /** Returns the size of the left/right and top/bottom borders of this window in x and y components of the result respectively. */ virtual wxSize GetWindowBorderSize() const; + /** + wxSizer and friends use this to give a chance to a component to recalc + its min size once one of the final size components is known. Override + this function when that is useful (such as for wxStaticText which can + stretch over several lines). Parameter availableOtherDir + tells the item how much more space there is available in the opposite + direction (-1 if unknown). + */ + virtual bool + InformFirstDirection(int direction, + int size, + int availableOtherDir); + /** Resets the cached best size value so it will be recalculated the next time it is needed. @@ -976,6 +1026,11 @@ public: */ void SetClientSize(const wxSize& size); + /** + @overload + */ + void SetClientSize(const wxRect& rect); + /** This normally does not need to be called by user code. It is called when a window is added to a sizer, and is used so the window @@ -1131,9 +1186,12 @@ public: @see wxTopLevelWindow::SetSizeHints, @ref overview_windowsizing */ - void SetSizeHints( const wxSize& minSize, - const wxSize& maxSize=wxDefaultSize, - const wxSize& incSize=wxDefaultSize); + virtual void SetSizeHints( const wxSize& minSize, + const wxSize& maxSize=wxDefaultSize, + const wxSize& incSize=wxDefaultSize); + virtual void SetSizeHints( int minW, int minH, + int maxW = -1, int maxH = -1, + int incW = -1, int incH = -1 ); /** Sets the virtual size of the window in pixels. @@ -1197,20 +1255,6 @@ public: */ void CentreOnParent(int direction = wxBOTH); - /** - Centres the window. - - @param direction - Specifies the direction for the centring. May be wxHORIZONTAL, - wxVERTICAL or wxBOTH. It may also include the wxCENTRE_ON_SCREEN - flag. - - @remarks This function is not meant to be called directly by user code, - but via Centre, Center, CentreOnParent, or CenterOnParent. - This function can be overriden to fine-tune centring behaviour. - */ - virtual void DoCentre(int direction); - /** This gets the position of the window in pixels, relative to the parent window for the child windows or relative to the display origin for the top level windows. @@ -1272,6 +1316,20 @@ public: */ wxRect GetScreenRect() const; + /** + Get the origin of the client area of the window relative to the + window top left corner (the client area may be shifted because of + the borders, scrollbars, other decorations...) + */ + virtual wxPoint GetClientAreaOrigin() const; + + /** + Get the client rectangle in window (i.e. client) coordinates + */ + wxRect GetClientRect() const; + + + /** Moves the window to the given position. @@ -1310,6 +1368,8 @@ public: */ void Move(const wxPoint& pt, int flags = wxSIZE_USE_EXISTING); + void SetPosition(const wxPoint& pt); + //@} @@ -1557,7 +1617,7 @@ public: @endWxPerlOnly */ void GetTextExtent(const wxString& string, - int* w, int* h, + int* w, int* h, int* descent = NULL, int* externalLeading = NULL, const wxFont* font = NULL) const; @@ -1576,6 +1636,11 @@ public: */ const wxRegion& GetUpdateRegion() const; + /** + Get the update rectangle bounding box in client coords + */ + wxRect GetUpdateClientRect() const; + /** Returns @true if this window background is transparent (as, for example, for wxStaticText) and should show the parent window background. @@ -1777,6 +1842,10 @@ public: */ virtual void SetThemeEnabled(bool enable); + /** + */ + virtual bool GetThemeEnabled() const; + /** Returns @true if the system supports transparent windows and calling SetTransparent() may succeed. If this function returns @false, transparent @@ -2088,13 +2157,13 @@ public: control. See also wxNavigationKeyEvent and HandleAsNavigationKey. */ - bool Navigate(int flags = IsForward); + bool Navigate(int flags = wxNavigationKeyEvent::IsForward); /** Performs a keyboard navigation action inside this window. See Navigate() for more information. */ - bool NavigateIn(int flags = IsForward); + bool NavigateIn(int flags = wxNavigationKeyEvent::IsForward); //@} @@ -2784,7 +2853,6 @@ public: */ void SetConstraints(wxLayoutConstraints* constraints); - /** Invokes the constraint-based layout algorithm or the sizer-based algorithm for this window. @@ -2814,6 +2882,8 @@ public: */ void SetAutoLayout(bool autoLayout); + bool GetAutoLayout() const; + //@} @@ -2913,6 +2983,22 @@ public: */ //@{ + wxHitTest HitTest(wxCoord x, wxCoord y) const; + wxHitTest HitTest(const wxPoint& pt) const; + + /** + Get the window border style from the given flags: this is different from + simply doing flags & wxBORDER_MASK because it uses GetDefaultBorder() to + translate wxBORDER_DEFAULT to something reasonable + */ + wxBorder GetBorder(long flags) const; + + /** + Get border for the flags of this window + */ + wxBorder GetBorder() const; + + /** Does the window-specific updating after processing the update event. This function is called by UpdateWindowUI() in order to check return @@ -2997,6 +3083,8 @@ public: */ virtual bool IsDoubleBuffered() const; + void SetDoubleBuffered(bool on); + /** Returns @true if the window is retained, @false otherwise. @@ -3030,6 +3118,7 @@ public: */ virtual void MakeModal(bool modal = true); + /** This virtual function is normally only used internally, but sometimes an application may need it to implement functionality @@ -3266,6 +3355,20 @@ public: protected: + /** + Centres the window. + + @param direction + Specifies the direction for the centring. May be wxHORIZONTAL, + wxVERTICAL or wxBOTH. It may also include the wxCENTRE_ON_SCREEN + flag. + + @remarks This function is not meant to be called directly by user code, + but via Centre, Center, CentreOnParent, or CenterOnParent. + This function can be overriden to fine-tune centring behaviour. + */ + virtual void DoCentre(int direction); + /** 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 -- 2.45.2