[ 1507736 ] wxOwnerDrawnComboBox improved list item width checking.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39790 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2006-06-19 09:02:10 +00:00
parent 1d39a12a30
commit e5d6334238
2 changed files with 127 additions and 33 deletions

View File

@@ -118,8 +118,12 @@ protected:
// gets value, sends event and dismisses
void DismissWithEvent();
// Re-calculates width for given item
void CheckWidth( int pos );
// OnMeasureItemWidth will be called on next GetAdjustedSize.
void ItemWidthChanged(unsigned int item)
{
m_widths[item] = -1;
m_widthsDirty = true;
}
// Callbacks for drawing and measuring items. Override in a derived class for
// owner-drawnness. Font, background and text colour have been prepared according
@@ -155,24 +159,35 @@ protected:
wxArrayString m_strings;
wxArrayPtrVoid m_clientDatas;
wxArrayInt m_widths; // cached line widths
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
int m_avgCharWidth;
int m_baseImageWidth; // how much per item drawn in addition to text
int m_itemHeight; // default item height (calculate from font size
// and used in the absence of callback)
wxClientDataType m_clientDataItemsType;
private:
// Cached item widths (in pixels).
wxArrayInt m_widths;
// Width of currently widest item.
int m_widestWidth;
// Index of currently widest item.
int m_widestItem;
// Measure some items in next GetAdjustedSize?
bool m_widthsDirty;
// Find widest item in next GetAdjustedSize?
bool m_findWidest;
// has the mouse been released on this control?
bool m_clicked;
bool m_clicked;
DECLARE_EVENT_TABLE()
};