]> git.saurik.com Git - wxWidgets.git/blob - user/wxLayout/wxlwindow.h
Removed wxProp source files
[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 enum
22 {
23 WXLOWIN_MENU_LARGER = 12000,
24 WXLOWIN_MENU_SMALLER,
25 WXLOWIN_MENU_UNDERLINE,
26 WXLOWIN_MENU_BOLD,
27 WXLOWIN_MENU_ITALICS,
28 WXLOWIN_MENU_ROMAN,
29 WXLOWIN_MENU_TYPEWRITER,
30 WXLOWIN_MENU_SANSSERIF,
31 WXLOWIN_MENU_RCLICK,
32 WXLOWIN_MENU_LCLICK,
33 WXLOWIN_MENU_DBLCLICK
34
35 };
36
37 class wxLayoutWindow : public wxScrolledWindow
38 {
39 public:
40 /** Constructor.
41 @param parent parent window to display this panel in
42 */
43 wxLayoutWindow(wxWindow *parent);
44
45 /* Returns a reference to the wxLayoutList object.
46 @return the list
47 */
48 wxLayoutList & GetLayoutList(void) { return m_llist; }
49
50 // clears the window and sets default parameters:
51 void Clear(int family = wxROMAN, int size=12, int style=wxNORMAL, int weight=wxNORMAL,
52 int underline=0, char const *fg="black", char const
53 *bg="white")
54 {
55 GetLayoutList().Clear(family,size,style,weight,underline,fg,bg);
56 SetBackgroundColour( *GetLayoutList().GetDefaults()->GetBGColour());
57
58 m_bDirty = FALSE;
59 }
60
61 // callbacks
62 // NB: these functions are used as event handlers and must not be virtual
63 void OnPaint(wxPaintEvent &event);
64
65 void OnLeftMouseClick(wxMouseEvent& event)
66 { OnMouse(WXLOWIN_MENU_LCLICK, event); }
67 void OnRightMouseClick(wxMouseEvent& event)
68 { OnMouse(WXLOWIN_MENU_RCLICK, event); }
69 void OnMouseDblClick(wxMouseEvent& event)
70 { OnMouse(WXLOWIN_MENU_DBLCLICK, event); }
71
72 void OnChar(wxKeyEvent& event);
73 void OnMenu(wxCommandEvent& event);
74
75 void EnablePopup(bool enable = true) { m_DoPopupMenu = enable; }
76 /// gets called by either Update() or OnPaint()
77 void DoPaint(wxDC &dc);
78
79 #ifdef __WXMSW__
80 virtual long MSWGetDlgCode();
81 #endif //MSW
82
83 void UpdateScrollbars(void);
84 void Print(void);
85 wxMenu * wxLayoutWindow::MakeFormatMenu(void);
86
87 /// if the flag is true, we send events when user clicks on embedded objects
88 inline void SetMouseTracking(bool doIt = true) { m_doSendEvents = doIt; }
89
90 virtual ~wxLayoutWindow() { if(m_PopupMenu) delete m_PopupMenu; }
91
92 // dirty flag access
93 bool IsDirty() const { return m_llist.IsDirty(); }
94 void ResetDirty() { m_llist.ResetDirty(); }
95
96 protected:
97 /// generic function for mouse events processing
98 void OnMouse(int eventId, wxMouseEvent& event);
99
100 /// repaint if needed
101 void Update(void);
102
103 /// for sending events
104 wxWindow *m_Parent;
105 bool m_doSendEvents;
106
107 /// the layout list to be displayed
108 wxLayoutList m_llist;
109
110 /// have we already set the scrollbars?
111 bool m_ScrollbarsSet;
112 /// Where does the current view start?
113 int m_ViewStartX; int m_ViewStartY;
114
115 /// do we have unsaved data?
116 bool m_bDirty;
117
118 /// do we handle clicks of the right mouse button?
119 bool m_DoPopupMenu;
120 /// the menu
121 wxMenu * m_PopupMenu;
122 private:
123 DECLARE_EVENT_TABLE()
124 };
125
126 #endif