X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/238b33ab0e8c53a871998f385e957313eef2d804..66c2bf7b1d9326fb650acfaae22ec50528cfbf7c:/include/wx/combo.h?ds=sidebyside diff --git a/include/wx/combo.h b/include/wx/combo.h index 9c38cda211..4bae2cfea6 100644 --- a/include/wx/combo.h +++ b/include/wx/combo.h @@ -4,7 +4,6 @@ // Author: Jaakko Salli // Modified by: // Created: Apr-30-2006 -// RCS-ID: $Id$ // Copyright: (c) Jaakko Salli // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -87,7 +86,7 @@ enum wxCC_IFLAG_CREATED = 0x0100, // Internal use: really put button outside wxCC_IFLAG_BUTTON_OUTSIDE = 0x0200, - // Internal use: SetMargins has been succesfully called + // Internal use: SetMargins has been successfully called wxCC_IFLAG_LEFT_MARGIN_SET = 0x0400, // Internal use: Set wxTAB_TRAVERSAL to parent when popup is dismissed wxCC_IFLAG_PARENT_TAB_TRAVERSAL = 0x0800, @@ -445,6 +444,9 @@ public: // Return true if Create has finished bool IsCreated() const { return m_iFlags & wxCC_IFLAG_CREATED ? true : false; } + // Need to override to return text area background colour + wxColour GetBackgroundColour() const; + // common code to be called on popup hide/dismiss void OnPopupDismiss(bool generateEvent); @@ -468,6 +470,10 @@ public: virtual wxWindow *GetMainWindowOfCompositeControl() { return m_mainCtrlWnd; } + // also set the embedded wxTextCtrl colours + virtual bool SetForegroundColour(const wxColour& colour); + virtual bool SetBackgroundColour(const wxColour& colour); + protected: // Returns true if hint text should be drawn in the control @@ -538,11 +544,10 @@ protected: void DestroyPopup(); // override the base class virtuals involved in geometry calculations + // The common version only sets a default width, so the derived classes + // should override it and set the height and change the width as needed. virtual wxSize DoGetBestSize() const; - - // also set the embedded wxTextCtrl colours - virtual bool SetForegroundColour(const wxColour& colour); - virtual bool SetBackgroundColour(const wxColour& colour); + virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const; // NULL popup can be used to indicate default in a derived class virtual void DoSetPopupControl(wxComboPopup* popup); @@ -557,7 +562,8 @@ protected: // Standard textctrl positioning routine. Just give it platform-dependant // textctrl coordinate adjustment. - virtual void PositionTextCtrl( int textCtrlXAdjust, int textCtrlYAdjust ); + virtual void PositionTextCtrl( int textCtrlXAdjust = 0, + int textCtrlYAdjust = 0); // event handlers void OnSizeEvent( wxSizeEvent& event ); @@ -638,7 +644,7 @@ protected: // main (ie. topmost) window of a composite control (default = this) wxWindow* m_mainCtrlWnd; - // used to prevent immediate re-popupping incase closed popup + // used to prevent immediate re-popupping in case closed popup // by clicking on the combo control (needed because of inconsistent // transient implementation across platforms). wxLongLong m_timeCanAcceptClick; @@ -671,6 +677,9 @@ protected: wxRect m_tcArea; wxRect m_btnArea; + // Colour of the text area, in case m_text is NULL + wxColour m_tcBgCol; + // current button state (uses renderer flags) int m_btnState; @@ -707,6 +716,9 @@ protected: // should the focus be reset to the textctrl in idle time? bool m_resetFocus; + // is the text-area background colour overridden? + bool m_hasTcBgCol; + private: void Init(); @@ -758,6 +770,13 @@ public: // Return true for success. virtual bool Create(wxWindow* parent) = 0; + // Calls Destroy() for the popup control (i.e. one returned by + // GetControl()) and makes sure that 'this' is deleted at the end. + // Default implementation works for both cases where popup control + // class is multiple inherited or created on heap as a separate + // object. + virtual void DestroyPopup(); + // We must have an associated control which is subclassed by the combobox. virtual wxWindow *GetControl() = 0;