/[pcsx2_0.9.7]/trunk/3rdparty/wxWidgets/include/wx/generic/srchctlg.h
ViewVC logotype

Annotation of /trunk/3rdparty/wxWidgets/include/wx/generic/srchctlg.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 10 - (hide annotations) (download)
Mon Sep 6 11:40:06 2010 UTC (9 years, 9 months ago) by william
File MIME type: text/plain
File size: 8916 byte(s)
exported r3113 from ./upstream/trunk
1 william 10 /////////////////////////////////////////////////////////////////////////////
2     // Name: wx/generic/srchctlg.h
3     // Purpose: generic wxSearchCtrl class
4     // Author: Vince Harron
5     // Created: 2006-02-19
6     // RCS-ID: $Id: srchctlg.h 53135 2008-04-12 02:31:04Z VZ $
7     // Copyright: Vince Harron
8     // Licence: wxWindows licence
9     /////////////////////////////////////////////////////////////////////////////
10    
11     #ifndef _WX_GENERIC_SEARCHCTRL_H_
12     #define _WX_GENERIC_SEARCHCTRL_H_
13    
14     #if wxUSE_SEARCHCTRL
15    
16     #include "wx/bitmap.h"
17    
18     class WXDLLIMPEXP_FWD_CORE wxSearchButton;
19     class WXDLLIMPEXP_FWD_CORE wxSearchTextCtrl;
20    
21     // ----------------------------------------------------------------------------
22     // wxSearchCtrl is a combination of wxTextCtrl and wxSearchButton
23     // ----------------------------------------------------------------------------
24    
25     class WXDLLEXPORT wxSearchCtrl : public wxSearchCtrlBase
26     {
27     public:
28     // creation
29     // --------
30    
31     wxSearchCtrl();
32     wxSearchCtrl(wxWindow *parent, wxWindowID id,
33     const wxString& value = wxEmptyString,
34     const wxPoint& pos = wxDefaultPosition,
35     const wxSize& size = wxDefaultSize,
36     long style = 0,
37     const wxValidator& validator = wxDefaultValidator,
38     const wxString& name = wxSearchCtrlNameStr);
39    
40     virtual ~wxSearchCtrl();
41    
42     bool Create(wxWindow *parent, wxWindowID id,
43     const wxString& value = wxEmptyString,
44     const wxPoint& pos = wxDefaultPosition,
45     const wxSize& size = wxDefaultSize,
46     long style = 0,
47     const wxValidator& validator = wxDefaultValidator,
48     const wxString& name = wxSearchCtrlNameStr);
49    
50     #if wxUSE_MENUS
51     // get/set search button menu
52     // --------------------------
53     virtual void SetMenu( wxMenu* menu );
54     virtual wxMenu* GetMenu();
55     #endif // wxUSE_MENUS
56    
57     // get/set search options
58     // ----------------------
59     virtual void ShowSearchButton( bool show );
60     virtual bool IsSearchButtonVisible() const;
61    
62     virtual void ShowCancelButton( bool show );
63     virtual bool IsCancelButtonVisible() const;
64    
65     #if wxABI_VERSION >= 20802
66     // TODO: In 2.9 these should probably be virtual, and declared in the base class...
67     void SetDescriptiveText(const wxString& text);
68     wxString GetDescriptiveText() const;
69     #endif
70    
71     // accessors
72     // ---------
73    
74     virtual wxString GetValue() const;
75     virtual void SetValue(const wxString& value);
76    
77     virtual wxString GetRange(long from, long to) const;
78    
79     virtual int GetLineLength(long lineNo) const;
80     virtual wxString GetLineText(long lineNo) const;
81     virtual int GetNumberOfLines() const;
82    
83     virtual bool IsModified() const;
84     virtual bool IsEditable() const;
85    
86     // more readable flag testing methods
87     virtual bool IsSingleLine() const;
88     virtual bool IsMultiLine() const;
89    
90     // If the return values from and to are the same, there is no selection.
91     virtual void GetSelection(long* from, long* to) const;
92    
93     virtual wxString GetStringSelection() const;
94    
95     // operations
96     // ----------
97    
98     // editing
99     virtual void Clear();
100     virtual void Replace(long from, long to, const wxString& value);
101     virtual void Remove(long from, long to);
102    
103     // load/save the controls contents from/to the file
104     virtual bool LoadFile(const wxString& file);
105     virtual bool SaveFile(const wxString& file = wxEmptyString);
106    
107     // sets/clears the dirty flag
108     virtual void MarkDirty();
109     virtual void DiscardEdits();
110    
111     // set the max number of characters which may be entered in a single line
112     // text control
113     virtual void SetMaxLength(unsigned long WXUNUSED(len));
114    
115     // writing text inserts it at the current position, appending always
116     // inserts it at the end
117     virtual void WriteText(const wxString& text);
118     virtual void AppendText(const wxString& text);
119    
120     // insert the character which would have resulted from this key event,
121     // return true if anything has been inserted
122     virtual bool EmulateKeyPress(const wxKeyEvent& event);
123    
124     // text control under some platforms supports the text styles: these
125     // methods allow to apply the given text style to the given selection or to
126     // set/get the style which will be used for all appended text
127     virtual bool SetStyle(long start, long end, const wxTextAttr& style);
128     virtual bool GetStyle(long position, wxTextAttr& style);
129     virtual bool SetDefaultStyle(const wxTextAttr& style);
130     virtual const wxTextAttr& GetDefaultStyle() const;
131    
132     // translate between the position (which is just an index in the text ctrl
133     // considering all its contents as a single strings) and (x, y) coordinates
134     // which represent column and line.
135     virtual long XYToPosition(long x, long y) const;
136     virtual bool PositionToXY(long pos, long *x, long *y) const;
137    
138     virtual void ShowPosition(long pos);
139    
140     // find the character at position given in pixels
141     //
142     // NB: pt is in device coords (not adjusted for the client area origin nor
143     // scrolling)
144     virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const;
145     virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt,
146     wxTextCoord *col,
147     wxTextCoord *row) const;
148    
149     // Clipboard operations
150     virtual void Copy();
151     virtual void Cut();
152     virtual void Paste();
153    
154     virtual bool CanCopy() const;
155     virtual bool CanCut() const;
156     virtual bool CanPaste() const;
157    
158     // Undo/redo
159     virtual void Undo();
160     virtual void Redo();
161    
162     virtual bool CanUndo() const;
163     virtual bool CanRedo() const;
164    
165     // Insertion point
166     virtual void SetInsertionPoint(long pos);
167     virtual void SetInsertionPointEnd();
168     virtual long GetInsertionPoint() const;
169     virtual wxTextPos GetLastPosition() const;
170    
171     virtual void SetSelection(long from, long to);
172     virtual void SelectAll();
173     virtual void SetEditable(bool editable);
174    
175     #if 0
176    
177     // override streambuf method
178     #if wxHAS_TEXT_WINDOW_STREAM
179     int overflow(int i);
180     #endif // wxHAS_TEXT_WINDOW_STREAM
181    
182     // stream-like insertion operators: these are always available, whether we
183     // were, or not, compiled with streambuf support
184     wxTextCtrl& operator<<(const wxString& s);
185     wxTextCtrl& operator<<(int i);
186     wxTextCtrl& operator<<(long i);
187     wxTextCtrl& operator<<(float f);
188     wxTextCtrl& operator<<(double d);
189     wxTextCtrl& operator<<(const wxChar c);
190     #endif
191    
192     // do the window-specific processing after processing the update event
193     virtual void DoUpdateWindowUI(wxUpdateUIEvent& event);
194    
195     virtual bool ShouldInheritColours() const;
196    
197     // wxWindow overrides
198     virtual bool SetFont(const wxFont& font);
199    
200     // search control generic only
201     void SetSearchBitmap( const wxBitmap& bitmap );
202     void SetCancelBitmap( const wxBitmap& bitmap );
203     #if wxUSE_MENUS
204     void SetSearchMenuBitmap( const wxBitmap& bitmap );
205     #endif // wxUSE_MENUS
206    
207     protected:
208     virtual void DoSetValue(const wxString& value, int flags = 0);
209    
210     // override the base class virtuals involved into geometry calculations
211     virtual wxSize DoGetBestSize() const;
212     virtual void DoMoveWindow(int x, int y, int width, int height);
213     virtual void LayoutControls(int x, int y, int width, int height);
214    
215     virtual void RecalcBitmaps();
216    
217     void Init();
218    
219     virtual wxBitmap RenderSearchBitmap( int x, int y, bool renderDrop );
220     virtual wxBitmap RenderCancelBitmap( int x, int y );
221    
222     virtual void OnSearchButton( wxCommandEvent& event );
223    
224     void OnSetFocus( wxFocusEvent& event );
225     void OnSize( wxSizeEvent& event );
226    
227     bool HasMenu() const
228     {
229     #if wxUSE_MENUS
230     return m_menu != NULL;
231     #else // !wxUSE_MENUS
232     return false;
233     #endif // wxUSE_MENUS/!wxUSE_MENUS
234     }
235    
236     private:
237     friend class wxSearchButton;
238    
239     #if wxUSE_MENUS
240     void PopupSearchMenu();
241     #endif // wxUSE_MENUS
242    
243     // the subcontrols
244     wxSearchTextCtrl *m_text;
245     wxSearchButton *m_searchButton;
246     wxSearchButton *m_cancelButton;
247     #if wxUSE_MENUS
248     wxMenu *m_menu;
249     #endif // wxUSE_MENUS
250    
251     bool m_searchButtonVisible;
252     bool m_cancelButtonVisible;
253    
254     bool m_searchBitmapUser;
255     bool m_cancelBitmapUser;
256     #if wxUSE_MENUS
257     bool m_searchMenuBitmapUser;
258     #endif // wxUSE_MENUS
259    
260     wxBitmap m_searchBitmap;
261     wxBitmap m_cancelBitmap;
262     #if wxUSE_MENUS
263     wxBitmap m_searchMenuBitmap;
264     #endif // wxUSE_MENUS
265    
266     private:
267     DECLARE_DYNAMIC_CLASS(wxSearchCtrl)
268    
269     DECLARE_EVENT_TABLE()
270     };
271    
272     #endif // wxUSE_SEARCHCTRL
273    
274     #endif // _WX_GENERIC_SEARCHCTRL_H_
275    

  ViewVC Help
Powered by ViewVC 1.1.22