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