#include "wx/colour.h"
#include "wx/region.h"
#include "wx/utils.h"
+#include "wx/intl.h"
#include "wx/validate.h" // for wxDefaultValidator (always include it)
// ----------------------------------------------------------------------------
extern WXDLLEXPORT_DATA(wxWindowList) wxTopLevelWindows;
+extern WXDLLIMPEXP_DATA_CORE(wxList) wxPendingDelete;
// ----------------------------------------------------------------------------
// wxWindowBase is the base class for all GUI controls/widgets, this is the public
virtual void SetName( const wxString &name ) { m_windowName = name; }
virtual wxString GetName() const { return m_windowName; }
- // sets the window variant, calls internally DoSetVariant if variant has changed
- void SetWindowVariant( wxWindowVariant variant ) ;
- wxWindowVariant GetWindowVariant() const { return m_windowVariant ; }
+ // sets the window variant, calls internally DoSetVariant if variant
+ // has changed
+ void SetWindowVariant(wxWindowVariant variant);
+ wxWindowVariant GetWindowVariant() const { return m_windowVariant; }
// window id uniquely identifies the window among its siblings unless
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
+ { return wxLayout_Default; }
+ virtual void SetLayoutDirection(wxLayoutDirection WXUNUSED(dir))
+ { }
+
+ // mirror coordinates for RTL layout if this window uses it and if the
+ // mirroring is not done automatically like Win32
+ virtual wxCoord AdjustForLayoutDirection(wxCoord x,
+ 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; }
virtual bool IsShown() const { return m_isShown; }
virtual bool IsEnabled() const { return m_isEnabled; }
+ // returns true if the window is visible, i.e. IsShown() returns true
+ // if called on it and all its parents up to the first TLW
+ virtual bool IsVisible() const;
+
// get/set window style (setting style won't update the window and so
// is only useful for internal usage)
virtual void SetWindowStyleFlag( long style ) { m_windowStyle = style; }
// click it
virtual bool AcceptsFocusFromKeyboard() const { return AcceptsFocus(); }
- // NB: these methods really don't belong here but with the current
- // class hierarchy there is no other place for them :-(
-
- // get the default child of this parent, i.e. the one which is
- // activated by pressing <Enter>
- virtual wxWindow *GetDefaultItem() const { return NULL; }
-
- // set this child as default, return the old default
- virtual wxWindow *SetDefaultItem(wxWindow * WXUNUSED(child))
- { return NULL; }
-
- // set this child as temporary default
- virtual void SetTmpDefaultItem(wxWindow * WXUNUSED(win)) { }
-
// navigates in the specified direction by sending a wxNavigationKeyEvent
virtual bool Navigate(int flags = wxNavigationKeyEvent::IsForward);
{ return DoPopupMenu(menu, x, y); }
#endif // wxUSE_MENUS
+ // override this method to return true for controls having multiple pages
+ virtual bool HasMultiplePages() const { return false; }
+
+
// scrollbars
// ----------
// associate this help text with all windows with the same id as this
// one
void SetHelpTextForId(const wxString& text);
- // get the help string associated with this window (may be empty)
- wxString GetHelpText() const;
-#else
+ // get the help string associated with the given position in this window
+ //
+ // notice that pt may be invalid if event origin is keyboard or unknown
+ // and this method should return the global window help text then
+ virtual wxString GetHelpTextAtPoint(const wxPoint& pt,
+ wxHelpEvent::Origin origin) const;
+ // returns the position-independent help text
+ wxString GetHelpText() const
+ {
+ return GetHelpTextAtPoint(wxDefaultPosition, wxHelpEvent::Origin_Unknown);
+ }
+
+#else // !wxUSE_HELP
// silently ignore SetHelpText() calls
void SetHelpText(const wxString& WXUNUSED(text)) { }
void SetHelpTextForId(const wxString& WXUNUSED(text)) { }
wxAccessible* GetOrCreateAccessible() ;
#endif
+
+ // Set window transparency if the platform supports it
+ virtual bool SetTransparent(wxByte WXUNUSED(alpha)) { return false; }
+ virtual bool CanSetTransparent() { return false; }
+
+
// implementation
// --------------
// implements the window variants
virtual void DoSetWindowVariant( wxWindowVariant variant ) ;
+ // Must be called when mouse capture is lost to send
+ // wxMouseCaptureLostEvent to windows on capture stack.
+ static void NotifyCaptureLost();
+
private:
// contains the last id generated by NewControlId
static int ms_lastControlId;
// the stack of windows which have captured the mouse
static struct WXDLLEXPORT wxWindowNext *ms_winCaptureNext;
+ // the window that currently has mouse capture
+ static wxWindow *ms_winCaptureCurrent;
+ // indicates if execution is inside CaptureMouse/ReleaseMouse
+ static bool ms_winCaptureChanging;
DECLARE_ABSTRACT_CLASS(wxWindowBase)
DECLARE_NO_COPY_CLASS(wxWindowBase)
#endif // wxUniv
#include "wx/x11/window.h"
#elif defined(__WXMGL__)
- #ifdef __WXUNIVERSAL__
- #define wxWindowNative wxWindowMGL
- #else // !wxUniv
- #define wxWindowMGL wxWindow
- #endif // wxUniv
+ #define wxWindowNative wxWindowMGL
#include "wx/mgl/window.h"
+#elif defined(__WXDFB__)
+ #define wxWindowNative wxWindowDFB
+ #include "wx/dfb/window.h"
#elif defined(__WXMAC__)
#ifdef __WXUNIVERSAL__
#define wxWindowNative wxWindowMac