1 ///////////////////////////////////////////////////////////////////////////// 
   2 // Name:        wx/gtk/listbox.h 
   3 // Purpose:     wxListBox class declaration 
   4 // Author:      Robert Roebling 
   6 // Copyright:   (c) 1998 Robert Roebling 
   7 // Licence:     wxWindows licence 
   8 ///////////////////////////////////////////////////////////////////////////// 
  10 #ifndef _WX_GTK_LISTBOX_H_ 
  11 #define _WX_GTK_LISTBOX_H_ 
  16 //----------------------------------------------------------------------------- 
  18 //----------------------------------------------------------------------------- 
  20 class WXDLLIMPEXP_CORE wxListBox 
: public wxListBoxBase
 
  28     wxListBox( wxWindow 
*parent
, wxWindowID id
, 
  29             const wxPoint
& pos 
= wxDefaultPosition
, 
  30             const wxSize
& size 
= wxDefaultSize
, 
  31             int n 
= 0, const wxString choices
[] = (const wxString 
*) NULL
, 
  33             const wxValidator
& validator 
= wxDefaultValidator
, 
  34             const wxString
& name 
= wxListBoxNameStr 
) 
  37         Create(parent
, id
, pos
, size
, n
, choices
, style
, validator
, name
); 
  39     wxListBox( wxWindow 
*parent
, wxWindowID id
, 
  42             const wxArrayString
& choices
, 
  44             const wxValidator
& validator 
= wxDefaultValidator
, 
  45             const wxString
& name 
= wxListBoxNameStr 
) 
  48         Create(parent
, id
, pos
, size
, choices
, style
, validator
, name
); 
  52     bool Create(wxWindow 
*parent
, wxWindowID id
, 
  53                 const wxPoint
& pos 
= wxDefaultPosition
, 
  54                 const wxSize
& size 
= wxDefaultSize
, 
  55                 int n 
= 0, const wxString choices
[] = (const wxString 
*) NULL
, 
  57                 const wxValidator
& validator 
= wxDefaultValidator
, 
  58                 const wxString
& name 
= wxListBoxNameStr
); 
  59     bool Create(wxWindow 
*parent
, wxWindowID id
, 
  62                 const wxArrayString
& choices
, 
  64                 const wxValidator
& validator 
= wxDefaultValidator
, 
  65                 const wxString
& name 
= wxListBoxNameStr
); 
  67     virtual unsigned int GetCount() const; 
  68     virtual wxString 
GetString(unsigned int n
) const; 
  69     virtual void SetString(unsigned int n
, const wxString
& s
); 
  70     virtual int FindString(const wxString
& s
, bool bCase 
= false) const; 
  72     virtual bool IsSelected(int n
) const; 
  73     virtual int GetSelection() const; 
  74     virtual int GetSelections(wxArrayInt
& aSelections
) const; 
  76     virtual void EnsureVisible(int n
); 
  78     virtual void Update(); 
  80     static wxVisualAttributes
 
  81     GetClassDefaultAttributes(wxWindowVariant variant 
= wxWINDOW_VARIANT_NORMAL
); 
  83     // implementation from now on 
  85     virtual GtkWidget 
*GetConnectWidget(); 
  87     struct _GtkTreeView   
*m_treeview
; 
  88     struct _GtkListStore  
*m_liststore
; 
  90 #if wxUSE_CHECKLISTBOX 
  92 #endif // wxUSE_CHECKLISTBOX 
  94     struct _GtkTreeEntry
* GTKGetEntry(unsigned pos
) const; 
  96     void GTKDisableEvents(); 
  97     void GTKEnableEvents(); 
  99     void GTKOnSelectionChanged(); 
 100     void GTKOnActivated(int item
); 
 103     virtual void DoClear(); 
 104     virtual void DoDeleteOneItem(unsigned int n
); 
 105     virtual wxSize 
DoGetBestSize() const; 
 106     virtual void DoApplyWidgetStyle(GtkRcStyle 
*style
); 
 107     virtual GdkWindow 
*GTKGetWindow(wxArrayGdkWindows
& windows
) const; 
 109     virtual void DoSetSelection(int n
, bool select
); 
 111     virtual int DoInsertItems(const wxArrayStringsAdapter
& items
, 
 113                               void **clientData
, wxClientDataType type
); 
 115     virtual void DoSetFirstItem(int n
); 
 116     virtual void DoSetItemClientData(unsigned int n
, void* clientData
); 
 117     virtual void* DoGetItemClientData(unsigned int n
) const; 
 118     virtual int DoListHitTest(const wxPoint
& point
) const; 
 120     // get the iterator for the given index, returns false if invalid 
 121     bool GTKGetIteratorFor(unsigned pos
, _GtkTreeIter 
*iter
) const; 
 123     // get the index for the given iterator, return wxNOT_FOUND on failure 
 124     int GTKGetIndexFor(_GtkTreeIter
& iter
) const; 
 126     // set the specified item 
 127     void GTKSetItem(_GtkTreeIter
& iter
, const _GtkTreeEntry 
*entry
); 
 129     // common part of DoSetFirstItem() and EnsureVisible() 
 130     void DoScrollToCell(int n
, float alignY
, float alignX
); 
 133     void Init(); //common construction 
 135     DECLARE_DYNAMIC_CLASS(wxListBox
) 
 138 #endif // _WX_GTK_LISTBOX_H_