X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5f54075053e041086bb71f107c3d70faedf0d9b9..323d36e452c48f1e48ffe48312004d5e224634ca:/include/wx/combo.h diff --git a/include/wx/combo.h b/include/wx/combo.h index 718adde355..6a190e524a 100644 --- a/include/wx/combo.h +++ b/include/wx/combo.h @@ -95,7 +95,8 @@ enum // Internal use: Skip popup animation. wxCC_IFLAG_DISABLE_POPUP_ANIM = 0x2000, // Internal use: Drop-button is a bitmap button or has non-default size - // (but can still be on either side of the control). + // (but can still be on either side of the control), regardless whether + // specified by the platform or the application. wxCC_IFLAG_HAS_NONSTANDARD_BUTTON = 0x4000 }; @@ -141,6 +142,7 @@ struct wxComboCtrlFeatures class WXDLLIMPEXP_CORE wxComboCtrlBase : public wxControl { friend class wxComboPopup; + friend class wxComboPopupEvtHandler; public: // ctors and such wxComboCtrlBase() : wxControl() { Init(); } @@ -385,6 +387,10 @@ public: const wxBitmap& GetBitmapHover() const { return m_bmpHover; } const wxBitmap& GetBitmapDisabled() const { return m_bmpDisabled; } + // Hint functions mirrored from TextEntryBase + virtual bool SetHint(const wxString& hint); + virtual wxString GetHint() const; + // Margins functions mirrored from TextEntryBase // (wxComboCtrl does not inherit from wxTextEntry, but may embed a // wxTextCtrl, so we need these). Also note that these functions @@ -396,6 +402,10 @@ public: wxPoint GetMargins() const { return DoGetMargins(); } + // Set custom style flags for embedded wxTextCtrl. Usually must be used + // with two-step creation, before Create() call. + void SetTextCtrlStyle( int style ); + // Return internal flags wxUint32 GetInternalFlags() const { return m_iFlags; } @@ -427,6 +437,16 @@ public: protected: + // Returns true if hint text should be drawn in the control + bool ShouldUseHintText(int flags = 0) const + { + return ( !m_text && + !(flags & wxCONTROL_ISSUBMENU) && + !m_valueString.length() && + m_hintText.length() && + !ShouldDrawFocus() ); + } + // // Override these for customization purposes // @@ -509,6 +529,7 @@ protected: void OnTextCtrlEvent(wxCommandEvent& event); void OnSysColourChanged(wxSysColourChangedEvent& event); void OnKeyEvent(wxKeyEvent& event); + void OnCharEvent(wxKeyEvent& event); // Set customization flags (directs how wxComboCtrlBase helpers behave) void Customize( wxUint32 flags ) { m_iFlags |= flags; } @@ -544,6 +565,9 @@ protected: // This is used when m_text is hidden (readonly). wxString m_valueString; + // This is used when control is unfocused and m_valueString is empty + wxString m_hintText; + // the text control and button we show all the time wxTextCtrl* m_text; wxWindow* m_btn; @@ -564,7 +588,7 @@ protected: wxEvtHandler* m_toplevEvtHandler; // this is for the control in popup - wxEvtHandler* m_popupExtraHandler; + wxEvtHandler* m_popupEvtHandler; // this is for the popup window wxEvtHandler* m_popupWinEvtHandler; @@ -629,6 +653,9 @@ protected: // platform-dependant customization and other flags wxUint32 m_iFlags; + // custom style for m_text + int m_textCtrlStyle; + // draw blank button background under bitmap? bool m_blankButtonBg; @@ -709,10 +736,14 @@ public: // Default implementation draws value as string. virtual void PaintComboControl( wxDC& dc, const wxRect& rect ); - // Receives key events from the parent wxComboCtrl. + // Receives wxEVT_KEY_DOWN key events from the parent wxComboCtrl. // Events not handled should be skipped, as usual. virtual void OnComboKeyEvent( wxKeyEvent& event ); + // Receives wxEVT_CHAR key events from the parent wxComboCtrl. + // Events not handled should be skipped, as usual. + virtual void OnComboCharEvent( wxKeyEvent& event ); + // Implement if you need to support special action when user // double-clicks on the parent wxComboCtrl. virtual void OnComboDoubleClick();