X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e4de7a77593d948c7c7f56045b082dcfa7e794a4..d07f2e19181bc5caf29eb2338ce513be6fa42405:/src/os2/checklst.cpp?ds=sidebyside diff --git a/src/os2/checklst.cpp b/src/os2/checklst.cpp index f0a3ac723b..6773983e9f 100644 --- a/src/os2/checklst.cpp +++ b/src/os2/checklst.cpp @@ -39,6 +39,12 @@ #define INCL_PM #include +// ---------------------------------------------------------------------------- +// constants for base class +// ---------------------------------------------------------------------------- + +static const int CHECK_MARK_WIDTH = 15; + // ---------------------------------------------------------------------------- // private functions // ---------------------------------------------------------------------------- @@ -50,8 +56,6 @@ // implementation // ============================================================================ -IMPLEMENT_DYNAMIC_CLASS(wxCheckListBox, wxListBox) - // ---------------------------------------------------------------------------- // declaration and implementation of wxCheckListBoxItem class // ---------------------------------------------------------------------------- @@ -81,6 +85,8 @@ public: void Check(bool bCheck); void Toggle(void) { Check(!IsChecked()); } + virtual wxString GetName() const { return m_pParent->GetString(m_nIndex); } + private: bool m_bChecked; wxCheckListBox* m_pParent; @@ -101,7 +107,7 @@ wxCheckListBoxItem::wxCheckListBoxItem(wxCheckListBox* pParent, size_t nIndex) // done in OnMeasure while they are used only in OnDraw and we // know that there will always be OnMeasure before OnDraw // - SetMarginWidth(GetDefaultMarginWidth()); + SetMarginWidth(CHECK_MARK_WIDTH); } // end of wxCheckListBoxItem::wxCheckListBoxItem @@ -128,7 +134,7 @@ bool wxCheckListBoxItem::OnDrawItem ( wxDC& rDc, vRect.y -= 3; if (wxOwnerDrawn::OnDrawItem( rDc, vRect, eAct, eStat)) { - size_t nCheckWidth = GetDefaultMarginWidth(); + size_t nCheckWidth = CHECK_MARK_WIDTH; size_t nCheckHeight = m_pParent->GetItemHeight(); int nParentHeight; int nX = rRect.GetX(); @@ -333,7 +339,7 @@ long wxCheckListBox::OS2OnMeasure ( WXMEASUREITEMSTRUCT* pItem ) // // Add place for the check mark // - pStruct->rclItem.xRight += wxOwnerDrawn::GetDefaultMarginWidth(); + pStruct->rclItem.xRight += CHECK_MARK_WIDTH; return long(MRFROM2SHORT((USHORT)m_nItemHeight, (USHORT)(pStruct->rclItem.xRight - pStruct->rclItem.xLeft))); } return 0L; @@ -374,7 +380,7 @@ void wxCheckListBox::OnLeftClick ( wxMouseEvent& rEvent ) // // Clicking on the item selects it, clicking on the checkmark toggles // - if (rEvent.GetX() <= wxOwnerDrawn::GetDefaultMarginWidth()) + if (rEvent.GetX() <= CHECK_MARK_WIDTH) { int nParentHeight; wxScreenDC vDc;