X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b8e7b6738fe00529fdeae26e6cfea1ccc2a00a76..9e152a55785098472ca1c0df110ad0a1203f710f:/include/wx/window.h?ds=sidebyside diff --git a/include/wx/window.h b/include/wx/window.h index 63b37aedc4..3370fa75b2 100644 --- a/include/wx/window.h +++ b/include/wx/window.h @@ -5,7 +5,7 @@ // Modified by: Ron Lee // Created: 01/02/97 // RCS-ID: $Id$ -// Copyright: (c) wxWindows team +// Copyright: (c) wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -93,7 +93,7 @@ struct WXDLLEXPORT wxVisualAttributes // different window variants, on platforms like eg mac uses different // rendering sizes -enum wxWindowVariant +enum wxWindowVariant { wxWINDOW_VARIANT_NORMAL, // Normal size wxWINDOW_VARIANT_SMALL, // Smaller size (about 25 % smaller than normal) @@ -168,7 +168,7 @@ public: // window attributes // ----------------- - // NB: in future versions of wxWindows Set/GetTitle() will only work + // NB: in future versions of wxWidgets Set/GetTitle() will only work // with the top level windows (such as dialogs and frames) and // Set/GetLabel() only with the other ones (i.e. all controls). @@ -190,7 +190,7 @@ public: // sets the window variant, calls internally DoSetVariant if variant has changed void SetWindowVariant( wxWindowVariant variant ) ; wxWindowVariant GetWindowVariant() const { return m_windowVariant ; } - + // window id uniquely identifies the window among its siblings unless // it is -1 which means "don't care" @@ -365,7 +365,7 @@ public: // Override this method to control the values given to Sizers etc. virtual wxSize GetMaxSize() const { return wxSize( m_maxWidth, m_maxHeight ); } virtual wxSize GetMinSize() const { return wxSize( m_minWidth, m_minHeight ); } - + // Methods for accessing the virtual size of a window. For most // windows this is just the client area of the window, but for // some like scrolled windows it is more or less independent of @@ -453,7 +453,7 @@ public: // not all windows/controls can do this without looking wrong. virtual void ApplyParentThemeBackground(const wxColour& WXUNUSED(bg)) { /* do nothing */ } - + // focus and keyboard handling // --------------------------- @@ -489,6 +489,9 @@ public: // set this child as temporary default virtual void SetTmpDefaultItem(wxWindow * WXUNUSED(win)) { } + // Navigates in the specified direction by sending a wxNavigationKeyEvent + virtual bool Navigate(bool direction = true, bool windowChange = false); + // parent/children relations // ------------------------- @@ -804,9 +807,9 @@ public: virtual void DoUpdateWindowUI(wxUpdateUIEvent& event) ; #if wxUSE_MENUS - bool PopupMenu( wxMenu *menu, const wxPoint& pos ) + bool PopupMenu(wxMenu *menu, const wxPoint& pos = wxDefaultPosition) { return DoPopupMenu(menu, pos.x, pos.y); } - bool PopupMenu( wxMenu *menu, int x, int y ) + bool PopupMenu(wxMenu *menu, int x, int y) { return DoPopupMenu(menu, x, y); } #endif // wxUSE_MENUS @@ -931,17 +934,7 @@ public: wxSizer *GetSizer() const { return m_windowSizer; } // Track if this window is a member of a sizer - void SetContainingSizer(wxSizer* sizer) - { - // adding a window to a sizer twice is going to result in fatal and - // hard to debug problems later because when deleting the second - // associated wxSizerItem we're going to dereference a dangling - // pointer; so try to detect this as early as possible - wxASSERT_MSG( !sizer || m_containingSizer != sizer, - _T("Adding a window to the same sizer twice?") ); - - m_containingSizer = sizer; - } + void SetContainingSizer(wxSizer* sizer); wxSizer *GetContainingSizer() const { return m_containingSizer; } // accessibility @@ -999,11 +992,6 @@ public: wxWindow *GetAncestorWithCustomPalette() const; #endif // wxUSE_PALETTE -protected: - // event handling specific to wxWindow - virtual bool TryValidator(wxEvent& event); - virtual bool TryParent(wxEvent& event); - // inherit the parents visual attributes if they had been explicitly set // by the user (i.e. we don't inherit default attributes) and if we don't // have our own explicitly set @@ -1016,6 +1004,11 @@ protected: // behaviour in the most common case virtual bool ShouldInheritColours() const { return false; } +protected: + // event handling specific to wxWindow + virtual bool TryValidator(wxEvent& event); + virtual bool TryParent(wxEvent& event); + #if wxUSE_CONSTRAINTS // satisfy the constraints for the windows but don't set the window sizes @@ -1120,8 +1113,6 @@ protected: #if wxUSE_ACCESSIBILITY wxAccessible* m_accessible; #endif - // Best size for controls which fail to implement DoGetBestSize() - wxSize m_bestSize; // Virtual size (scrolling) wxSize m_virtualSize; @@ -1130,7 +1121,7 @@ protected: int m_minVirtualHeight; int m_maxVirtualWidth; int m_maxVirtualHeight; - + wxWindowVariant m_windowVariant ; // override this to change the default (i.e. used when no style is @@ -1150,22 +1141,17 @@ protected: // smarter SetSize / convenience function for expanding wxDefaultSize. // Note that it does not influence the value returned by GetBestSize // at all. - void SetBestSize(const wxSize& size) - { - // the size only needs to be changed if the current size is incomplete, - // i.e. one of the components was specified as default -- so if both - // were given, simply don't do anything - if ( size.x == -1 || size.y == -1 ) - { - wxSize sizeBest = DoGetBestSize(); - if ( size.x != -1 ) - sizeBest.x = size.x; - if ( size.y != -1 ) - sizeBest.y = size.y; - - SetSize(sizeBest); - } - } + void SetBestSize(const wxSize& size); + + // set the initial window size if none is given (i.e. at least one of the + // components of the size passed to ctor/Create() is -1) + // + // normally just calls SetBestSize() for controls, but can be overridden + // not to do it for the controls which have to do some additional + // initialization (e.g. add strings to list box) before their best size + // can be accurately calculated + virtual void SetInitialBestSize(const wxSize& WXUNUSED(size)) {} + // more pure virtual functions // --------------------------- @@ -1220,7 +1206,7 @@ protected: #endif // wxUSE_TOOLTIPS #if wxUSE_MENUS - virtual bool DoPopupMenu( wxMenu *menu, int x, int y ) = 0; + virtual bool DoPopupMenu(wxMenu *menu, int x, int y) = 0; #endif // wxUSE_MENUS // Makes an adjustment to the window position to make it relative to the