X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a83e14751f3b4bb86da3ac2edea09c7f78f3ca3e..bff4ec6360d28f3309e5199685950b43ab5e079a:/include/wx/window.h diff --git a/include/wx/window.h b/include/wx/window.h index 905327ad1a..90611c917b 100644 --- a/include/wx/window.h +++ b/include/wx/window.h @@ -32,6 +32,11 @@ #include "wx/validate.h" // for wxDefaultValidator (always include it) +#if wxUSE_PALETTE + #include "wx/dcclient.h" + #include "wx/palette.h" +#endif // wxUSE_PALETTE + #if wxUSE_ACCEL #include "wx/accel.h" #endif // wxUSE_ACCEL @@ -288,8 +293,8 @@ public: int maxW = -1, int maxH = -1, int incW = -1, int incH = -1 ); - int GetMinWidth() const { return m_minWidth; } - int GetMinHeight() const { return m_minHeight; } + virtual int GetMinWidth() const { return m_minWidth; } + virtual int GetMinHeight() const { return m_minHeight; } int GetMaxWidth() const { return m_maxWidth; } int GetMaxHeight() const { return m_maxHeight; } @@ -322,7 +327,7 @@ public: // extra style: the less often used style bits which can't be set with // SetWindowStyleFlag() - void SetExtraStyle(long exStyle) { m_exStyle = exStyle; } + virtual void SetExtraStyle(long exStyle) { m_exStyle = exStyle; } long GetExtraStyle() const { return m_exStyle; } // make the window modal (all other windows unresponsive) @@ -403,6 +408,13 @@ public: void PushEventHandler( wxEvtHandler *handler ); wxEvtHandler *PopEventHandler( bool deleteHandler = FALSE ); + // find the given handler in the event handler chain and remove (but + // not delete) it from the event handler chain, return TRUE if it was + // found and FALSE otherwise (this also results in an assert failure so + // this function should only be called when the handler is supposed to + // be there) + bool RemoveEventHandler(wxEvtHandler *handler); + // validators // ---------- @@ -722,9 +734,13 @@ public: virtual void GetPositionConstraint(int *x, int *y) const ; // sizers - // TODO: what are they and how do they work?? void SetSizer( wxSizer *sizer ); wxSizer *GetSizer() const { return m_windowSizer; } + + // Track if this window is a member of a sizer + void SetContainingSizer(wxSizer* sizer) { m_containingSizer = sizer; } + wxSizer *GetContainingSizer() const { return m_containingSizer; } + #endif // wxUSE_CONSTRAINTS // backward compatibility @@ -754,6 +770,22 @@ public: // platform-specific APIs virtual WXWidget GetHandle() const = 0; +#if wxUSE_PALETTE + // Store the palette used by DCs in wxWindow so that the dcs can share + // a palette. And we can respond to palette messages. + wxPalette GetPalette() const { return m_palette; } + + // When palette is changed tell the DC to set the system palette to the + // new one. + void SetPalette(const wxPalette& pal); + + // return true if we have a specific palette + bool HasCustomPalette() const { return m_hasCustomPalette; } + + // return the first parent window with a custom palette or NULL + wxWindow *GetAncestorWithCustomPalette() const; +#endif // wxUSE_PALETTE + protected: // the window id - a number which uniquely identifies a window among // its siblings unless it is -1 @@ -812,10 +844,11 @@ protected: // constraints this window is involved in wxWindowList *m_constraintsInvolvedIn; - // top level and the parent sizers - // TODO what's this and how does it work?) + // this window's sizer wxSizer *m_windowSizer; - wxWindowBase *m_sizerParent; + + // The sizer this window is a member of, if any + wxSizer *m_containingSizer; // Layout() window automatically when its size changes? bool m_autoLayout:1; @@ -837,7 +870,13 @@ protected: wxString m_windowName; bool m_themeEnabled; +#if wxUSE_PALETTE + wxPalette m_palette; + bool m_hasCustomPalette; +#endif // wxUSE_PALETTE + protected: + // common part of all ctors: it is not virtual because it is called from // ctor void InitBase(); @@ -928,7 +967,9 @@ protected: // a toolbar that it manages itself). virtual void AdjustForParentClientOrigin(int& x, int& y, int sizeFlags); + private: + // contains the last id generated by NewControlId static int ms_lastControlId; @@ -963,6 +1004,14 @@ private: #define sm_classwxWindowGTK sm_classwxWindow #endif // wxUniv #include "wx/gtk/window.h" +#elif defined(__WXX11__) + #ifdef __WXUNIVERSAL__ + #define wxWindowNative wxWindowX11 + #else // !wxUniv + #define wxWindowX11 wxWindow + #define sm_classwxWindowX11 sm_classwxWindow + #endif // wxUniv + #include "wx/x11/window.h" #elif defined(__WXMGL__) #ifdef __WXUNIVERSAL__ #define wxWindowNative wxWindowMGL