]> git.saurik.com Git - wxWidgets.git/blame - samples/listctrl/listtest.h
added wxUSE_POPUPWIN
[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:
5ea47806
VZ
22 MyListCtrl(wxWindow *parent, const wxWindowID id, const wxPoint& pos,
23 const wxSize& size, long style):
457814b5 24 wxListCtrl(parent, id, pos, size, style)
5ea47806
VZ
25 {
26 }
fa5f6926 27
5cd89174
VZ
28 // add one item to the listctrl in report mode
29 void InsertItemInReportView(int i);
30
8636aed8 31 void OnColClick(wxListEvent& event);
5ea47806
VZ
32 void OnBeginDrag(wxListEvent& event);
33 void OnBeginRDrag(wxListEvent& event);
34 void OnBeginLabelEdit(wxListEvent& event);
35 void OnEndLabelEdit(wxListEvent& event);
36 void OnDeleteItem(wxListEvent& event);
12c1b46a 37 void OnDeleteAllItems(wxListEvent& event);
5ea47806
VZ
38 void OnGetInfo(wxListEvent& event);
39 void OnSetInfo(wxListEvent& event);
40 void OnSelected(wxListEvent& event);
41 void OnDeselected(wxListEvent& event);
42 void OnListKeyDown(wxListEvent& event);
43 void OnActivated(wxListEvent& event);
457814b5 44
88ac883a
VZ
45 void OnChar(wxKeyEvent& event);
46
c41ea66a
VZ
47private:
48 void LogEvent(const wxListEvent& event, const wxChar *eventName);
49
98ec9dbe
VZ
50 virtual wxString OnGetItemText(long item, long column) const;
51 virtual int OnGetItemImage(long item) const;
52
5ea47806 53 DECLARE_EVENT_TABLE()
457814b5
JS
54};
55
56// Define a new frame type
57class MyFrame: public wxFrame
5ea47806
VZ
58{
59public:
457814b5
JS
60 MyListCtrl *m_listCtrl;
61 wxTextCtrl *m_logWindow;
62
c41ea66a 63 MyFrame(const wxChar *title, int x, int y, int w, int h);
5ea47806
VZ
64 ~MyFrame();
65
66public:
98ec9dbe
VZ
67 void OnSize(wxSizeEvent& event);
68
457814b5
JS
69 void OnQuit(wxCommandEvent& event);
70 void OnAbout(wxCommandEvent& event);
71 void OnListView(wxCommandEvent& event);
72 void OnReportView(wxCommandEvent& event);
73 void OnIconView(wxCommandEvent& event);
74 void OnIconTextView(wxCommandEvent& event);
75 void OnSmallIconView(wxCommandEvent& event);
76 void OnSmallIconTextView(wxCommandEvent& event);
98ec9dbe
VZ
77 void OnVirtualView(wxCommandEvent& event);
78
58b3bdc9 79 void OnToggleFirstSel(wxCommandEvent& event);
c4771147
KB
80 void OnDeselectAll(wxCommandEvent& event);
81 void OnSelectAll(wxCommandEvent& event);
cf1dfa6b 82 void OnAdd(wxCommandEvent& event);
bec0a261 83 void OnDelete(wxCommandEvent& event);
5ea47806 84 void OnDeleteAll(wxCommandEvent& event);
fa5f6926 85 void OnSort(wxCommandEvent& event);
11f26ea0
VZ
86 void OnSetFgColour(wxCommandEvent& event);
87 void OnSetBgColour(wxCommandEvent& event);
7b848b0d 88 void OnToggleMultiSel(wxCommandEvent& event);
f6bcfd97 89 void OnShowColInfo(wxCommandEvent& event);
b54e41c5 90 void OnShowSelInfo(wxCommandEvent& event);
5ea47806 91
98ec9dbe 92 void OnUpdateShowColInfo(wxUpdateUIEvent& event);
5ea47806 93
c41ea66a
VZ
94 wxImageList *m_imageListNormal;
95 wxImageList *m_imageListSmall;
96
97private:
776a33cf
VZ
98 // recreate the list control with the new flags
99 void RecreateList(long flags, bool withText = TRUE);
100
101 // fill the control with items depending on the view
102 void InitWithListItems();
103 void InitWithReportItems();
104 void InitWithIconItems(bool withText, bool sameIcon = FALSE);
105 void InitWithVirtualItems();
106
c41ea66a
VZ
107 wxLog *m_logOld;
108
5ea47806 109 DECLARE_EVENT_TABLE()
457814b5
JS
110};
111
112
98ec9dbe 113// IDs for the menu commands
fa5f6926
VZ
114enum
115{
cf1dfa6b 116 LIST_ABOUT,
98ec9dbe 117 LIST_QUIT,
cf1dfa6b 118
98ec9dbe
VZ
119 LIST_LIST_VIEW,
120 LIST_ICON_VIEW,
121 LIST_ICON_TEXT_VIEW,
122 LIST_SMALL_ICON_VIEW,
123 LIST_SMALL_ICON_TEXT_VIEW,
cf1dfa6b 124 LIST_REPORT_VIEW,
98ec9dbe
VZ
125 LIST_VIRTUAL_VIEW,
126
98ec9dbe
VZ
127 LIST_DESELECT_ALL,
128 LIST_SELECT_ALL,
98ec9dbe 129 LIST_DELETE_ALL,
bec0a261 130 LIST_DELETE,
cf1dfa6b 131 LIST_ADD,
fa5f6926 132 LIST_SORT,
11f26ea0
VZ
133 LIST_SET_FG_COL,
134 LIST_SET_BG_COL,
7b848b0d 135 LIST_TOGGLE_MULTI_SEL,
58b3bdc9 136 LIST_TOGGLE_FIRST,
f6bcfd97 137 LIST_SHOW_COL_INFO,
b54e41c5 138 LIST_SHOW_SEL_INFO,
457814b5 139
fa5f6926
VZ
140 LIST_CTRL = 1000
141};
457814b5 142