home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / wxos2240.zip / wxWindows-2.4.0 / include / wx / os2 / checklst.h < prev    next >
C/C++ Source or Header  |  2002-12-27  |  3KB  |  102 lines

  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Name:        checklst.h
  3. // Purpose:     wxCheckListBox class - a listbox with checkable items
  4. //              Note: this is an optional class.
  5. // Author:      David Webster
  6. // Modified by:
  7. // Created:     10/13/99
  8. // RCS-ID:      $Id: CHECKLST.H,v 1.9.2.1 2002/12/27 14:49:42 JS Exp $
  9. // Copyright:   (c) David Webster
  10. // Licence:     wxWindows licence
  11. ///////////////////////////////////////////////////////////////////////////////
  12.  
  13. #ifndef _WX_CHECKLST_H_
  14. #define _WX_CHECKLST_H_
  15.  
  16. #include <stddef.h>
  17.  
  18. #include "wx/setup.h"
  19.  
  20. class wxOwnerDrawn; // so the compiler knows, it is a class.
  21.  
  22. class wxCheckListBoxItem; // fwd decl, define in checklst.cpp
  23.  
  24. class WXDLLEXPORT wxCheckListBox : public wxListBox
  25. {
  26. public:
  27.     //
  28.     // Ctors
  29.     //
  30.     wxCheckListBox();
  31.     wxCheckListBox( wxWindow*          pParent
  32.                    ,wxWindowID         vId
  33.                    ,const wxPoint&     rPos = wxDefaultPosition
  34.                    ,const wxSize&      vSize = wxDefaultSize
  35.                    ,int                nStrings = 0
  36.                    ,const wxString     asChoices[] = NULL
  37.                    ,long               lStyle = 0
  38.                    ,const wxValidator& rValidator = wxDefaultValidator
  39.                    ,const wxString&    rsName = wxListBoxNameStr
  40.                   );
  41.  
  42.     //
  43.     // Override base class virtuals
  44.     //
  45.     virtual void Delete(int n);
  46.     virtual void InsertItems( int            nItems
  47.                              ,const wxString asItems[]
  48.                              ,int            nPos
  49.                             );
  50.  
  51.     virtual bool SetFont(const wxFont &rFont);
  52.  
  53.     //
  54.     // Items may be checked
  55.     //
  56.     bool IsChecked(size_t uiIndex) const;
  57.     void Check( size_t uiIndex
  58.                ,bool   bCheck = TRUE
  59.               );
  60.  
  61.     //
  62.     // Accessors
  63.     //
  64.     size_t GetItemHeight(void) const { return m_nItemHeight; }
  65.  
  66. protected:
  67.     //
  68.     // We create our items ourselves and they have non-standard size,
  69.     // so we need to override these functions
  70.     //
  71.     virtual wxOwnerDrawn* CreateItem(size_t n);
  72.     virtual long          OS2OnMeasure(WXMEASUREITEMSTRUCT* pItem);
  73.  
  74.     //
  75.     // Pressing space or clicking the check box toggles the item
  76.     //
  77.     void OnChar(wxKeyEvent& rEvent);
  78.     void OnLeftClick(wxMouseEvent& rEvent);
  79.  
  80. private:
  81.     size_t                          m_nItemHeight;  // height of checklistbox items (the same for all)
  82.  
  83.     //
  84.     // Virtual function hiding suppression, do not use
  85.     //
  86.     virtual wxControl* CreateItem( const wxItemResource*  pChildResource
  87.                                   ,const wxItemResource*  pParentResource
  88.                                   ,const wxResourceTable* pTable = (const wxResourceTable *) NULL
  89.                                  )
  90.     {
  91.         return(wxWindowBase::CreateItem( pChildResource
  92.                                         ,pParentResource
  93.                                         ,pTable
  94.                                        ));
  95.     }
  96.     DECLARE_DYNAMIC_CLASS(wxCheckListBox)
  97.     DECLARE_EVENT_TABLE()
  98. }; // end of CLASS wxCheckListBoxItem
  99.  
  100. #endif
  101.    // _WX_CHECKLST_H_
  102.