File: textctrl.h

package info (click to toggle)
wxwidgets3.0 3.0.5.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 120,464 kB
  • sloc: cpp: 896,633; makefile: 52,303; ansic: 21,971; sh: 5,713; python: 2,940; xml: 1,534; perl: 264; javascript: 33
file content (197 lines) | stat: -rw-r--r-- 6,597 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
/////////////////////////////////////////////////////////////////////////////
// Name:        wx/os2/textctrl.h
// Purpose:     wxTextCtrl class
// Author:      David Webster
// Modified by:
// Created:     10/17/99
// Copyright:   (c) David Webster
// Licence:     wxWindows licence
/////////////////////////////////////////////////////////////////////////////

#ifndef _WX_TEXTCTRL_H_
#define _WX_TEXTCTRL_H_

typedef int (wxCALLBACK *wxTreeCtrlCompare)(long lItem1, long lItem2, long lSortData);

class WXDLLIMPEXP_CORE wxTextCtrl : public wxTextCtrlBase
{
public:
    wxTextCtrl();
    wxTextCtrl( wxWindow*          pParent
               ,wxWindowID         vId
               ,const wxString&    rsValue = wxEmptyString
               ,const wxPoint&     rPos = wxDefaultPosition
               ,const wxSize&      rSize = wxDefaultSize
               ,long               lStyle = 0
               ,const wxValidator& rValidator = wxDefaultValidator
               ,const wxString&    rsName = wxTextCtrlNameStr
              )
    {
        Create(pParent, vId, rsValue, rPos, rSize, lStyle, rValidator, rsName);
    }
    virtual ~wxTextCtrl();

    bool Create( wxWindow*          pParent
                ,wxWindowID         vId
                ,const wxString&    rsValue = wxEmptyString
                ,const wxPoint&     rPos = wxDefaultPosition
                ,const wxSize&      rSize = wxDefaultSize
                ,long               lStyle = 0
                ,const wxValidator& rValidator = wxDefaultValidator
                ,const wxString&    rsName = wxTextCtrlNameStr
               );

    //
    // Implement base class pure virtuals
    // ----------------------------------
    //
    virtual      wxString GetValue(void) const;

    virtual int      GetLineLength(long nLineNo) const;
    virtual wxString GetLineText(long nLineNo) const;
    virtual int      GetNumberOfLines(void) const;

    virtual bool IsModified(void) const;
    virtual bool IsEditable(void) const;

    virtual void GetSelection( long* pFrom
                              ,long* pTo
                             ) const;
    //
    // Operations
    // ----------
    //
    virtual void Clear(void);
    virtual void Replace( long            lFrom
                         ,long            lTo
                         ,const wxString& rsValue
                        );
    virtual void Remove( long lFrom
                        ,long lTo
                       );

    virtual bool DoLoadFile(const wxString& rsFile, int fileType);

    virtual void MarkDirty();
    virtual void DiscardEdits(void);

    virtual void WriteText(const wxString& rsText);
    virtual void AppendText(const wxString& rsText);
    virtual bool EmulateKeyPress(const wxKeyEvent& rEvent);

    virtual bool SetStyle( long              lStart
                          ,long              lEnd
                          ,const wxTextAttr& rStyle
                         );
    virtual long XYToPosition( long lX
                              ,long lY
                             ) const;
    virtual bool PositionToXY( long  lPos
                              ,long* plX
                              ,long* plY
                             ) const;

    virtual void ShowPosition(long lPos);

    virtual void Copy(void);
    virtual void Cut(void);
    virtual void Paste(void);

    virtual bool CanCopy(void) const;
    virtual bool CanCut(void) const;
    virtual bool CanPaste(void) const;

    virtual void Undo(void);
    virtual void Redo(void);

    virtual bool CanUndo(void) const;
    virtual bool CanRedo(void) const;

    virtual void SetInsertionPoint(long lPos);
    virtual void SetInsertionPointEnd(void);
    virtual long GetInsertionPoint(void) const;
    virtual wxTextPos GetLastPosition(void) const;

    virtual void SetSelection( long lFrom
                              ,long lTo
                             );
    virtual void SetEditable(bool bEditable);
    virtual void SetWindowStyleFlag(long lStyle);

    //
    // Implementation from now on
    // --------------------------
    //
    virtual void Command(wxCommandEvent& rEvent);
    virtual bool OS2Command( WXUINT uParam
                            ,WXWORD wId
                           );

    virtual WXHBRUSH OnCtlColor( WXHDC    hDC
                                ,WXHWND   pWnd
                                ,WXUINT   nCtlColor
                                ,WXUINT   message
                                ,WXWPARAM wParam
                                ,WXLPARAM lParam
                               );

    virtual bool SetBackgroundColour(const wxColour& colour);
    virtual bool SetForegroundColour(const wxColour& colour);

    virtual void AdoptAttributesFromHWND(void);
    virtual void SetupColours(void);

    virtual bool AcceptsFocus(void) const;

    // callbacks
    void OnDropFiles(wxDropFilesEvent& rEvent);
    void OnChar(wxKeyEvent& rEvent); // Process 'enter' if required

    void OnCut(wxCommandEvent& rEvent);
    void OnCopy(wxCommandEvent& rEvent);
    void OnPaste(wxCommandEvent& rEvent);
    void OnUndo(wxCommandEvent& rEvent);
    void OnRedo(wxCommandEvent& rEvent);
    void OnDelete(wxCommandEvent& rEvent);
    void OnSelectAll(wxCommandEvent& rEvent);

    void OnUpdateCut(wxUpdateUIEvent& rEvent);
    void OnUpdateCopy(wxUpdateUIEvent& rEvent);
    void OnUpdatePaste(wxUpdateUIEvent& rEvent);
    void OnUpdateUndo(wxUpdateUIEvent& rEvent);
    void OnUpdateRedo(wxUpdateUIEvent& rEvent);
    void OnUpdateDelete(wxUpdateUIEvent& rEvent);
    void OnUpdateSelectAll(wxUpdateUIEvent& rEvent);

    inline bool IsMLE(void) {return m_bIsMLE;}
    inline void SetMLE(bool bIsMLE) {m_bIsMLE = bIsMLE;}

protected:
    //
    // call this to increase the size limit (will do nothing if the current
    // limit is big enough)
    //
    void           AdjustSpaceLimit(void);
    virtual wxSize DoGetBestSize(void) const;
    virtual bool   OS2ShouldPreProcessMessage(WXMSG* pMsg);

    virtual WXDWORD OS2GetStyle( long     lStyle
                                ,WXDWORD* dwExstyle
                               ) const;

    virtual void DoSetValue(const wxString &value, int flags = 0);

    bool m_bSkipUpdate;

private:
    // implement wxTextEntry pure virtual: it implements all the operations for
    // the simple EDIT controls
    virtual WXHWND GetEditHWND() const { return m_hWnd; }

    bool                            m_bIsMLE;
    DECLARE_EVENT_TABLE()
    DECLARE_DYNAMIC_CLASS(wxTextCtrl)
}; // end of CLASS wxTextCtrl

#endif
    // _WX_TEXTCTRL_H_