]> git.saurik.com Git - wxWidgets.git/blob - src/common/listctrlcmn.cpp
fixing osx_cocoa
[wxWidgets.git] / src / common / listctrlcmn.cpp
1 ////////////////////////////////////////////////////////////////////////////////
2 // Name: src/common/listctrlcmn.cpp
3 // Purpose: Common defines for wxListCtrl and wxListCtrl-based classes.
4 // Author: Kevin Ollivier
5 // Created: 09/15/06
6 // RCS-ID: $Id$
7 // Copyright: (c) Kevin Ollivier
8 // Licence: wxWindows licence
9 ////////////////////////////////////////////////////////////////////////////////
10
11 // =============================================================================
12 // declarations
13 // =============================================================================
14
15 // -----------------------------------------------------------------------------
16 // headers
17 // -----------------------------------------------------------------------------
18
19 // For compilers that support precompilation, includes "wx.h".
20 #include "wx/wxprec.h"
21
22 #ifdef __BORLANDC__
23 #pragma hdrstop
24 #endif
25
26 #if wxUSE_LISTCTRL
27
28 #include "wx/listctrl.h"
29
30 const char wxListCtrlNameStr[] = "listCtrl";
31
32 // ListCtrl events
33 wxDEFINE_EVENT( wxEVT_COMMAND_LIST_BEGIN_DRAG, wxListEvent );
34 wxDEFINE_EVENT( wxEVT_COMMAND_LIST_BEGIN_RDRAG, wxListEvent );
35 wxDEFINE_EVENT( wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT, wxListEvent );
36 wxDEFINE_EVENT( wxEVT_COMMAND_LIST_END_LABEL_EDIT, wxListEvent );
37 wxDEFINE_EVENT( wxEVT_COMMAND_LIST_DELETE_ITEM, wxListEvent );
38 wxDEFINE_EVENT( wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS, wxListEvent );
39 wxDEFINE_EVENT( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEvent );
40 wxDEFINE_EVENT( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEvent );
41 wxDEFINE_EVENT( wxEVT_COMMAND_LIST_KEY_DOWN, wxListEvent );
42 wxDEFINE_EVENT( wxEVT_COMMAND_LIST_INSERT_ITEM, wxListEvent );
43 wxDEFINE_EVENT( wxEVT_COMMAND_LIST_COL_CLICK, wxListEvent );
44 wxDEFINE_EVENT( wxEVT_COMMAND_LIST_COL_RIGHT_CLICK, wxListEvent );
45 wxDEFINE_EVENT( wxEVT_COMMAND_LIST_COL_BEGIN_DRAG, wxListEvent );
46 wxDEFINE_EVENT( wxEVT_COMMAND_LIST_COL_DRAGGING, wxListEvent );
47 wxDEFINE_EVENT( wxEVT_COMMAND_LIST_COL_END_DRAG, wxListEvent );
48 wxDEFINE_EVENT( wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, wxListEvent );
49 wxDEFINE_EVENT( wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK, wxListEvent );
50 wxDEFINE_EVENT( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEvent );
51 wxDEFINE_EVENT( wxEVT_COMMAND_LIST_ITEM_FOCUSED, wxListEvent );
52 wxDEFINE_EVENT( wxEVT_COMMAND_LIST_CACHE_HINT, wxListEvent );
53
54 // -----------------------------------------------------------------------------
55 // XTI
56 // -----------------------------------------------------------------------------
57
58 wxDEFINE_FLAGS( wxListCtrlStyle )
59 wxBEGIN_FLAGS( wxListCtrlStyle )
60 // new style border flags, we put them first to
61 // use them for streaming out
62 wxFLAGS_MEMBER(wxBORDER_SIMPLE)
63 wxFLAGS_MEMBER(wxBORDER_SUNKEN)
64 wxFLAGS_MEMBER(wxBORDER_DOUBLE)
65 wxFLAGS_MEMBER(wxBORDER_RAISED)
66 wxFLAGS_MEMBER(wxBORDER_STATIC)
67 wxFLAGS_MEMBER(wxBORDER_NONE)
68
69 // old style border flags
70 wxFLAGS_MEMBER(wxSIMPLE_BORDER)
71 wxFLAGS_MEMBER(wxSUNKEN_BORDER)
72 wxFLAGS_MEMBER(wxDOUBLE_BORDER)
73 wxFLAGS_MEMBER(wxRAISED_BORDER)
74 wxFLAGS_MEMBER(wxSTATIC_BORDER)
75 wxFLAGS_MEMBER(wxBORDER)
76
77 // standard window styles
78 wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
79 wxFLAGS_MEMBER(wxCLIP_CHILDREN)
80 wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)
81 wxFLAGS_MEMBER(wxWANTS_CHARS)
82 wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE)
83 wxFLAGS_MEMBER(wxALWAYS_SHOW_SB )
84 wxFLAGS_MEMBER(wxVSCROLL)
85 wxFLAGS_MEMBER(wxHSCROLL)
86
87 wxFLAGS_MEMBER(wxLC_LIST)
88 wxFLAGS_MEMBER(wxLC_REPORT)
89 wxFLAGS_MEMBER(wxLC_ICON)
90 wxFLAGS_MEMBER(wxLC_SMALL_ICON)
91 wxFLAGS_MEMBER(wxLC_ALIGN_TOP)
92 wxFLAGS_MEMBER(wxLC_ALIGN_LEFT)
93 wxFLAGS_MEMBER(wxLC_AUTOARRANGE)
94 wxFLAGS_MEMBER(wxLC_USER_TEXT)
95 wxFLAGS_MEMBER(wxLC_EDIT_LABELS)
96 wxFLAGS_MEMBER(wxLC_NO_HEADER)
97 wxFLAGS_MEMBER(wxLC_SINGLE_SEL)
98 wxFLAGS_MEMBER(wxLC_SORT_ASCENDING)
99 wxFLAGS_MEMBER(wxLC_SORT_DESCENDING)
100 wxFLAGS_MEMBER(wxLC_VIRTUAL)
101 wxEND_FLAGS( wxListCtrlStyle )
102
103 #if ((!defined(__WXMSW__) && !(defined(__WXMAC__) && wxOSX_USE_CARBON)) || defined(__WXUNIVERSAL__))
104 wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxListCtrl, wxGenericListCtrl, "wx/listctrl.h")
105 #else
106 wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxListCtrl, wxControl, "wx/listctrl.h")
107 #endif
108
109 wxBEGIN_PROPERTIES_TABLE(wxListCtrl)
110 wxEVENT_PROPERTY( TextUpdated, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEvent )
111
112 wxPROPERTY_FLAGS( WindowStyle, wxListCtrlStyle, long, SetWindowStyleFlag, \
113 GetWindowStyleFlag, wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, \
114 wxT("Helpstring"), wxT("group")) // style
115 wxEND_PROPERTIES_TABLE()
116
117 wxEMPTY_HANDLERS_TABLE(wxListCtrl)
118
119 wxCONSTRUCTOR_5( wxListCtrl, wxWindow*, Parent, wxWindowID, Id, \
120 wxPoint, Position, wxSize, Size, long, WindowStyle )
121
122 /*
123 TODO : Expose more information of a list's layout etc. via appropriate objects
124 (see NotebookPageInfo)
125 */
126
127 IMPLEMENT_DYNAMIC_CLASS(wxListView, wxListCtrl)
128 IMPLEMENT_DYNAMIC_CLASS(wxListItem, wxObject)
129 IMPLEMENT_DYNAMIC_CLASS(wxListEvent, wxNotifyEvent)
130
131 #endif // wxUSE_LISTCTRL