]> git.saurik.com Git - wxWidgets.git/blame - samples/listctrl/listtest.h
removed assert from wxColour::InitFromName() as there is no way to bypass it (see...
[wxWidgets.git] / samples / listctrl / listtest.h
CommitLineData
457814b5
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: listctrl.h
3// Purpose: wxListCtrl sample
4// Author: Julian Smart
5// Modified by:
6// Created: 04/01/98
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart and Markus Holzem
5ea47806 9// Licence: wxWindows license
457814b5
JS
10/////////////////////////////////////////////////////////////////////////////
11
12// Define a new application type
13class MyApp: public wxApp
fa5f6926
VZ
14{
15public:
16 virtual bool OnInit();
457814b5
JS
17};
18
19class MyListCtrl: public wxListCtrl
20{
21public:
6c02c329
VZ
22 MyListCtrl(wxWindow *parent,
23 const wxWindowID id,
24 const wxPoint& pos,
25 const wxSize& size,
26 long style)
27 : wxListCtrl(parent, id, pos, size, style),
28 m_attr(*wxCYAN, *wxLIGHT_GREY, wxNullFont)
5ea47806
VZ
29 {
30 }
fa5f6926 31
5cd89174
VZ
32 // add one item to the listctrl in report mode
33 void InsertItemInReportView(int i);
34
8636aed8 35 void OnColClick(wxListEvent& event);
5ea47806
VZ
36 void OnBeginDrag(wxListEvent& event);
37 void OnBeginRDrag(wxListEvent& event);
38 void OnBeginLabelEdit(wxListEvent& event);
39 void OnEndLabelEdit(wxListEvent& event);
40 void OnDeleteItem(wxListEvent& event);
12c1b46a 41 void OnDeleteAllItems(wxListEvent& event);
5ea47806
VZ
42 void OnGetInfo(wxListEvent& event);
43 void OnSetInfo(wxListEvent& event);
44 void OnSelected(wxListEvent& event);
45 void OnDeselected(wxListEvent& event);
46 void OnListKeyDown(wxListEvent& event);
47 void OnActivated(wxListEvent& event);
614391dc 48 void OnCacheHint(wxListEvent& event);
457814b5 49
88ac883a
VZ
50 void OnChar(wxKeyEvent& event);
51
c41ea66a
VZ
52private:
53 void LogEvent(const wxListEvent& event, const wxChar *eventName);
54
98ec9dbe
VZ
55 virtual wxString OnGetItemText(long item, long column) const;
56 virtual int OnGetItemImage(long item) const;
6c02c329
VZ
57 virtual wxListItemAttr *OnGetItemAttr(long item) const;
58
59 wxListItemAttr m_attr;
98ec9dbe 60
5ea47806 61 DECLARE_EVENT_TABLE()
457814b5
JS
62};
63
64// Define a new frame type
65class MyFrame: public wxFrame
5ea47806
VZ
66{
67public:
457814b5
JS
68 MyListCtrl *m_listCtrl;
69 wxTextCtrl *m_logWindow;
70
c41ea66a 71 MyFrame(const wxChar *title, int x, int y, int w, int h);
5ea47806
VZ
72 ~MyFrame();
73
74public:
98ec9dbe
VZ
75 void OnSize(wxSizeEvent& event);
76
457814b5
JS
77 void OnQuit(wxCommandEvent& event);
78 void OnAbout(wxCommandEvent& event);
79 void OnListView(wxCommandEvent& event);
80 void OnReportView(wxCommandEvent& event);
81 void OnIconView(wxCommandEvent& event);
82 void OnIconTextView(wxCommandEvent& event);
83 void OnSmallIconView(wxCommandEvent& event);
84 void OnSmallIconTextView(wxCommandEvent& event);
98ec9dbe
VZ
85 void OnVirtualView(wxCommandEvent& event);
86
88b792af 87 void OnFocusLast(wxCommandEvent& event);
58b3bdc9 88 void OnToggleFirstSel(wxCommandEvent& event);
c4771147
KB
89 void OnDeselectAll(wxCommandEvent& event);
90 void OnSelectAll(wxCommandEvent& event);
cf1dfa6b 91 void OnAdd(wxCommandEvent& event);
bec0a261 92 void OnDelete(wxCommandEvent& event);
5ea47806 93 void OnDeleteAll(wxCommandEvent& event);
fa5f6926 94 void OnSort(wxCommandEvent& event);
11f26ea0
VZ
95 void OnSetFgColour(wxCommandEvent& event);
96 void OnSetBgColour(wxCommandEvent& event);
7b848b0d 97 void OnToggleMultiSel(wxCommandEvent& event);
f6bcfd97 98 void OnShowColInfo(wxCommandEvent& event);
b54e41c5 99 void OnShowSelInfo(wxCommandEvent& event);
5ea47806 100
98ec9dbe 101 void OnUpdateShowColInfo(wxUpdateUIEvent& event);
5ea47806 102
c41ea66a
VZ
103 wxImageList *m_imageListNormal;
104 wxImageList *m_imageListSmall;
105
106private:
776a33cf
VZ
107 // recreate the list control with the new flags
108 void RecreateList(long flags, bool withText = TRUE);
109
110 // fill the control with items depending on the view
111 void InitWithListItems();
112 void InitWithReportItems();
113 void InitWithIconItems(bool withText, bool sameIcon = FALSE);
114 void InitWithVirtualItems();
115
c41ea66a
VZ
116 wxLog *m_logOld;
117
5ea47806 118 DECLARE_EVENT_TABLE()
457814b5
JS
119};
120
121
98ec9dbe 122// IDs for the menu commands
fa5f6926
VZ
123enum
124{
cf1dfa6b 125 LIST_ABOUT,
98ec9dbe 126 LIST_QUIT,
cf1dfa6b 127
98ec9dbe
VZ
128 LIST_LIST_VIEW,
129 LIST_ICON_VIEW,
130 LIST_ICON_TEXT_VIEW,
131 LIST_SMALL_ICON_VIEW,
132 LIST_SMALL_ICON_TEXT_VIEW,
cf1dfa6b 133 LIST_REPORT_VIEW,
98ec9dbe
VZ
134 LIST_VIRTUAL_VIEW,
135
98ec9dbe
VZ
136 LIST_DESELECT_ALL,
137 LIST_SELECT_ALL,
98ec9dbe 138 LIST_DELETE_ALL,
bec0a261 139 LIST_DELETE,
cf1dfa6b 140 LIST_ADD,
fa5f6926 141 LIST_SORT,
11f26ea0
VZ
142 LIST_SET_FG_COL,
143 LIST_SET_BG_COL,
7b848b0d 144 LIST_TOGGLE_MULTI_SEL,
58b3bdc9 145 LIST_TOGGLE_FIRST,
f6bcfd97 146 LIST_SHOW_COL_INFO,
b54e41c5 147 LIST_SHOW_SEL_INFO,
88b792af 148 LIST_FOCUS_LAST,
457814b5 149
fa5f6926
VZ
150 LIST_CTRL = 1000
151};
457814b5 152