fixes and missing files from the first wxComboControl patch (update of patch 1479938)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39126 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2006-05-09 16:18:19 +00:00
parent 65b977e5b3
commit 6d0ce565ff
9 changed files with 389 additions and 344 deletions

View File

@@ -43,7 +43,7 @@ enum
{
// when set, we are painting the selected item in control,
// not in the popup
wxCC_PAINTING_CONTROL = 0x0001
wxCP_PAINTING_CONTROL = 0x0001
};
@@ -64,11 +64,12 @@ class WXDLLEXPORT wxVListBoxComboPopup : public wxVListBox, public wxComboPopup
friend class wxOwnerDrawnComboBox;
public:
// ctor and dtor
wxVListBoxComboPopup(wxComboControlBase* combo);
// init and dtor
wxVListBoxComboPopup() : wxVListBox(), wxComboPopup() { }
virtual ~wxVListBoxComboPopup();
// required virtuals
virtual void Init();
virtual bool Create(wxWindow* parent);
virtual wxWindow *GetControl() { return this; }
virtual void SetStringValue( const wxString& value );
@@ -82,6 +83,20 @@ public:
virtual void OnComboDoubleClick();
virtual bool LazyCreate();
// Callbacks for drawing and measuring items. Override in a derived class for
// owner-drawnness.
// item: item index to be drawn, may be wxNOT_FOUND when painting combo control itself
// and there is no valid selection
// flags: wxCP_PAINTING_CONTROL is set if painting to combo control instead of list
virtual void OnDrawItem( wxDC& dc, const wxRect& rect, int item, int flags ) const;
// Return item height
virtual wxCoord OnMeasureItem( size_t item ) const;
// Return item width, or -1 for calculating from text extent (default)
virtual wxCoord OnMeasureItemWidth( size_t item ) const;
// Item management
void SetSelection( int item );
void Insert( const wxString& item, int pos );
@@ -94,8 +109,10 @@ public:
wxString GetString( int item ) const;
unsigned int GetCount() const;
int FindString(const wxString& s) const;
int GetSelection() const;
void Populate( int n, const wxString choices[] );
//void Populate( int n, const wxString choices[] );
void Populate( const wxArrayString& choices );
void ClearClientDatas();
// helpers
@@ -109,14 +126,17 @@ protected:
bool HandleKey( int keycode, bool saturate );
// sends combobox select event from the parent combo control
void SendComboBoxEvent();
void SendComboBoxEvent( int selection );
// gets value, sends event and dismisses
void DismissWithEvent();
// Re-calculates width for given item
void CheckWidth( int pos );
// wxVListBox implementation
virtual void OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const;
virtual wxCoord OnMeasureItem(size_t n) const;
//virtual wxCoord OnMeasureItem(size_t n) const;
void OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const;
// filter mouse move events happening outside the list box
@@ -130,8 +150,9 @@ protected:
wxArrayPtrVoid m_clientDatas;
wxArrayInt m_widths; // cached line widths
wxFont m_font;
wxFont m_useFont;
//wxString m_stringValue; // displayed text (may be different than m_strings[m_value])
int m_value; // selection
int m_itemHover; // on which item the cursor is
int m_widestWidth; // width of widest item thus far
@@ -225,6 +246,9 @@ public:
virtual ~wxOwnerDrawnComboBox();
// NULL popup can be used to indicate default interface
virtual void SetPopupControl( wxComboPopup* popup );
// wxControlWithItems methods
virtual void Clear();
virtual void Delete(unsigned int n);
@@ -253,6 +277,11 @@ protected:
// overload m_popupInterface member so we can access specific popup interface easier
wxVListBoxComboPopup* m_popupInterface;
// temporary storage for the initial choices
//const wxString* m_baseChoices;
//int m_baseChoicesCount;
wxArrayString m_initChs;
private:
void Init();