]> git.saurik.com Git - wxWidgets.git/blame - samples/stc/edit.h
fix vertical mouse wheel event rotation value, sign was reversed in r74805
[wxWidgets.git] / samples / stc / edit.h
CommitLineData
88a8b04e
RD
1//////////////////////////////////////////////////////////////////////////////
2// File: edit.h
3// Purpose: STC test module
4// Maintainer: Wyo
5// Created: 2003-09-01
88a8b04e
RD
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
be5a51fb 22//! wxWidgets headers
88a8b04e 23
be5a51fb 24//! wxWidgets/contrib headers
c40691a0 25#include "wx/stc/stc.h" // styled text control
88a8b04e
RD
26
27//! application headers
28#include "prefs.h" // preferences
29
30
31//============================================================================
32// declarations
33//============================================================================
34
35class EditPrint;
36class EditProperties;
37
38
39//----------------------------------------------------------------------------
40//! Edit
41class Edit: public wxStyledTextCtrl {
42 friend class EditProperties;
43 friend class EditPrint;
44
45public:
46 //! constructor
7e126a07 47 Edit (wxWindow *parent, wxWindowID id = wxID_ANY,
88a8b04e
RD
48 const wxPoint &pos = wxDefaultPosition,
49 const wxSize &size = wxDefaultSize,
ce00f59b 50 long style =
bfa30135
SC
51#ifndef __WXMAC__
52 wxSUNKEN_BORDER|
53#endif
54 wxVSCROLL
88a8b04e
RD
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);
2fb4e3cb
VZ
93 // annotations
94 void OnAnnotationAdd(wxCommandEvent& event);
95 void OnAnnotationRemove(wxCommandEvent& event);
96 void OnAnnotationClear(wxCommandEvent& event);
97 void OnAnnotationStyle(wxCommandEvent& event);
88a8b04e
RD
98 //! extra
99 void OnChangeCase (wxCommandEvent &event);
100 void OnConvertEOL (wxCommandEvent &event);
101 // stc
102 void OnMarginClick (wxStyledTextEvent &event);
103 void OnCharAdded (wxStyledTextEvent &event);
9e96e16f 104 void OnKey (wxStyledTextEvent &event);
88a8b04e
RD
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
121private:
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
140class EditProperties: public wxDialog {
141
142public:
143
144 //! constructor
145 EditProperties (Edit *edit, long style = 0);
146
147private:
148
149};
150
c54e5eb0
WS
151#if wxUSE_PRINTING_ARCHITECTURE
152
88a8b04e
RD
153//----------------------------------------------------------------------------
154//! EditPrint
155class EditPrint: public wxPrintout {
156
157public:
158
159 //! constructor
9a83f860 160 EditPrint (Edit *edit, const wxChar *title = wxT(""));
88a8b04e
RD
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
170private:
171 Edit *m_edit;
172 int m_printed;
173 wxRect m_pageRect;
174 wxRect m_printRect;
175
176 bool PrintScaling (wxDC *dc);
177};
178
c54e5eb0 179#endif // wxUSE_PRINTING_ARCHITECTURE
88a8b04e 180
c54e5eb0 181#endif // _EDIT_H_