00001
00002
00003
00004
00005
00006
00007
00008
00009
00011
00012 #ifndef _WX_PROPGRID_ODCOMBO_H_
00013 #define _WX_PROPGRID_ODCOMBO_H_
00014
00015 #ifndef DOXYGEN
00016
00017 #include "wx/renderer.h"
00018
00019
00020
00021 #if wxCHECK_VERSION(2,7,0)
00022 #define wxODCCount unsigned int
00023 #define wxODCIndex unsigned int
00024 #else
00025 #define wxODCCount int
00026 #define wxODCIndex int
00027 #endif
00028
00029
00030 class WXDLLEXPORT wxTextCtrl;
00031 class WXDLLEXPORT wxButton;
00032
00033 #ifdef WXMAKINGLIB_PROPGRID
00034 #define WXDLLEXPORT_PGODC
00035 #elif defined(WXMAKINGDLL_PROPGRID)
00036 #define WXDLLEXPORT_PGODC WXEXPORT
00037 #elif defined(WXUSINGDLL)
00038 #define WXDLLEXPORT_PGODC WXIMPORT
00039 #else // not making nor using DLL
00040 #define WXDLLEXPORT_PGODC
00041 #endif
00042
00043 #define wxODComboBoxNameStr wxT("wxOwnerDrawnComboBox")
00044
00045 class WXDLLEXPORT_PGODC wxPGComboPopup;
00046 class WXDLLEXPORT_PGODC wxPGComboControlBase;
00047 class WXDLLEXPORT_PGODC wxPGOwnerDrawnComboBox;
00048
00049
00050
00051
00052
00053
00054
00055 enum
00056 {
00057
00058 wxPGCC_DCLICK_CYCLES = 0x0100,
00059
00060
00061
00062 wxPGCC_ALT_KEYS = 0x0200
00063 };
00064
00065 #define wxPGCC_PROCESS_ENTER 0
00066
00067
00068
00069
00070
00071
00072
00073
00074 enum
00075 {
00076
00077
00078
00079
00080 wxPGCC_BUTTON_OUTSIDE_BORDER = 0x0001,
00081
00082 wxPGCC_POPUP_ON_MOUSE_UP = 0x0002,
00083
00084 wxPGCC_NO_TEXT_AUTO_SELECT = 0x0004,
00085
00086 wxPGCC_BUTTON_STAYS_DOWN = 0x0008,
00087
00088 wxPGCC_FULL_BUTTON = 0x0010,
00089
00090
00091 wxPGCC_IFLAG_CREATED = 0x0100,
00092
00093 wxPGCC_IFLAG_BUTTON_OUTSIDE = 0x0200,
00094
00095 wxPGCC_IFLAG_INDENT_SET = 0x0400,
00096
00097 wxPGCC_IFLAG_PARENT_TAB_TRAVERSAL = 0x0800,
00098
00099 wxPGCC_IFLAG_HAS_NONSTANDARD_BUTTON = 0x1000
00100 };
00101
00102
00103
00104 enum
00105 {
00106 wxPGCC_MF_ON_BUTTON = 0x0001,
00107 };
00108
00109
00110
00111 struct wxPGComboControlFeatures
00112 {
00113 enum
00114 {
00115 MovableButton = 0x0001,
00116 BitmapButton = 0x0002,
00117 ButtonSpacing = 0x0004,
00118
00119 TextIndent = 0x0008,
00120 PaintControl = 0x0010,
00121 PaintWritable = 0x0020,
00122
00123
00124 Borderless = 0x0040,
00125
00126
00127
00128
00129
00130 All = MovableButton|BitmapButton|
00131 ButtonSpacing|TextIndent|
00132 PaintControl|PaintWritable|
00133 Borderless,
00134 };
00135 };
00136
00137
00138 class wxPGComboPopupWindow;
00139
00140
00141 class WXDLLEXPORT_PGODC wxPGComboControlBase : public wxControl
00142 {
00143 friend class wxPGComboPopup;
00144 friend class wxPGComboPopupWindow;
00145 public:
00146
00147 wxPGComboControlBase() : wxControl() { Init(); }
00148
00149 bool Create(wxWindow *parent,
00150 wxWindowID id,
00151 const wxString& value,
00152 const wxPoint& pos,
00153 const wxSize& size,
00154 long style,
00155 const wxValidator& validator,
00156 const wxString& name);
00157
00158 virtual ~wxPGComboControlBase();
00159
00160 virtual bool Destroy();
00161
00162
00163 virtual void ShowPopup();
00164 virtual void HidePopup();
00165
00166
00167 virtual void OnButtonClick();
00168
00169
00170 inline bool IsPopupShown() const { return m_isPopupShown; }
00171
00172
00173 void SetPopup( wxPGComboPopup* iface );
00174
00175
00176 wxPGComboPopup* GetPopup() const { return m_popupInterface; }
00177
00178
00179 wxWindow *GetPopupWindow() const { return m_winPopup; }
00180
00181
00182 wxWindow *GetPopupControl() const { return m_popup; }
00183
00184
00185 inline wxTextCtrl *GetTextCtrl() const { return m_text; }
00186
00187
00188
00189 inline wxWindow *GetButton() const { return m_btn; }
00190
00191
00192 virtual bool Enable(bool enable = true);
00193 virtual bool Show(bool show = true);
00194 virtual bool SetFont(const wxFont& font);
00195 #if wxUSE_TOOLTIPS
00196 virtual void DoSetToolTip( wxToolTip *tip );
00197 #endif
00198
00199
00200
00201 virtual wxString GetValue() const;
00202 virtual void SetValue(const wxString& value);
00203 void SetText(const wxString& value)
00204 {
00205 SetValue(value);
00206 }
00207 virtual void Copy();
00208 virtual void Cut();
00209 virtual void Paste();
00210 virtual void SetInsertionPoint(long pos);
00211 virtual void SetInsertionPointEnd();
00212 virtual long GetInsertionPoint() const;
00213 virtual long GetLastPosition() const;
00214 virtual void Replace(long from, long to, const wxString& value);
00215 virtual void Remove(long from, long to);
00216 virtual void SetSelection(long from, long to);
00217 virtual void Undo();
00218
00219
00220 inline const wxRect& GetTextRect() const
00221 {
00222 return m_tcArea;
00223 }
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233 inline void SetPopupMinWidth( int width )
00234 {
00235 m_widthMinPopup = width;
00236 }
00237
00238
00239
00240
00241
00242 inline void SetPopupMaxHeight( int height )
00243 {
00244 m_heightPopup = height;
00245 }
00246
00247
00248
00249
00250
00251
00252 inline void SetPopupExtents( int extLeft, int extRight )
00253 {
00254 m_extLeft = extLeft;
00255 m_extRight = extRight;
00256 }
00257
00258
00259
00260
00261
00262 void SetCustomPaintWidth( int width );
00263 inline int GetCustomPaintWidth() const { return m_widthCustomPaint; }
00264
00265
00266
00267
00268
00269
00270
00271
00272 void SetButtonPosition( int width = 0, int height = 0, int side = wxRIGHT,
00273 int spacingX = 0 );
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287 void SetButtonBitmaps( const wxBitmap& bmpNormal,
00288 bool blankButtonBg = false,
00289 const wxBitmap& bmpPressed = wxNullBitmap,
00290 const wxBitmap& bmpHover = wxNullBitmap,
00291 const wxBitmap& bmpDisabled = wxNullBitmap );
00292
00293
00294
00295
00296
00297
00298
00299 void SetTextIndent( int indent );
00300
00301
00302 inline wxCoord GetTextIndent() const
00303 {
00304 return m_absIndent;
00305 }
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319 virtual void DrawFocusBackground( wxDC& dc, const wxRect& rect, int flags );
00320
00321
00322
00323 bool IsFocused() const
00324 {
00325 const wxWindow* curFocus = FindFocus();
00326 if ( curFocus == this || (m_text && curFocus == m_text) )
00327 return true;
00328
00329 return false;
00330 }
00331
00332
00333 inline bool ShouldDrawFocus() const
00334 {
00335 const wxWindow* curFocus = FindFocus();
00336 return ( !m_isPopupShown &&
00337 (curFocus == this || (m_btn && curFocus == m_btn)) &&
00338 (m_windowStyle & wxCB_READONLY) );
00339 }
00340
00341
00342 inline const wxBitmap& GetBitmapNormal() const { return m_bmpNormal; }
00343 inline const wxBitmap& GetBitmapPressed() const { return m_bmpPressed; }
00344 inline const wxBitmap& GetBitmapHover() const { return m_bmpHover; }
00345 inline const wxBitmap& GetBitmapDisabled() const { return m_bmpDisabled; }
00346
00347
00348 inline wxUint32 GetInternalFlags() const { return m_iFlags; }
00349
00350
00351 inline bool IsCreated() const { return m_iFlags & wxPGCC_IFLAG_CREATED ? true : false; }
00352
00353
00354
00355
00356
00357
00358 virtual bool OnDrawItem( wxDC& dc, const wxRect& rect, int item, int flags ) const;
00359
00360
00361 virtual wxCoord OnMeasureItem( size_t item ) const;
00362
00363
00364 virtual wxCoord OnMeasureItemWidth( size_t item ) const;
00365
00366
00367
00368 inline bool ConsumingTextCtrlFocusEvent()
00369 {
00370 if ( m_skipTextCtrlFocusEvents == 0 )
00371 return true;
00372
00373 m_skipTextCtrlFocusEvents--;
00374 return false;
00375 }
00376
00377
00378
00379
00380
00381
00382
00383 protected:
00384
00385
00386
00387
00388
00389
00390 virtual void OnResize() = 0;
00391
00392
00393 virtual wxCoord GetNativeTextIndent() const;
00394
00395
00396 virtual void OnThemeChange();
00397
00398
00399
00400 void CreateTextCtrl( int extraStyle, const wxValidator& validator );
00401
00402
00403 void InstallInputHandlers();
00404
00405
00406 enum
00407 {
00408 Button_PaintBackground = 0x0001,
00409 Button_BitmapOnly = 0x0002
00410 };
00411
00412
00413
00414 void DrawButton( wxDC& dc, const wxRect& rect, int flags = Button_PaintBackground );
00415
00416
00417
00418 bool HandleButtonMouseEvent( wxMouseEvent& event, int flags );
00419
00420
00421
00422
00423 bool PreprocessMouseEvent( wxMouseEvent& event, int flags );
00424
00425
00426
00427
00428
00429
00430
00431 void HandleNormalMouseEvent( wxMouseEvent& event );
00432
00433
00434 void CreatePopup();
00435
00436
00437 void OnPopupDismiss();
00438
00439
00440
00441
00442
00443 virtual void DoMoveWindow(int x, int y, int width, int height);
00444 virtual wxSize DoGetBestSize() const;
00445
00446
00447
00448
00449 void CalculateAreas( int btnWidth = 0 );
00450
00451
00452
00453 virtual void PositionTextCtrl( int textCtrlXAdjust, int textCtrlYAdjust );
00454
00455
00456 void OnSizeEvent(wxSizeEvent& event);
00457 void OnFocusEvent(wxFocusEvent& event);
00458 void OnKeyEvent(wxKeyEvent& event);
00459 void OnTextCtrlEvent(wxCommandEvent& event);
00460 void OnSysColourChanged(wxSysColourChangedEvent& event);
00461
00462
00463 void Customize( wxUint32 flags ) { m_iFlags |= flags; }
00464
00465
00466 void RecalcAndRefresh();
00467
00468
00469
00470 wxString m_valueString;
00471
00472
00473 wxTextCtrl* m_text;
00474 wxWindow* m_btn;
00475
00476
00477 wxWindow* m_winPopup;
00478
00479
00480 wxWindow* m_popup;
00481
00482
00483 wxPGComboPopup* m_popupInterface;
00484
00485
00486 wxEvtHandler* m_textEvtHandler;
00487
00488
00489 wxEvtHandler* m_toplevEvtHandler;
00490
00491
00492 wxEvtHandler* m_popupExtraHandler;
00493
00494
00495
00496
00497
00498
00499
00500 wxLongLong m_timeCanAcceptClick;
00501
00502
00503 wxCoord m_extLeft;
00504 wxCoord m_extRight;
00505
00506
00507 wxCoord m_widthMinPopup;
00508
00509
00510 wxCoord m_heightPopup;
00511
00512
00513
00514
00515 wxCoord m_widthCustomPaint;
00516
00517
00518 wxCoord m_absIndent;
00519
00520
00521 wxCoord m_widthCustomBorder;
00522
00523
00524 wxRect m_tcArea;
00525 wxRect m_btnArea;
00526
00527
00528 int m_btnState;
00529
00530
00531 int m_btnWid;
00532 int m_btnHei;
00533 int m_btnSide;
00534 int m_btnSpacingX;
00535
00536
00537 int m_btnWidDefault;
00538
00539
00540 wxBitmap m_bmpNormal;
00541 wxBitmap m_bmpPressed;
00542 wxBitmap m_bmpHover;
00543 wxBitmap m_bmpDisabled;
00544
00545
00546 wxSize m_btnSize;
00547
00548
00549 wxUint32 m_iFlags;
00550
00551
00552 bool m_blankButtonBg;
00553
00554
00555 bool m_isPopupShown;
00556
00557
00558 unsigned char m_fakePopupUsage;
00559
00560 wxByte m_skipTextCtrlFocusEvents;
00561
00562 private:
00563 void Init();
00564
00565 DECLARE_EVENT_TABLE()
00566
00567 DECLARE_ABSTRACT_CLASS(wxPGComboControlBase)
00568 };
00569
00570
00571
00572 class WXDLLEXPORT_PGODC wxPGGenericComboControl : public wxPGComboControlBase
00573 {
00574 public:
00575
00576 wxPGGenericComboControl() : wxPGComboControlBase() { Init(); }
00577
00578 wxPGGenericComboControl(wxWindow *parent,
00579 wxWindowID id = wxID_ANY,
00580 const wxString& value = wxEmptyString,
00581 const wxPoint& pos = wxDefaultPosition,
00582 const wxSize& size = wxDefaultSize,
00583 long style = 0,
00584 const wxValidator& validator = wxDefaultValidator,
00585 const wxString& name = wxODComboBoxNameStr)
00586 : wxPGComboControlBase()
00587 {
00588 Init();
00589
00590 (void)Create(parent, id, value, pos, size, style, validator, name);
00591 }
00592
00593 bool Create(wxWindow *parent,
00594 wxWindowID id = wxID_ANY,
00595 const wxString& value = wxEmptyString,
00596 const wxPoint& pos = wxDefaultPosition,
00597 const wxSize& size = wxDefaultSize,
00598 long style = 0,
00599 const wxValidator& validator = wxDefaultValidator,
00600 const wxString& name = wxODComboBoxNameStr);
00601
00602 virtual ~wxPGGenericComboControl();
00603
00604 static int GetFeatures() { return wxPGComboControlFeatures::All; }
00605
00606 protected:
00607
00608 virtual void OnResize();
00609
00610
00611
00612 void OnPaintEvent( wxPaintEvent& event );
00613 void OnMouseEvent( wxMouseEvent& event );
00614
00615 private:
00616 void Init();
00617
00618 DECLARE_EVENT_TABLE()
00619
00620 DECLARE_DYNAMIC_CLASS(wxPGGenericComboControl)
00621 };
00622
00623
00624
00625 #if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
00626
00627 class WXDLLEXPORT_PGODC wxPGComboControl : public wxPGComboControlBase
00628 {
00629 public:
00630
00631 wxPGComboControl() : wxPGComboControlBase() { Init(); }
00632
00633 wxPGComboControl(wxWindow *parent,
00634 wxWindowID id = wxID_ANY,
00635 const wxString& value = wxEmptyString,
00636 const wxPoint& pos = wxDefaultPosition,
00637 const wxSize& size = wxDefaultSize,
00638 long style = 0,
00639 const wxValidator& validator = wxDefaultValidator,
00640 const wxString& name = wxODComboBoxNameStr)
00641 : wxPGComboControlBase()
00642 {
00643 Init();
00644
00645 (void)Create(parent, id, value, pos, size, style, validator, name);
00646 }
00647
00648 bool Create(wxWindow *parent,
00649 wxWindowID id = wxID_ANY,
00650 const wxString& value = wxEmptyString,
00651 const wxPoint& pos = wxDefaultPosition,
00652 const wxSize& size = wxDefaultSize,
00653 long style = 0,
00654 const wxValidator& validator = wxDefaultValidator,
00655 const wxString& name = wxODComboBoxNameStr);
00656
00657 virtual ~wxPGComboControl();
00658
00659
00660
00661 static int GetFeatures() { return wxPGComboControlFeatures::All; }
00662
00663 protected:
00664
00665
00666 virtual void OnResize();
00667 virtual wxCoord GetNativeTextIndent() const;
00668 virtual void OnThemeChange();
00669
00670
00671
00672 void OnPaintEvent( wxPaintEvent& event );
00673 void OnMouseEvent( wxMouseEvent& event );
00674
00675 private:
00676 void Init();
00677
00678 DECLARE_EVENT_TABLE()
00679
00680 DECLARE_DYNAMIC_CLASS(wxPGComboControl)
00681 };
00682
00683 #else
00684
00685 class WXDLLEXPORT_PGODC wxPGComboControl : public wxPGGenericComboControl
00686 {
00687 public:
00688
00689 wxPGComboControl() : wxPGGenericComboControl() {}
00690
00691 wxPGComboControl(wxWindow *parent,
00692 wxWindowID id = wxID_ANY,
00693 const wxString& value = wxEmptyString,
00694 const wxPoint& pos = wxDefaultPosition,
00695 const wxSize& size = wxDefaultSize,
00696 long style = 0,
00697 const wxValidator& validator = wxDefaultValidator,
00698 const wxString& name = wxODComboBoxNameStr)
00699 : wxPGGenericComboControl()
00700 {
00701 (void)Create(parent, id, value, pos, size, style, validator, name);
00702 }
00703
00704 bool Create(wxWindow *parent,
00705 wxWindowID id = wxID_ANY,
00706 const wxString& value = wxEmptyString,
00707 const wxPoint& pos = wxDefaultPosition,
00708 const wxSize& size = wxDefaultSize,
00709 long style = 0,
00710 const wxValidator& validator = wxDefaultValidator,
00711 const wxString& name = wxODComboBoxNameStr)
00712 {
00713 return wxPGGenericComboControl::Create(parent,id,value,pos,size,style,validator,name);
00714 }
00715
00716 virtual ~wxPGComboControl() {}
00717
00718 protected:
00719
00720 private:
00721 DECLARE_DYNAMIC_CLASS(wxPGComboControl)
00722 };
00723
00724
00725 #endif
00726
00727
00728
00729
00730
00731
00732
00733
00734
00735 enum
00736 {
00737 wxPGCP_IFLAG_CREATED = 0x0001,
00738 };
00739
00740 class WXDLLEXPORT_PGODC wxPGComboPopup
00741 {
00742 friend class wxPGComboControlBase;
00743 public:
00744 wxPGComboPopup(wxPGComboControl *combo)
00745 {
00746 m_combo = combo;
00747 m_iFlags = 0;
00748 }
00749
00750 virtual ~wxPGComboPopup();
00751
00752
00753
00754 virtual bool Create(wxWindow* parent) = 0;
00755
00756
00757 virtual wxWindow *GetControl() = 0;
00758
00759
00760 virtual void OnPopup();
00761
00762
00763 virtual void OnDismiss();
00764
00765
00766
00767 virtual void SetStringValue( const wxString& value );
00768
00769
00770 virtual wxString GetStringValue() const = 0;
00771
00772
00773
00774 virtual void PaintComboControl( wxDC& dc, const wxRect& rect );
00775
00776
00777
00778 virtual void OnComboKeyEvent( wxKeyEvent& event );
00779
00780
00781
00782 virtual void OnComboDoubleClick();
00783
00784
00785
00786
00787
00788
00789 virtual wxSize GetAdjustedSize( int minWidth, int prefHeight, int maxHeight );
00790
00791
00792
00793
00794
00795 virtual bool LazyCreate();
00796
00797
00798
00799
00800
00801
00802 void Dismiss();
00803
00804
00805 inline bool IsCreated() const
00806 {
00807 return (m_iFlags & wxPGCP_IFLAG_CREATED) ? true : false;
00808 }
00809
00810 protected:
00811 wxPGComboControl* m_combo;
00812 wxUint32 m_iFlags;
00813 };
00814
00815
00816
00817
00818
00819
00820 enum
00821 {
00822
00823
00824
00825
00826
00827
00828
00829 wxODCB_STD_CONTROL_PAINT = 0x0400
00830 };
00831
00832
00833
00834
00835
00836
00837 enum
00838 {
00839
00840
00841 wxPGCC_PAINTING_CONTROL = 0x0001,
00842 wxPGCC_PAINTING_SELECTED = 0x0002
00843 };
00844
00845
00846
00847
00848
00849
00850
00851
00852
00853
00854
00855
00856
00857
00858
00859
00860
00861
00862
00863
00864
00865 #include "wx/vlbox.h"
00866
00867
00868
00869
00870
00871
00872
00873
00874
00875
00876
00877
00878
00879 class wxPGVListBoxComboPopup : public wxVListBox, public wxPGComboPopup
00880 {
00881 friend class wxPGOwnerDrawnComboBox;
00882 public:
00883
00884
00885 wxPGVListBoxComboPopup(wxPGComboControl* combo);
00886 virtual ~wxPGVListBoxComboPopup();
00887
00888
00889 virtual bool Create(wxWindow* parent);
00890 virtual wxWindow *GetControl() { return this; }
00891 virtual void SetStringValue( const wxString& value );
00892 virtual wxString GetStringValue() const;
00893
00894
00895 virtual void OnPopup();
00896 virtual wxSize GetAdjustedSize( int minWidth, int prefHeight, int maxHeight );
00897 virtual void PaintComboControl( wxDC& dc, const wxRect& rect );
00898 virtual void OnComboKeyEvent( wxKeyEvent& event );
00899 virtual void OnComboDoubleClick();
00900
00901
00902 virtual bool LazyCreate();
00903
00904
00905 void SetSelection( int item );
00906 void Insert( const wxString& item, int pos );
00907 int Append(const wxString& item);
00908 void Clear();
00909 void Delete( wxODCIndex item );
00910 void SetItemClientData(wxODCIndex n, void* clientData, wxClientDataType clientDataItemsType);
00911 void *GetItemClientData(wxODCIndex n) const;
00912 void SetString( int item, const wxString& str );
00913 wxString GetString( int item ) const;
00914 wxODCCount GetCount() const;
00915 int FindString(const wxString& s) const;
00916 int GetSelection() const;
00917
00918 void Populate( int n, const wxString choices[] );
00919 void ClearClientDatas();
00920
00921
00922 inline int GetItemAtPosition( const wxPoint& pos ) { return HitTest(pos); }
00923 inline wxCoord GetTotalHeight() const { return EstimateTotalHeight(); }
00924 inline wxCoord GetLineHeight(int n) const { return OnMeasureItem(n); }
00925
00926 protected:
00927
00928 virtual wxCoord OnGetRowHeight(size_t n) const { return OnMeasureItem(n); }
00929
00930
00931 bool HandleKey( int keycode, bool saturate );
00932
00933
00934 void SendComboBoxEvent( int selection );
00935 void DismissWithEvent();
00936
00937
00938 void CheckWidth( int pos );
00939
00940
00941 virtual void OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const;
00942 virtual wxCoord OnMeasureItem(size_t n) const;
00943 void OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const;
00944
00945
00946
00947 void OnMouseMove(wxMouseEvent& event);
00948 void OnMouseWheel(wxMouseEvent& event);
00949 void OnKey(wxKeyEvent& event);
00950 void OnLeftClick(wxMouseEvent& event);
00951
00952 #if wxCHECK_VERSION(2,8,0)
00953 void OnMouseCaptureLost(wxMouseCaptureLostEvent& event);
00954 #endif
00955
00956 wxArrayString m_strings;
00957 wxArrayPtrVoid m_clientDatas;
00958 wxArrayInt m_widths;
00959
00960 wxString m_stringValue;
00961
00962 wxFont m_font;
00963
00964 int m_value;
00965 int m_itemHover;
00966 int m_widestWidth;
00967 int m_avgCharWidth;
00968 int m_baseImageWidth;
00969 int m_itemHeight;
00970
00971 wxClientDataType m_clientDataItemsType;
00972
00973 private:
00974
00975
00976 bool m_clicked;
00977
00978 DECLARE_EVENT_TABLE()
00979 };
00980
00981
00982
00983
00984
00985
00986
00987 class WXDLLEXPORT_PGODC wxPGOwnerDrawnComboBox : public wxPGComboControl, public wxItemContainer
00988 {
00989 friend class wxPGComboPopupWindow;
00990 friend class wxPGComboControlBase;
00991 public:
00992
00993
00994 wxPGOwnerDrawnComboBox() : wxPGComboControl() { Init(); }
00995
00996 wxPGOwnerDrawnComboBox(wxWindow *parent,
00997 wxWindowID id,
00998 const wxString& value,
00999 const wxPoint& pos,
01000 const wxSize& size,
01001 int n,
01002 const wxString choices[],
01003
01004 long style = 0,
01005 const wxValidator& validator = wxDefaultValidator,
01006 const wxString& name = wxODComboBoxNameStr)
01007 : wxPGComboControl()
01008 {
01009 Init();
01010
01011 (void)Create(parent, id, value, pos, size, n, choices,
01012 style, validator, name);
01013 }
01014
01015 bool Create(wxWindow *parent,
01016 wxWindowID id,
01017 const wxString& value = wxEmptyString,
01018 const wxPoint& pos = wxDefaultPosition,
01019 const wxSize& size = wxDefaultSize,
01020 long style = 0,
01021 const wxValidator& validator = wxDefaultValidator,
01022 const wxString& name = wxODComboBoxNameStr);
01023
01024 wxPGOwnerDrawnComboBox(wxWindow *parent,
01025 wxWindowID id,
01026 const wxString& value,
01027 const wxPoint& pos,
01028 const wxSize& size,
01029 const wxArrayString& choices,
01030 long style = 0,
01031 const wxValidator& validator = wxDefaultValidator,
01032 const wxString& name = wxODComboBoxNameStr);
01033
01034 bool Create(wxWindow *parent,
01035 wxWindowID id,
01036 const wxString& value = wxEmptyString,
01037 const wxPoint& pos = wxDefaultPosition,
01038 const wxSize& size = wxDefaultSize,
01039 int n = 0,
01040 const wxString choices[] = (const wxString *) NULL,
01041 long style = 0,
01042 const wxValidator& validator = wxDefaultValidator,
01043 const wxString& name = wxODComboBoxNameStr);
01044
01045 bool Create(wxWindow *parent,
01046 wxWindowID id,
01047 const wxString& value,
01048 const wxPoint& pos,
01049 const wxSize& size,
01050 const wxArrayString& choices,
01051 long style = 0,
01052 const wxValidator& validator = wxDefaultValidator,
01053 const wxString& name = wxODComboBoxNameStr);
01054
01055 virtual ~wxPGOwnerDrawnComboBox();
01056
01057
01058 virtual void Clear();
01059 virtual void Delete(wxODCIndex n);
01060 virtual wxODCCount GetCount() const;
01061 virtual wxString GetString(wxODCIndex n) const;
01062 virtual void SetString(wxODCIndex n, const wxString& s);
01063 virtual int FindString(const wxString& s) const;
01064 virtual void Select(int n);
01065 virtual int GetSelection() const;
01066 void SetSelection(int n) { Select(n); }
01067
01068 wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST
01069
01070 protected:
01071
01072
01073 void ClearClientDatas();
01074
01075 virtual int DoAppend(const wxString& item);
01076 virtual int DoInsert(const wxString& item, wxODCIndex pos);
01077 virtual void DoSetItemClientData(wxODCIndex n, void* clientData);
01078 virtual void* DoGetItemClientData(wxODCIndex n) const;
01079 virtual void DoSetItemClientObject(wxODCIndex n, wxClientData* clientData);
01080 virtual wxClientData* DoGetItemClientObject(wxODCIndex n) const;
01081
01082 #if wxCHECK_VERSION(2,9,0)
01083 virtual int DoInsertItems(const wxArrayStringsAdapter& items,
01084 unsigned int pos,
01085 void **clientData,
01086 wxClientDataType type);
01087 virtual void DoClear() { Clear(); }
01088 virtual void DoDeleteOneItem(unsigned int pos) { Delete(pos); }
01089 #endif
01090
01091
01092 wxPGVListBoxComboPopup* m_popupInterface;
01093
01094 private:
01095 void Init();
01096
01097 DECLARE_EVENT_TABLE()
01098
01099 DECLARE_DYNAMIC_CLASS(wxPGOwnerDrawnComboBox)
01100 };
01101
01102 #endif // !DOXYGEN
01103
01104 #endif // _WX_PROPGRID_ODCOMBO_H_