From 646930985a7a9bd840086a0011026b2bac188c29 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Fri, 26 Jun 1998 20:19:48 +0000 Subject: [PATCH] wxEventType alterations. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@150 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/defs.h | 3 ++- include/wx/event.h | 30 ++++++++++++++++-------------- include/wx/generic/listctrl.h | 4 ++-- include/wx/generic/treectrl.h | 28 +++++++++++++++++++++++++++- include/wx/msw/listctrl.h | 2 +- include/wx/msw/spinbutt.h | 2 +- include/wx/msw/tabctrl.h | 2 +- include/wx/msw/treectrl.h | 32 +++++++++++++++++++++++++++++--- 8 files changed, 79 insertions(+), 24 deletions(-) diff --git a/include/wx/defs.h b/include/wx/defs.h index 3b77dd23c4..a25d957fea 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -309,7 +309,7 @@ typedef void (*wxFunction) (wxObject&, wxEvent&); #define wxUSER_COLOURS 0x00800000 // Override CTL3D etc. control colour processing to // allow own background colour - // OBSOLETE - use wxNO_CTL3D instead + // OBSOLETE - use wxNO_3D instead #define wxNO_3D 0x00800000 // Override CTL3D or native 3D styles for children #define wxCLIP_CHILDREN 0x00400000 @@ -478,6 +478,7 @@ typedef void (*wxFunction) (wxObject&, wxEvent&); #define wxTR_HAS_BUTTONS 0x0004 #define wxTR_EDIT_LABELS 0x0008 +#define wxTR_LINES_AT_ROOT 0x0010 /* * wxListCtrl flags diff --git a/include/wx/event.h b/include/wx/event.h index d5ca286d2d..dc26feec37 100644 --- a/include/wx/event.h +++ b/include/wx/event.h @@ -24,7 +24,9 @@ * Event types * */ -enum { + +enum wxEventType { + wxEVT_NULL = 0, wxEVT_FIRST = 10000, // New names @@ -245,8 +247,8 @@ public: wxEvent(int id = 0); inline ~wxEvent(void) {} - inline void SetEventType(WXTYPE typ) { m_eventType = typ; } - inline WXTYPE GetEventType(void) const { return m_eventType; } + inline void SetEventType(wxEventType typ) { m_eventType = typ; } + inline wxEventType GetEventType(void) const { return m_eventType; } inline wxObject *GetEventObject(void) const { return m_eventObject; } inline void SetEventObject(wxObject *obj) { m_eventObject = obj; } inline long GetTimestamp(void) const { return m_timeStamp; } @@ -263,7 +265,7 @@ public: bool m_skipped; wxObject* m_eventObject; char* m_eventHandle; // Handle of an underlying windowing system event - WXTYPE m_eventType; + wxEventType m_eventType; long m_timeStamp; int m_id; wxObject* m_callbackUserData; @@ -292,7 +294,7 @@ class WXDLLEXPORT wxCommandEvent: public wxEvent { DECLARE_DYNAMIC_CLASS(wxCommandEvent) - wxCommandEvent(WXTYPE commandType = 0, int id = 0); + wxCommandEvent(wxEventType commandType = wxEVT_NULL, int id = 0); inline ~wxCommandEvent(void) {} /* @@ -346,7 +348,7 @@ class WXDLLEXPORT wxScrollEvent: public wxCommandEvent DECLARE_DYNAMIC_CLASS(wxScrollEvent) public: - wxScrollEvent(WXTYPE commandType = 0, int id = 0, int pos = 0, int orient = 0); + wxScrollEvent(wxEventType commandType = wxEVT_NULL, int id = 0, int pos = 0, int orient = 0); inline ~wxScrollEvent(void) {} /* @@ -394,7 +396,7 @@ class WXDLLEXPORT wxMouseEvent: public wxEvent DECLARE_DYNAMIC_CLASS(wxMouseEvent) public: - wxMouseEvent(WXTYPE mouseType = 0); + wxMouseEvent(wxEventType mouseType = wxEVT_NULL); // Was it a button event? (*doesn't* mean: is any button *down*?) inline bool IsButton(void) const { return Button(-1); } @@ -496,7 +498,7 @@ class WXDLLEXPORT wxKeyEvent: public wxEvent DECLARE_DYNAMIC_CLASS(wxKeyEvent) public: - wxKeyEvent(WXTYPE keyType = 0); + wxKeyEvent(wxEventType keyType = wxEVT_NULL); // Find state of shift/control keys inline bool ControlDown(void) const { return m_controlDown; } @@ -605,7 +607,7 @@ class WXDLLEXPORT wxFocusEvent: public wxEvent DECLARE_DYNAMIC_CLASS(wxFocusEvent) public: - inline wxFocusEvent(WXTYPE type = 0, int Id = 0) { m_eventType = type; m_id = Id; } + inline wxFocusEvent(wxEventType type = wxEVT_NULL, int Id = 0) { m_eventType = type; m_id = Id; } }; // Activate event class @@ -620,7 +622,7 @@ class WXDLLEXPORT wxActivateEvent: public wxEvent public: bool m_active; - inline wxActivateEvent(WXTYPE type = 0, bool active = TRUE, int Id = 0) { m_eventType = type; m_active = active; m_id = Id; } + inline wxActivateEvent(wxEventType type = wxEVT_NULL, bool active = TRUE, int Id = 0) { m_eventType = type; m_active = active; m_id = Id; } inline bool GetActive(void) const { return m_active; } }; @@ -653,7 +655,7 @@ class WXDLLEXPORT wxMenuEvent: public wxEvent public: int m_menuId; - inline wxMenuEvent(WXTYPE type = 0, int id = 0) { m_eventType = type; m_menuId = id; } + inline wxMenuEvent(wxEventType type = wxEVT_NULL, int id = 0) { m_eventType = type; m_menuId = id; } inline int GetMenuId(void) const { return m_menuId; } }; @@ -670,7 +672,7 @@ class WXDLLEXPORT wxCloseEvent: public wxEvent DECLARE_DYNAMIC_CLASS(wxCloseEvent) public: - inline wxCloseEvent(WXTYPE type = 0, int id = 0) + inline wxCloseEvent(wxEventType type = wxEVT_NULL, int id = 0) { m_eventType = type; m_sessionEnding = TRUE; m_loggingOff = TRUE; m_veto = FALSE; m_id = id; m_force = FALSE; } @@ -764,7 +766,7 @@ class WXDLLEXPORT wxJoystickEvent: public wxEvent int m_buttonState; // Which buttons are down? int m_joyStick; // Which joystick? - inline wxJoystickEvent(WXTYPE type = 0, int state = 0, int joystick = wxJOYSTICK1, int change = 0) + inline wxJoystickEvent(wxEventType type = wxEVT_NULL, int state = 0, int joystick = wxJOYSTICK1, int change = 0) { m_eventType = type; m_buttonState = state; m_pos = wxPoint(0,0); m_zPosition = 0; m_joyStick = joystick; m_buttonChange = change; } @@ -820,7 +822,7 @@ class WXDLLEXPORT wxDropFilesEvent: public wxEvent wxPoint m_pos; wxString* m_files; // Memory (de)allocated by code calling ProcessEvent - inline wxDropFilesEvent(WXTYPE type = 0, int noFiles = 0, wxString *files = NULL) + inline wxDropFilesEvent(wxEventType type = wxEVT_NULL, int noFiles = 0, wxString *files = NULL) { m_eventType = type; m_noFiles = noFiles; m_files = files; } inline wxPoint GetPosition(void) const { return m_pos; } diff --git a/include/wx/generic/listctrl.h b/include/wx/generic/listctrl.h index 93106ffa1d..11e0b1034b 100644 --- a/include/wx/generic/listctrl.h +++ b/include/wx/generic/listctrl.h @@ -202,7 +202,7 @@ class WXDLLEXPORT wxListEvent: public wxCommandEvent DECLARE_DYNAMIC_CLASS(wxListEvent) public: - wxListEvent(WXTYPE commandType = 0, int id = 0); + wxListEvent(wxEventType commandType = wxEVT_NULL, int id = 0); int m_code; long m_itemIndex; @@ -495,7 +495,7 @@ class wxListMainWindow: public wxScrolledWindow void OnPaint( wxPaintEvent &event ); void HilightAll( const bool on ); void ActivateLine( wxListLineData *line ); - void SendNotify( wxListLineData *line, long command ); + void SendNotify( wxListLineData *line, wxEventType command ); void FocusLine( wxListLineData *line ); void UnfocusLine( wxListLineData *line ); void SelectLine( wxListLineData *line ); diff --git a/include/wx/generic/treectrl.h b/include/wx/generic/treectrl.h index 21ef2cc1f4..1f5b3f3fe0 100644 --- a/include/wx/generic/treectrl.h +++ b/include/wx/generic/treectrl.h @@ -135,6 +135,27 @@ class WXDLLEXPORT wxTreeItem: public wxObject long m_data; wxTreeItem(void); + +// Accessors + inline long GetMask() const { return m_mask; } + inline long GetItemId() const { return m_itemId; } + inline long GetState() const { return m_state; } + inline long GetStateMask() const { return m_stateMask; } + inline wxString GetText() const { return m_text; } + inline int GetImage() const { return m_image; } + inline int GetSelectedImage() const { return m_selectedImage; } + inline int GetChildren() const { return m_children; } + inline long GetData() const { return m_data; } + + inline void SetMask(long mask) { m_mask = mask; } + inline void SetItemId(long id) { m_itemId = m_itemId = id; } + inline void GetState(long state) { m_state = state; } + inline void SetStateMask(long stateMask) { m_stateMask = stateMask; } + inline void GetText(const wxString& text) { m_text = text; } + inline void SetImage(int image) { m_image = image; } + inline void GetSelectedImage(int selImage) { m_selectedImage = selImage; } + inline void SetChildren(int children) { m_children = children; } + inline void SetData(long data) { m_data = data; } }; //----------------------------------------------------------------------------- @@ -146,12 +167,17 @@ class WXDLLEXPORT wxTreeEvent: public wxCommandEvent DECLARE_DYNAMIC_CLASS(wxTreeEvent) public: - wxTreeEvent(WXTYPE commandType = 0, int id = 0); + wxTreeEvent(wxEventType commandType = wxEVT_NULL, int id = 0); int m_code; wxTreeItem m_item; long m_oldItem; wxPoint m_pointDrag; + + inline long GetOldItem() const { return m_oldItem; } + inline wxTreeItem& GetItem() const { return (wxTreeItem&) m_item; } + inline wxPoint GetPoint() const { return m_pointDrag; } + inline int GetCode() const { return m_code; } }; typedef void (wxEvtHandler::*wxTreeEventFunction)(wxTreeEvent&); diff --git a/include/wx/msw/listctrl.h b/include/wx/msw/listctrl.h index c92ba10e5f..eab3584c61 100644 --- a/include/wx/msw/listctrl.h +++ b/include/wx/msw/listctrl.h @@ -444,7 +444,7 @@ class WXDLLEXPORT wxListEvent: public wxCommandEvent DECLARE_DYNAMIC_CLASS(wxListEvent) public: - wxListEvent(WXTYPE commandType = 0, int id = 0); + wxListEvent(wxEventType commandType = wxEVT_NULL, int id = 0); int m_code; long m_itemIndex; diff --git a/include/wx/msw/spinbutt.h b/include/wx/msw/spinbutt.h index 3b76035ae8..07b18e2b1c 100644 --- a/include/wx/msw/spinbutt.h +++ b/include/wx/msw/spinbutt.h @@ -82,7 +82,7 @@ class WXDLLEXPORT wxSpinEvent: public wxScrollEvent DECLARE_DYNAMIC_CLASS(wxSpinEvent) public: - wxSpinEvent(WXTYPE commandType = 0, int id = 0); + wxSpinEvent(wxEventType commandType = wxEVT_NULL, int id = 0); }; typedef void (wxEvtHandler::*wxSpinEventFunction)(wxSpinEvent&); diff --git a/include/wx/msw/tabctrl.h b/include/wx/msw/tabctrl.h index c7589bedee..51237149a6 100644 --- a/include/wx/msw/tabctrl.h +++ b/include/wx/msw/tabctrl.h @@ -136,7 +136,7 @@ class WXDLLEXPORT wxTabEvent: public wxCommandEvent DECLARE_DYNAMIC_CLASS(wxTabEvent) public: - wxTabEvent(WXTYPE commandType = 0, int id = 0); + wxTabEvent(wxEventType commandType = wxEVT_NULL, int id = 0); }; typedef void (wxEvtHandler::*wxTabEventFunction)(wxTabEvent&); diff --git a/include/wx/msw/treectrl.h b/include/wx/msw/treectrl.h index a846299906..1243428dc6 100644 --- a/include/wx/msw/treectrl.h +++ b/include/wx/msw/treectrl.h @@ -96,6 +96,27 @@ public: long m_data; wxTreeItem(void); + +// Accessors + inline long GetMask() const { return m_mask; } + inline long GetItemId() const { return m_itemId; } + inline long GetState() const { return m_state; } + inline long GetStateMask() const { return m_stateMask; } + inline wxString GetText() const { return m_text; } + inline int GetImage() const { return m_image; } + inline int GetSelectedImage() const { return m_selectedImage; } + inline int GetChildren() const { return m_children; } + inline long GetData() const { return m_data; } + + inline void SetMask(long mask) { m_mask = mask; } + inline void SetItemId(long id) { m_itemId = m_itemId = id; } + inline void GetState(long state) { m_state = state; } + inline void SetStateMask(long stateMask) { m_stateMask = stateMask; } + inline void GetText(const wxString& text) { m_text = text; } + inline void SetImage(int image) { m_image = image; } + inline void GetSelectedImage(int selImage) { m_selectedImage = selImage; } + inline void SetChildren(int children) { m_children = children; } + inline void SetData(long data) { m_data = data; } }; class WXDLLEXPORT wxTreeCtrl: public wxControl @@ -111,7 +132,7 @@ class WXDLLEXPORT wxTreeCtrl: public wxControl inline wxTreeCtrl(wxWindow *parent, const wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - const long style = wxTR_HAS_BUTTONS, + const long style = wxTR_HAS_BUTTONS|wxTR_LINES_AT_ROOT, const wxValidator& validator = wxDefaultValidator, const wxString& name = "wxTreeCtrl") { @@ -122,7 +143,7 @@ class WXDLLEXPORT wxTreeCtrl: public wxControl bool Create(wxWindow *parent, const wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - const long style = wxTR_HAS_BUTTONS, + const long style = wxTR_HAS_BUTTONS|wxTR_LINES_AT_ROOT, const wxValidator& validator = wxDefaultValidator, const wxString& name = "wxTreeCtrl"); @@ -201,12 +222,17 @@ class WXDLLEXPORT wxTreeEvent: public wxCommandEvent DECLARE_DYNAMIC_CLASS(wxTreeEvent) public: - wxTreeEvent(WXTYPE commandType = 0, int id = 0); + wxTreeEvent(wxEventType commandType = wxEVT_NULL, int id = 0); int m_code; wxTreeItem m_item; long m_oldItem; wxPoint m_pointDrag; + + inline long GetOldItem() const { return m_oldItem; } + inline wxTreeItem& GetItem() const { return (wxTreeItem&) m_item; } + inline wxPoint GetPoint() const { return m_pointDrag; } + inline int GetCode() const { return m_code; } }; typedef void (wxEvtHandler::*wxTreeEventFunction)(wxTreeEvent&); -- 2.45.2