X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4427c0a3ff15545c46f97a217a1dc947099d4a40..6541fd4b27a68035f7f9f2325fca0aa025a35943:/include/wx/combo.h diff --git a/include/wx/combo.h b/include/wx/combo.h index a504c1543e..2ac66cda0a 100644 --- a/include/wx/combo.h +++ b/include/wx/combo.h @@ -46,8 +46,8 @@ #include "wx/renderer.h" // this is needed for wxCONTROL_XXX flags #include "wx/bitmap.h" // wxBitmap used by-value -class WXDLLIMPEXP_CORE wxTextCtrl; -class WXDLLEXPORT wxComboPopup; +class WXDLLIMPEXP_FWD_CORE wxTextCtrl; +class WXDLLIMPEXP_FWD_CORE wxComboPopup; // // New window styles for wxComboCtrlBase @@ -75,6 +75,12 @@ enum wxCC_POPUP_ON_MOUSE_UP = 0x0002, // All text is not automatically selected on click wxCC_NO_TEXT_AUTO_SELECT = 0x0004, + // Drop-button stays down as long as popup is displayed. + wxCC_BUTTON_STAYS_DOWN = 0x0008, + // Drop-button covers the entire control. + wxCC_FULL_BUTTON = 0x0010, + // Drop-button goes over the custom-border (used under WinVista). + wxCC_BUTTON_COVERS_BORDER = 0x0020, // Internal use: signals creation is complete wxCC_IFLAG_CREATED = 0x0100, @@ -87,7 +93,10 @@ enum // Internal use: Secondary popup window type should be used (if available). wxCC_IFLAG_USE_ALT_POPUP = 0x1000, // Internal use: Skip popup animation. - wxCC_IFLAG_DISABLE_POPUP_ANIM = 0x2000 + 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). + wxCC_IFLAG_HAS_NONSTANDARD_BUTTON = 0x4000 }; @@ -128,7 +137,7 @@ struct wxComboCtrlFeatures }; -class WXDLLEXPORT wxComboCtrlBase : public wxControl +class WXDLLIMPEXP_CORE wxComboCtrlBase : public wxControl { friend class wxComboPopup; public: @@ -184,6 +193,10 @@ public: virtual bool Enable(bool enable = true); virtual bool Show(bool show = true); virtual bool SetFont(const wxFont& font); +#if wxUSE_VALIDATORS + virtual void SetValidator(const wxValidator &validator); + virtual wxValidator *GetValidator(); +#endif // wxUSE_VALIDATORS // wxTextCtrl methods - for readonly combo they should return // without errors. @@ -361,8 +374,8 @@ public: bool ShouldDrawFocus() const { const wxWindow* curFocus = FindFocus(); - return ( !IsPopupShown() && - (curFocus == this || (m_btn && curFocus == m_btn)) && + return ( IsPopupWindowState(Hidden) && + (curFocus == m_mainCtrlWnd || (m_btn && curFocus == m_btn)) && (m_windowStyle & wxCB_READONLY) ); } @@ -397,6 +410,10 @@ public: // Set value returned by GetMainWindowOfCompositeControl void SetCtrlMainWnd( wxWindow* wnd ) { m_mainCtrlWnd = wnd; } + // This is public so we can access it from wxComboCtrlTextCtrl + virtual wxWindow *GetMainWindowOfCompositeControl() + { return m_mainCtrlWnd; } + protected: // @@ -419,8 +436,16 @@ protected: // Installs standard input handler to combo (and optionally to the textctrl) void InstallInputHandlers(); + // Flags for DrawButton + enum + { + Button_PaintBackground = 0x0001, // Paints control background below the button + Button_BitmapOnly = 0x0002 // Only paints the bitmap + }; + // Draws dropbutton. Using wxRenderer or bitmaps, as appropriate. - void DrawButton( wxDC& dc, const wxRect& rect, bool paintBg = true ); + // Flags are defined above. + virtual void DrawButton( wxDC& dc, const wxRect& rect, int flags = Button_PaintBackground ); // Call if cursor is on button area or mouse is captured for the button. //bool HandleButtonMouseEvent( wxMouseEvent& event, bool isInside ); @@ -459,11 +484,12 @@ protected: // Standard textctrl positioning routine. Just give it platform-dependant // textctrl coordinate adjustment. - void PositionTextCtrl( int textCtrlXAdjust, int textCtrlYAdjust ); + virtual void PositionTextCtrl( int textCtrlXAdjust, int textCtrlYAdjust ); // event handlers void OnSizeEvent( wxSizeEvent& event ); void OnFocusEvent(wxFocusEvent& event); + void OnIdleEvent(wxIdleEvent& event); void OnTextCtrlEvent(wxCommandEvent& event); void OnSysColourChanged(wxSysColourChangedEvent& event); void OnKeyEvent(wxKeyEvent& event); @@ -495,9 +521,6 @@ protected: virtual void DoSetToolTip( wxToolTip *tip ); #endif - virtual wxWindow *GetMainWindowOfCompositeControl() - { return m_mainCtrlWnd; } - // This is used when m_text is hidden (readonly). wxString m_valueString; @@ -592,6 +615,9 @@ protected: // is the popup window currenty shown? wxByte m_popupWinState; + // should the focus be reset to the textctrl in idle time? + bool m_resetFocus; + private: void Init(); @@ -618,14 +644,16 @@ enum wxCP_IFLAG_CREATED = 0x0001 // Set by wxComboCtrlBase after Create is called }; +class WXDLLIMPEXP_FWD_CORE wxComboCtrl; + -class WXDLLEXPORT wxComboPopup +class WXDLLIMPEXP_CORE wxComboPopup { friend class wxComboCtrlBase; public: wxComboPopup() { - m_combo = (wxComboCtrlBase*) NULL; + m_combo = NULL; m_iFlags = 0; } @@ -633,7 +661,7 @@ public: // variable has been initialized before the call. // NOTE: It is not in constructor so the derived class doesn't need to redefine // a default constructor of its own. - virtual void Init() { }; + virtual void Init() { } virtual ~wxComboPopup(); @@ -695,6 +723,9 @@ public: return (m_iFlags & wxCP_IFLAG_CREATED) ? true : false; } + // Returns pointer to the associated parent wxComboCtrl. + wxComboCtrl* GetComboCtrl() const; + // Default PaintComboControl behaviour static void DefaultPaintComboControl( wxComboCtrlBase* combo, wxDC& dc,