]> git.saurik.com Git - wxWidgets.git/blob - user/wxLayout/wxlwindow.h
more fixes, printing works quite fine now
[wxWidgets.git] / user / wxLayout / wxlwindow.h
1 /*-*- c++ -*-********************************************************
2 * wxLwindow.h : a scrolled Window for displaying/entering rich text*
3 * *
4 * (C) 1998 by Karsten Ballüder (Ballueder@usa.net) *
5 * *
6 * $Id$
7 *******************************************************************/
8 #ifndef WXLWINDOW_H
9 #define WXLWINDOW_H
10
11 #ifdef __GNUG__
12 # pragma interface "wxlwindow.h"
13 #endif
14
15 #ifndef USE_PCH
16 # include <wx/wx.h>
17 #endif
18
19 #include "wxllist.h"
20
21 class wxLayoutWindow : public wxScrolledWindow
22 {
23 public:
24 /** Constructor.
25 @param parent parent window to display this panel in
26 */
27 wxLayoutWindow(wxWindow *parent);
28
29 /* Returns a reference to the wxLayoutList object.
30 @return the list
31 */
32 wxLayoutList & GetLayoutList(void) { return m_llist; }
33
34 // clears the window and sets default parameters:
35 void Clear(int family = wxROMAN, int size=12, int style=wxNORMAL, int weight=wxNORMAL,
36 int underline=0, char const *fg="black", char const
37 *bg="white")
38 {
39 GetLayoutList().Clear(family,size,style,weight,underline,fg,bg);
40 SetBackgroundColour( *GetLayoutList().GetDefaults()->GetBGColour());
41
42 m_bDirty = FALSE;
43 }
44
45 // callbacks
46 // NB: these functions are used as event handlers and must not be virtual
47 void OnPaint(wxPaintEvent &event);
48
49 void OnLeftMouseClick(wxMouseEvent& event)
50 { OnMouse(WXMENU_LAYOUT_LCLICK, event); }
51 void OnRightMouseClick(wxMouseEvent& event)
52 { OnMouse(WXMENU_LAYOUT_RCLICK, event); }
53 void OnMouseDblClick(wxMouseEvent& event)
54 { OnMouse(WXMENU_LAYOUT_DBLCLICK, event); }
55
56 void OnChar(wxKeyEvent& event);
57
58 /// gets called by either Update() or OnPaint()
59 void DoPaint(wxDC &dc);
60
61 #ifdef __WXMSW__
62 virtual long MSWGetDlgCode();
63 #endif //MSW
64
65 void UpdateScrollbars(void);
66 void Print(void);
67
68 /// if the flag is true, we send events when user clicks on embedded objects
69 inline void SetMouseTracking(bool doIt = true) { m_doSendEvents = doIt; }
70
71 virtual ~wxLayoutWindow() { }
72
73 // dirty flag access
74 bool IsDirty() const { return m_llist.IsDirty(); }
75 void ResetDirty() { m_llist.ResetDirty(); }
76
77
78 protected:
79 /// generic function for mouse events processing
80 void OnMouse(int eventId, wxMouseEvent& event);
81
82 /// repaint if needed
83 void Update(void);
84
85 /// for sending events
86 wxWindow *m_Parent;
87 bool m_doSendEvents;
88
89 /// the layout list to be displayed
90 wxLayoutList m_llist;
91
92 /// have we already set the scrollbars?
93 bool m_ScrollbarsSet;
94 /// Where does the current view start?
95 int m_ViewStartX; int m_ViewStartY;
96
97 /// do we have unsaved data?
98 bool m_bDirty;
99
100 private:
101 DECLARE_EVENT_TABLE()
102 };
103
104 #endif