// UI helpers
// ----------
-#if wxUSE_MENU
+#if wxUSE_MENUS
// show the popup menu containing all columns with check marks for the ones
// which are currently shown and return true if something was done using it
// (in this case UpdateColumnVisibility() will have been called) or false
// the ids of the items corresponding to the columns are consecutive and
// start from idColumnsBase
void AddColumnsItems(wxMenu& menu, int idColumnsBase = 0);
-#endif // wxUSE_MENU
+#endif // wxUSE_MENUS
// show the columns customization dialog and return true if something was
// changed using it (in which case UpdateColumnVisibility() and/or
// specified) and if the control has wxHD_ALLOW_REORDER style as well
bool ShowCustomizeDialog();
+ // compute column title width
+ int GetColumnTitleWidth(const wxHeaderColumn& col);
// implementation only from now on
// -------------------------------
// indices after the number of columns changed
void DoResizeColumnIndices(wxArrayInt& colIndices, unsigned int count);
+protected:
+ // this window doesn't look nice with the border so don't use it by default
+ virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
+
private:
// methods implementing our public API and defined in platform-specific
// implementations
virtual void DoSetColumnsOrder(const wxArrayInt& order) = 0;
virtual wxArrayInt DoGetColumnsOrder() const = 0;
- // this window doesn't look nice with the border so don't use it by default
- virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
// event handlers
void OnSeparatorDClick(wxHeaderCtrlEvent& event);
-#if wxUSE_MENU
+#if wxUSE_MENUS
void OnRClick(wxHeaderCtrlEvent& event);
-#endif // wxUSE_MENU
+#endif // wxUSE_MENUS
DECLARE_EVENT_TABLE()
};
void Init();
// bring the column count in sync with the number of columns we store
- void UpdateColumnCount() { SetColumnCount(m_cols.size()); }
+ void UpdateColumnCount()
+ {
+ SetColumnCount(static_cast<int>(m_cols.size()));
+ }
// all our current columns
unsigned int m_sortKey;
- DECLARE_NO_COPY_CLASS(wxHeaderCtrlSimple)
+ wxDECLARE_NO_COPY_CLASS(wxHeaderCtrlSimple);
};
// ----------------------------------------------------------------------------
};
-extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_HEADER_CLICK;
-extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_HEADER_RIGHT_CLICK;
-extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_HEADER_MIDDLE_CLICK;
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_CLICK, wxHeaderCtrlEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_RIGHT_CLICK, wxHeaderCtrlEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_MIDDLE_CLICK, wxHeaderCtrlEvent );
-extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_HEADER_DCLICK;
-extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_HEADER_RIGHT_DCLICK;
-extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_HEADER_MIDDLE_DCLICK;
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_DCLICK, wxHeaderCtrlEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_RIGHT_DCLICK, wxHeaderCtrlEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_MIDDLE_DCLICK, wxHeaderCtrlEvent );
-extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_HEADER_SEPARATOR_DCLICK;
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_SEPARATOR_DCLICK, wxHeaderCtrlEvent );
-extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_HEADER_BEGIN_RESIZE;
-extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_HEADER_RESIZING;
-extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_HEADER_END_RESIZE;
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_BEGIN_RESIZE, wxHeaderCtrlEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_RESIZING, wxHeaderCtrlEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_END_RESIZE, wxHeaderCtrlEvent );
-extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_HEADER_BEGIN_REORDER;
-extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_HEADER_END_REORDER;
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_BEGIN_REORDER, wxHeaderCtrlEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_END_REORDER, wxHeaderCtrlEvent );
-extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_HEADER_DRAGGING_CANCELLED;
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_HEADER_DRAGGING_CANCELLED, wxHeaderCtrlEvent );
typedef void (wxEvtHandler::*wxHeaderCtrlEventFunction)(wxHeaderCtrlEvent&);
#define wxHeaderCtrlEventHandler(func) \
- (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent( \
- wxHeaderCtrlEventFunction, &func)
+ wxEVENT_HANDLER_CAST(wxHeaderCtrlEventFunction, func)
#define wx__DECLARE_HEADER_EVT(evt, id, fn) \
- wx__DECLARE_EVT1(wxEVT_COMMAND_HEADER_ ## evt, id, wxHeaderCtrlEventHandler(fn))
+ wx__DECLARE_EVT1(wxEVT_HEADER_ ## evt, id, wxHeaderCtrlEventHandler(fn))
#define EVT_HEADER_CLICK(id, fn) wx__DECLARE_HEADER_EVT(CLICK, id, fn)
#define EVT_HEADER_RIGHT_CLICK(id, fn) wx__DECLARE_HEADER_EVT(RIGHT_CLICK, id, fn)
#define EVT_HEADER_DRAGGING_CANCELLED(id, fn) wx__DECLARE_HEADER_EVT(DRAGGING_CANCELLED, id, fn)
+// old wxEVT_COMMAND_* constants
+#define wxEVT_COMMAND_HEADER_CLICK wxEVT_HEADER_CLICK
+#define wxEVT_COMMAND_HEADER_RIGHT_CLICK wxEVT_HEADER_RIGHT_CLICK
+#define wxEVT_COMMAND_HEADER_MIDDLE_CLICK wxEVT_HEADER_MIDDLE_CLICK
+#define wxEVT_COMMAND_HEADER_DCLICK wxEVT_HEADER_DCLICK
+#define wxEVT_COMMAND_HEADER_RIGHT_DCLICK wxEVT_HEADER_RIGHT_DCLICK
+#define wxEVT_COMMAND_HEADER_MIDDLE_DCLICK wxEVT_HEADER_MIDDLE_DCLICK
+#define wxEVT_COMMAND_HEADER_SEPARATOR_DCLICK wxEVT_HEADER_SEPARATOR_DCLICK
+#define wxEVT_COMMAND_HEADER_BEGIN_RESIZE wxEVT_HEADER_BEGIN_RESIZE
+#define wxEVT_COMMAND_HEADER_RESIZING wxEVT_HEADER_RESIZING
+#define wxEVT_COMMAND_HEADER_END_RESIZE wxEVT_HEADER_END_RESIZE
+#define wxEVT_COMMAND_HEADER_BEGIN_REORDER wxEVT_HEADER_BEGIN_REORDER
+#define wxEVT_COMMAND_HEADER_END_REORDER wxEVT_HEADER_END_REORDER
+#define wxEVT_COMMAND_HEADER_DRAGGING_CANCELLED wxEVT_HEADER_DRAGGING_CANCELLED
+
#endif // wxUSE_HEADERCTRL
#endif // _WX_HEADERCTRL_H_