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