]> git.saurik.com Git - wxWidgets.git/blob - samples/stc/edit.h
Compilation fix to propgrid sample after r74628.
[wxWidgets.git] / samples / stc / edit.h
1 //////////////////////////////////////////////////////////////////////////////
2 // File: edit.h
3 // Purpose: STC test module
4 // Maintainer: Wyo
5 // Created: 2003-09-01
6 // Copyright: (c) wxGuide
7 // Licence: wxWindows licence
8 //////////////////////////////////////////////////////////////////////////////
9
10 #ifndef _EDIT_H_
11 #define _EDIT_H_
12
13 //----------------------------------------------------------------------------
14 // informations
15 //----------------------------------------------------------------------------
16
17
18 //----------------------------------------------------------------------------
19 // headers
20 //----------------------------------------------------------------------------
21
22 //! wxWidgets headers
23
24 //! wxWidgets/contrib headers
25 #include "wx/stc/stc.h" // styled text control
26
27 //! application headers
28 #include "prefs.h" // preferences
29
30
31 //============================================================================
32 // declarations
33 //============================================================================
34
35 class EditPrint;
36 class EditProperties;
37
38
39 //----------------------------------------------------------------------------
40 //! Edit
41 class Edit: public wxStyledTextCtrl {
42 friend class EditProperties;
43 friend class EditPrint;
44
45 public:
46 //! constructor
47 Edit (wxWindow *parent, wxWindowID id = wxID_ANY,
48 const wxPoint &pos = wxDefaultPosition,
49 const wxSize &size = wxDefaultSize,
50 long style =
51 #ifndef __WXMAC__
52 wxSUNKEN_BORDER|
53 #endif
54 wxVSCROLL
55 );
56
57 //! destructor
58 ~Edit ();
59
60 // event handlers
61 // common
62 void OnSize( wxSizeEvent &event );
63 // edit
64 void OnEditRedo (wxCommandEvent &event);
65 void OnEditUndo (wxCommandEvent &event);
66 void OnEditClear (wxCommandEvent &event);
67 void OnEditCut (wxCommandEvent &event);
68 void OnEditCopy (wxCommandEvent &event);
69 void OnEditPaste (wxCommandEvent &event);
70 // find
71 void OnFind (wxCommandEvent &event);
72 void OnFindNext (wxCommandEvent &event);
73 void OnReplace (wxCommandEvent &event);
74 void OnReplaceNext (wxCommandEvent &event);
75 void OnBraceMatch (wxCommandEvent &event);
76 void OnGoto (wxCommandEvent &event);
77 void OnEditIndentInc (wxCommandEvent &event);
78 void OnEditIndentRed (wxCommandEvent &event);
79 void OnEditSelectAll (wxCommandEvent &event);
80 void OnEditSelectLine (wxCommandEvent &event);
81 //! view
82 void OnHilightLang (wxCommandEvent &event);
83 void OnDisplayEOL (wxCommandEvent &event);
84 void OnIndentGuide (wxCommandEvent &event);
85 void OnLineNumber (wxCommandEvent &event);
86 void OnLongLineOn (wxCommandEvent &event);
87 void OnWhiteSpace (wxCommandEvent &event);
88 void OnFoldToggle (wxCommandEvent &event);
89 void OnSetOverType (wxCommandEvent &event);
90 void OnSetReadOnly (wxCommandEvent &event);
91 void OnWrapmodeOn (wxCommandEvent &event);
92 void OnUseCharset (wxCommandEvent &event);
93 // annotations
94 void OnAnnotationAdd(wxCommandEvent& event);
95 void OnAnnotationRemove(wxCommandEvent& event);
96 void OnAnnotationClear(wxCommandEvent& event);
97 void OnAnnotationStyle(wxCommandEvent& event);
98 //! extra
99 void OnChangeCase (wxCommandEvent &event);
100 void OnConvertEOL (wxCommandEvent &event);
101 // stc
102 void OnMarginClick (wxStyledTextEvent &event);
103 void OnCharAdded (wxStyledTextEvent &event);
104 void OnKey (wxStyledTextEvent &event);
105
106 //! language/lexer
107 wxString DeterminePrefs (const wxString &filename);
108 bool InitializePrefs (const wxString &filename);
109 bool UserSettings (const wxString &filename);
110 LanguageInfo const* GetLanguageInfo () {return m_language;};
111
112 //! load/save file
113 bool LoadFile ();
114 bool LoadFile (const wxString &filename);
115 bool SaveFile ();
116 bool SaveFile (const wxString &filename);
117 bool Modified ();
118 wxString GetFilename () {return m_filename;};
119 void SetFilename (const wxString &filename) {m_filename = filename;};
120
121 private:
122 // file
123 wxString m_filename;
124
125 // lanugage properties
126 LanguageInfo const* m_language;
127
128 // margin variables
129 int m_LineNrID;
130 int m_LineNrMargin;
131 int m_FoldingID;
132 int m_FoldingMargin;
133 int m_DividerID;
134
135 DECLARE_EVENT_TABLE()
136 };
137
138 //----------------------------------------------------------------------------
139 //! EditProperties
140 class EditProperties: public wxDialog {
141
142 public:
143
144 //! constructor
145 EditProperties (Edit *edit, long style = 0);
146
147 private:
148
149 };
150
151 #if wxUSE_PRINTING_ARCHITECTURE
152
153 //----------------------------------------------------------------------------
154 //! EditPrint
155 class EditPrint: public wxPrintout {
156
157 public:
158
159 //! constructor
160 EditPrint (Edit *edit, const wxChar *title = wxT(""));
161
162 //! event handlers
163 bool OnPrintPage (int page);
164 bool OnBeginDocument (int startPage, int endPage);
165
166 //! print functions
167 bool HasPage (int page);
168 void GetPageInfo (int *minPage, int *maxPage, int *selPageFrom, int *selPageTo);
169
170 private:
171 Edit *m_edit;
172 int m_printed;
173 wxRect m_pageRect;
174 wxRect m_printRect;
175
176 bool PrintScaling (wxDC *dc);
177 };
178
179 #endif // wxUSE_PRINTING_ARCHITECTURE
180
181 #endif // _EDIT_H_