X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/47908e25f992135fbc8c9573870784c62654e9e9..3ebf240158593ca3f0db5662b6ae03354cdc0e38:/user/wxLayout/wxlwindow.h diff --git a/user/wxLayout/wxlwindow.h b/user/wxLayout/wxlwindow.h index 61304396e3..0f5c60611f 100644 --- a/user/wxLayout/wxlwindow.h +++ b/user/wxLayout/wxlwindow.h @@ -12,21 +12,23 @@ # pragma interface "wxlwindow.h" #endif -#include +#ifndef USE_PCH +# include +#endif #include "wxllist.h" -#define BROKEN_COMPILER - -#ifdef BROKEN_COMPILER -# define virtual -#endif - class wxLayoutWindow : public wxScrolledWindow { public: + /** Constructor. + @param parent parent window to display this panel in + */ wxLayoutWindow(wxWindow *parent); + /* Returns a reference to the wxLayoutList object. + @return the list + */ wxLayoutList & GetLayoutList(void) { return m_llist; } // clears the window and sets default parameters: @@ -36,37 +38,67 @@ public: { GetLayoutList().Clear(family,size,style,weight,underline,fg,bg); SetBackgroundColour( *GetLayoutList().GetDefaults()->GetBGColour()); + + m_bDirty = FALSE; } - //virtual void OnDraw(wxDC &dc); - void OnPaint(wxPaintEvent &WXUNUSED(event)); - virtual void OnMouse(wxMouseEvent& event); - virtual void OnChar(wxKeyEvent& event); + // callbacks + // NB: these functions are used as event handlers and must not be virtual + void OnPaint(wxPaintEvent &event); + + void OnLeftMouseClick(wxMouseEvent& event) + { OnMouse(WXMENU_LAYOUT_LCLICK, event); } + void OnRightMouseClick(wxMouseEvent& event) + { OnMouse(WXMENU_LAYOUT_RCLICK, event); } + void OnMouseDblClick(wxMouseEvent& event) + { OnMouse(WXMENU_LAYOUT_DBLCLICK, event); } + + void OnChar(wxKeyEvent& event); + + /// gets called by either Update() or OnPaint() + void DoPaint(wxDC &dc); + +#ifdef __WXMSW__ + virtual long MSWGetDlgCode(); +#endif //MSW + void UpdateScrollbars(void); void Print(void); - void Erase(void) - { m_llist.Clear(); Clear(); } - void SetEventId(int id) { m_EventId = id; } - wxPoint const &GetClickPosition(void) const { return - m_ClickPosition; } - virtual ~wxLayoutWindow() {} ; -private: + + /// if the flag is true, we send events when user clicks on embedded objects + inline void SetMouseTracking(bool doIt = true) { m_doSendEvents = doIt; } + + virtual ~wxLayoutWindow() { } + + // dirty flag access + bool IsDirty() const { return m_llist.IsDirty(); } + void ResetDirty() { m_llist.ResetDirty(); } + + +protected: + /// generic function for mouse events processing + void OnMouse(int eventId, wxMouseEvent& event); + + /// repaint if needed + void Update(void); + /// for sending events wxWindow *m_Parent; - int m_EventId; + bool m_doSendEvents; + /// the layout list to be displayed wxLayoutList m_llist; + /// have we already set the scrollbars? bool m_ScrollbarsSet; - /// if we want to find an object: - wxPoint m_FindPos; - wxLayoutObjectBase *m_FoundObject; - wxPoint m_ClickPosition; + /// Where does the current view start? + int m_ViewStartX; int m_ViewStartY; + + /// do we have unsaved data? + bool m_bDirty; + +private: DECLARE_EVENT_TABLE() }; -#ifdef BROKEN_COMPILER -#undef virtual -#endif - #endif