]> git.saurik.com Git - wxWidgets.git/blob - samples/xrc/custclas.h
The UseAntiAliasing is off by default on wxMac. Add a menu item to
[wxWidgets.git] / samples / xrc / custclas.h
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 //----------------------------------------------------------------------------------------
18 // GCC interface
19 //----------------------------------------------------------------------------------------
20
21 #if defined(__GNUG__) && !defined(__APPLE__)
22 #pragma interface "custclas.h"
23 #endif
24
25 //----------------------------------------------------------------------------------------
26 // Headers
27 //----------------------------------------------------------------------------------------
28
29 #include "wx/listctrl.h"
30
31 //----------------------------------------------------------------------------------------
32 // Class definition: MyResizableListCtrl
33 //----------------------------------------------------------------------------------------
34
35 //! A custom listctrl that resizes itself and pops up a context-sensitive menu.
36 class MyResizableListCtrl : public wxListCtrl
37 {
38 // Very helpful wxWindows macro required for wxWindows-RTTI tracing: By using this
39 // you will see "Leaked one object of type myResizeableListCtrl" in the debug log,
40 // along with which line you if was created, but you forget to free the memory.
41 // NOTE: Using this REQUIRES a default constructor: that means either: giving a
42 // default value for all parameters in your constructor, or else having a dummy
43 // MyResizableListCtrl(){} constructor in addition to your regular one.
44 DECLARE_DYNAMIC_CLASS( MyResizableListCtrl )
45
46 public:
47
48 // Constructor.
49 /*
50 These parameters are the same as a wxWindows constructor.
51 \param parent The parent window.
52 \param id The id of the progress_listbox. Will usually be -1 unless multiple
53 of them on the same dialog.
54 \param pos The pixel position of the listctrl on its parent window
55 \param size The pixel size of the listctrl
56 \param style Style of the listbox. See wxWindows wxListBox docs for details.
57 \param validator Window validator. See wxWindows docs for details.
58 \param name Windows name (rarely used).
59 \param exclusion_column_caption The label of header of listctrl's exclusion
60 column.
61 */
62 MyResizableListCtrl( wxWindow *parent = NULL,
63 wxWindowID id = -1,
64 const wxPoint &pos = wxDefaultPosition,
65 const wxSize &size = wxDefaultSize,
66 long style = wxLC_REPORT,
67 const wxValidator& validator = wxDefaultValidator,
68 const wxString &name = wxT("myResizableListCtrl")
69 );
70
71 // Destuctor.
72 ~MyResizableListCtrl();
73
74 protected:
75
76 // A custom function for a context sensitive menu.
77 void ContextSensitiveMenu( wxMouseEvent& event );
78
79 // This is a wxWindows function that we are going to override with our own behaviour.
80 void OnSize( wxSizeEvent &event );
81
82 // A custom function. What is called in the constructor, and in an OnSize()
83 void SetColumnWidths();
84
85 private:
86
87 // wxWindows macro, required to be able to use Event tables in the .cpp file.
88 DECLARE_EVENT_TABLE()
89
90 };
91
92 //----------------------------------------------------------------------------------------
93 // End single inclusion of this .h file condition
94 //----------------------------------------------------------------------------------------
95
96 #endif //_CUSTCLAS_H_
97