]> git.saurik.com Git - wxWidgets.git/blame - samples/xrc/custclas.h
Don't assume any particular default size for XRC image lists.
[wxWidgets.git] / samples / xrc / custclas.h
CommitLineData
af1337b0
JS
1//-----------------------------------------------------------------------------
2// Name: custclas.h
3// Purpose: XML resources sample: A custom class to insert into a XRC file
4// Author: Robert O'Connor (rob@medicalmnemonics.com), Vaclav Slavik
5// RCS-ID: $Id$
6// Copyright: (c) Robert O'Connor and Vaclav Slavik
7// Licence: wxWindows licence
8//-----------------------------------------------------------------------------
9
10//----------------------------------------------------------------------------------------
11// Begin single inclusion of this .h file condition
12//----------------------------------------------------------------------------------------
13
14#ifndef _CUSTCLAS_H_
15#define _CUSTCLAS_H_
16
17//----------------------------------------------------------------------------------------
af1337b0
JS
18// Headers
19//----------------------------------------------------------------------------------------
20
21#include "wx/listctrl.h"
22
23//----------------------------------------------------------------------------------------
24// Class definition: MyResizableListCtrl
25//----------------------------------------------------------------------------------------
26
27//! A custom listctrl that resizes itself and pops up a context-sensitive menu.
28class MyResizableListCtrl : public wxListCtrl
29{
be5a51fb
JS
30 // Very helpful wxWidgets macro required for wxWidgets-RTTI tracing: By using this
31 // you will see "Leaked one object of type myResizeableListCtrl" in the debug log,
af1337b0 32 // along with which line you if was created, but you forget to free the memory.
f80ea77b 33 // NOTE: Using this REQUIRES a default constructor: that means either: giving a
af1337b0
JS
34 // default value for all parameters in your constructor, or else having a dummy
35 // MyResizableListCtrl(){} constructor in addition to your regular one.
36 DECLARE_DYNAMIC_CLASS( MyResizableListCtrl )
37
38public:
39
f80ea77b 40 // Constructor.
af1337b0 41 /*
be5a51fb 42 These parameters are the same as a wxWidgets constructor.
af1337b0
JS
43 \param parent The parent window.
44 \param id The id of the progress_listbox. Will usually be -1 unless multiple
45 of them on the same dialog.
46 \param pos The pixel position of the listctrl on its parent window
47 \param size The pixel size of the listctrl
be5a51fb
JS
48 \param style Style of the listbox. See wxWidgets wxListBox docs for details.
49 \param validator Window validator. See wxWidgets docs for details.
af1337b0
JS
50 \param name Windows name (rarely used).
51 \param exclusion_column_caption The label of header of listctrl's exclusion
52 column.
53 */
54 MyResizableListCtrl( wxWindow *parent = NULL,
f80ea77b 55 wxWindowID id = wxID_ANY,
af1337b0
JS
56 const wxPoint &pos = wxDefaultPosition,
57 const wxSize &size = wxDefaultSize,
58 long style = wxLC_REPORT,
59 const wxValidator& validator = wxDefaultValidator,
60 const wxString &name = wxT("myResizableListCtrl")
f80ea77b 61 );
af1337b0
JS
62
63 // Destuctor.
925e9792 64 ~MyResizableListCtrl(){};
af1337b0 65
f80ea77b
WS
66protected:
67
68 // A custom function for a context sensitive menu.
69 void ContextSensitiveMenu( wxMouseEvent& event );
af1337b0 70
be5a51fb 71 // This is a wxWidgets function that we are going to override with our own behaviour.
af1337b0 72 void OnSize( wxSizeEvent &event );
f80ea77b 73
af1337b0 74 // A custom function. What is called in the constructor, and in an OnSize()
f80ea77b
WS
75 void SetColumnWidths();
76
af1337b0
JS
77private:
78
be5a51fb 79 // wxWidgets macro, required to be able to use Event tables in the .cpp file.
af1337b0 80 DECLARE_EVENT_TABLE()
f80ea77b 81
af1337b0
JS
82};
83
84//----------------------------------------------------------------------------------------
85// End single inclusion of this .h file condition
86//----------------------------------------------------------------------------------------
87
88#endif //_CUSTCLAS_H_
89