wxWindowVariant GetWindowVariant() const { return m_windowVariant; }
- // window id uniquely identifies the window among its siblings unless
- // it is wxID_ANY which means "don't care"
- void SetId( wxWindowID winid ) { m_windowId = winid; }
- wxWindowID GetId() const { return m_windowId; }
-
// get or change the layout direction (LTR or RTL) for this window,
// wxLayout_Default is returned if layout direction is not supported
virtual wxLayoutDirection GetLayoutDirection() const
wxCoord width,
wxCoord widthTotal) const;
- // generate a control id for the controls which were not given one by
- // user
- static int NewControlId() { return --ms_lastControlId; }
- // get the id of the control following the one with the given
- // (autogenerated) id
- static int NextControlId(int winid) { return winid - 1; }
- // get the id of the control preceding the one with the given
- // (autogenerated) id
- static int PrevControlId(int winid) { return winid + 1; }
+
+ // window id uniquely identifies the window among its siblings unless
+ // it is wxID_ANY which means "don't care"
+ void SetId( wxWindowID winid ) { m_windowId = winid; }
+ wxWindowID GetId() const { return m_windowId; }
+
+ // returns true if this id value belong to the range reserved for the
+ // auto-generated (by NewControlId()) ids (they're always negative)
+ static bool IsAutoGeneratedId(wxWindowID id);
+
+ // generate a unique id (or count of them consecutively), returns a
+ // valid id in IsAutoGeneratedId() range or wxID_NONE if failed
+ static wxWindowID NewControlId(int count = 1);
+
+ // mark an id previously returned by NewControlId() as being unused any
+ // more so that it can be reused again for another control later
+ static void ReleaseControlId(wxWindowID id);
+
// moving/resizing
// ---------------
virtual void DoUpdateWindowUI(wxUpdateUIEvent& event) ;
#if wxUSE_MENUS
+ // show popup menu at the given position, generate events for the items
+ // selected in it
bool PopupMenu(wxMenu *menu, const wxPoint& pos = wxDefaultPosition)
{ return DoPopupMenu(menu, pos.x, pos.y); }
bool PopupMenu(wxMenu *menu, int x, int y)
{ return DoPopupMenu(menu, x, y); }
+
+ // simply return the id of the selected item or wxID_NONE without
+ // generating any events
+ int GetPopupMenuSelectionFromUser(wxMenu& menu, const wxPoint& pos)
+ { return DoGetPopupMenuSelectionFromUser(menu, pos.x, pos.y); }
+ int GetPopupMenuSelectionFromUser(wxMenu& menu, int x, int y)
+ { return DoGetPopupMenuSelectionFromUser(menu, x, y); }
#endif // wxUSE_MENUS
// override this method to return true for controls having multiple pages
bool PageUp() { return ScrollPages(-1); }
bool PageDown() { return ScrollPages(1); }
+ // call this to always show one or both scrollbars, even if the window
+ // is big enough to not require them
+ virtual void AlwaysShowScrollbars(bool WXUNUSED(horz) = true,
+ bool WXUNUSED(vert) = true)
+ {
+ }
+
+ // return true if AlwaysShowScrollbars() had been called before for the
+ // corresponding orientation
+ virtual bool IsScrollbarAlwaysShown(int WXUNUSED(orient)) const
+ {
+ return false;
+ }
+
// context-sensitive help
// ----------------------
// area (normal windows can't, but e.g. menubar or statusbar can):
virtual bool CanBeOutsideClientArea() const { return false; }
- // returns true if the platform should explicitly apply a theme border
+ // returns true if the platform should explicitly apply a theme border. Currently
+ // used only by Windows
virtual bool CanApplyThemeBorder() const { return true; }
protected:
// implementation of Navigate() and NavigateIn()
virtual bool DoNavigateIn(int flags);
-
#if wxUSE_CONSTRAINTS
// satisfy the constraints for the windows but don't set the window sizes
void SatisfyConstraints();
// Layout() window automatically when its size changes?
bool m_autoLayout:1;
+ // true if we had automatically allocated the id value for this window
+ // (i.e. wxID_ANY had been passed to the ctor)
+ bool m_freeId:1;
+
// window state
bool m_isShown:1;
bool m_isEnabled:1;
// this allows you to implement standard control borders without
// repeating the code in different classes that are not derived from
// wxControl
- virtual wxBorder GetDefaultBorderForControl() const { return wxBORDER_SUNKEN; }
+ virtual wxBorder GetDefaultBorderForControl() const { return wxBORDER_THEME; }
// Get the default size for the new window if no explicit size given. TLWs
// have their own default size so this is just for non top-level windows.
// enabled/disabled
void NotifyWindowOnEnableChange(bool enabled);
+#if wxUSE_MENUS
+ // temporary event handler used by GetPopupMenuSelectionFromUser()
+ void InternalOnPopupMenu(wxCommandEvent& event);
- // contains the last id generated by NewControlId
- static int ms_lastControlId;
+ // implementation of the public GetPopupMenuSelectionFromUser() method
+ int DoGetPopupMenuSelectionFromUser(wxMenu& menu, int x, int y);
+#endif // wxUSE_MENUS
// the stack of windows which have captured the mouse
static struct WXDLLIMPEXP_FWD_CORE wxWindowNext *ms_winCaptureNext;