X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/997176a34641a870b1f6c6102e30f64f86b4122a..3dece6c4bc6b3952cf2e3c77ca52081a443677be:/include/wx/control.h diff --git a/include/wx/control.h b/include/wx/control.h index e4bd239801..ce8aabe406 100644 --- a/include/wx/control.h +++ b/include/wx/control.h @@ -5,7 +5,7 @@ // Modified by: // Created: 26.07.99 // RCS-ID: $Id$ -// Copyright: (c) wxWindows team +// Copyright: (c) wxWidgets team // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -16,17 +16,13 @@ // headers // ---------------------------------------------------------------------------- -#if defined(__GNUG__) && !defined(__APPLE__) - #pragma interface "controlbase.h" -#endif - #include "wx/defs.h" #if wxUSE_CONTROLS #include "wx/window.h" // base class -WXDLLEXPORT_DATA(extern const wxChar*) wxControlNameStr; +extern WXDLLEXPORT_DATA(const wxChar) wxControlNameStr[]; // ---------------------------------------------------------------------------- // wxControl is the base class for all controls @@ -35,6 +31,8 @@ WXDLLEXPORT_DATA(extern const wxChar*) wxControlNameStr; class WXDLLEXPORT wxControlBase : public wxWindow { public: + wxControlBase() { } + virtual ~wxControlBase(); // Create() function adds the validator parameter @@ -45,12 +43,35 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxControlNameStr); + // get the control alignment (left/right/centre, top/bottom/centre) + int GetAlignment() const { return m_windowStyle & wxALIGN_MASK; } + + + // controls by default inherit the colours of their parents, if a + // particular control class doesn't want to do it, it can override + // ShouldInheritColours() to return false + virtual bool ShouldInheritColours() const { return true; } + + + // WARNING: this doesn't work for all controls nor all platforms! + // // simulates the event of given type (i.e. wxButton::Command() is just as // if the button was clicked) virtual void Command(wxCommandEvent &event); - // get the control alignment (left/right/centre, top/bottom/centre) - int GetAlignment() const { return m_windowStyle & wxALIGN_MASK; } + virtual void SetLabel( const wxString &label ); + virtual bool SetFont(const wxFont& font); + + // Reserved for future use + virtual void ReservedControlFunc1() {} + virtual void ReservedControlFunc2() {} + virtual void ReservedControlFunc3() {} + virtual void ReservedControlFunc4() {} + virtual void ReservedControlFunc5() {} + virtual void ReservedControlFunc6() {} + virtual void ReservedControlFunc7() {} + virtual void ReservedControlFunc8() {} + virtual void ReservedControlFunc9() {} protected: // creates the control (calls wxWindowBase::CreateBase inside) and adds it @@ -63,11 +84,21 @@ protected: const wxValidator& validator, const wxString& name); - // inherit colour and font settings from the parent window - void InheritAttributes(); - // initialize the common fields of wxCommandEvent void InitCommandEvent(wxCommandEvent& event) const; + + // 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() 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& size) + { + SetBestSize(size); + } + + DECLARE_NO_COPY_CLASS(wxControlBase) }; // ---------------------------------------------------------------------------- @@ -76,6 +107,8 @@ protected: #if defined(__WXUNIVERSAL__) #include "wx/univ/control.h" +#elif defined(__WXPALMOS__) + #include "wx/palmos/control.h" #elif defined(__WXMSW__) #include "wx/msw/control.h" #elif defined(__WXMOTIF__)