1//---------------------------------------------------------------------------
2// This file is generated by wxPython's SIP generator.  Do not edit by hand.
3//
4// Copyright: (c) 2018 by Total Control Software
5// License:   wxWindows License
6//
7// This file will be included by _core.sip
8//
9//---------------------------------------------------------------------------
10
11%ModuleHeaderCode
12#include <wx/srchctrl.h>
13%End
14
15
16//---------------------------------------------------------------------------
17
18wxEventType wxEVT_SEARCHCTRL_CANCEL_BTN   /PyName=wxEVT_SEARCHCTRL_CANCEL_BTN/;
19
20wxEventType wxEVT_SEARCHCTRL_SEARCH_BTN   /PyName=wxEVT_SEARCHCTRL_SEARCH_BTN/;
21
22const char* wxSearchCtrlNameStr;
23
24class wxSearchCtrl : wxControl
25{
26    %Docstring
27        SearchCtrl()
28        SearchCtrl(parent, id=ID_ANY, value=EmptyString, pos=DefaultPosition, size=DefaultSize, style=0, validator=DefaultValidator, name=SearchCtrlNameStr)
29
30        A search control is a composite control with a search button, a text
31        control, and a cancel button.
32    %End
33    %TypeHeaderCode
34        #include <wx/srchctrl.h>
35    %End
36
37public:
38    wxSearchCtrl();
39    %PreMethodCode
40        if (!wxPyCheckForApp()) return NULL;
41    %End
42
43    wxSearchCtrl(
44        wxWindow * parent   /TransferThis/,
45        wxWindowID id = wxID_ANY,
46        const wxString & value = wxEmptyString,
47        const wxPoint & pos = wxDefaultPosition,
48        const wxSize & size = wxDefaultSize,
49        long style = 0,
50        const wxValidator & validator = wxDefaultValidator,
51        const wxString & name = wxSearchCtrlNameStr
52    );
53    %PreMethodCode
54        if (!wxPyCheckForApp()) return NULL;
55    %End
56
57    ~wxSearchCtrl();
58
59    bool Create(
60        wxWindow * parent   /TransferThis/,
61        wxWindowID id = wxID_ANY,
62        const wxString & value = wxEmptyString,
63        const wxPoint & pos = wxDefaultPosition,
64        const wxSize & size = wxDefaultSize,
65        long style = 0,
66        const wxValidator & validator = wxDefaultValidator,
67        const wxString & name = wxSearchCtrlNameStr
68    );
69    %Docstring
70        Create(parent, id=ID_ANY, value=EmptyString, pos=DefaultPosition, size=DefaultSize, style=0, validator=DefaultValidator, name=SearchCtrlNameStr) -> bool
71    %End
72
73    wxMenu * GetMenu();
74    %Docstring
75        GetMenu() -> Menu
76
77        Returns a pointer to the search control's menu object or NULL if there
78        is no menu attached.
79    %End
80
81    bool IsSearchButtonVisible() const;
82    %Docstring
83        IsSearchButtonVisible() -> bool
84
85        Returns the search button visibility value.
86    %End
87
88    bool IsCancelButtonVisible() const;
89    %Docstring
90        IsCancelButtonVisible() -> bool
91
92        Returns the cancel button's visibility state.
93    %End
94
95    void SetMenu(
96        wxMenu * menu   /Transfer/
97    );
98    %Docstring
99        SetMenu(menu)
100
101        Sets the search control's menu object.
102    %End
103
104    void ShowCancelButton(
105        bool show
106    );
107    %Docstring
108        ShowCancelButton(show)
109
110        Shows or hides the cancel button.
111    %End
112
113    void ShowSearchButton(
114        bool show
115    );
116    %Docstring
117        ShowSearchButton(show)
118
119        Sets the search button visibility value on the search control.
120    %End
121
122    void SetDescriptiveText(
123        const wxString & text
124    );
125    %Docstring
126        SetDescriptiveText(text)
127
128        Set the text to be displayed in the search control when the user has
129        not yet typed anything in it.
130    %End
131
132    wxString GetDescriptiveText() const;
133    %Docstring
134        GetDescriptiveText() -> String
135
136        Return the text displayed when there is not yet any user input.
137    %End
138
139    void SetSearchBitmap(const wxBitmap* bmp);
140    %Docstring
141        SetSearchBitmap(bmp)
142    %End
143    %MethodCode
144        PyErr_Clear();
145        Py_BEGIN_ALLOW_THREADS
146        _wxSearchCtrl_SetSearchBitmap(sipCpp, bmp);
147        Py_END_ALLOW_THREADS
148        if (PyErr_Occurred()) sipIsErr = 1;
149    %End
150    %TypeCode
151    void _wxSearchCtrl_SetSearchBitmap(wxSearchCtrl* self, const wxBitmap* bmp)
152    {
153        #ifdef __WXMAC__
154        #else
155            self->SetSearchBitmap(*bmp);
156        #endif
157    }
158    %End
159
160    void SetSearchMenuBitmap(const wxBitmap* bmp);
161    %Docstring
162        SetSearchMenuBitmap(bmp)
163    %End
164    %MethodCode
165        PyErr_Clear();
166        Py_BEGIN_ALLOW_THREADS
167        _wxSearchCtrl_SetSearchMenuBitmap(sipCpp, bmp);
168        Py_END_ALLOW_THREADS
169        if (PyErr_Occurred()) sipIsErr = 1;
170    %End
171    %TypeCode
172    void _wxSearchCtrl_SetSearchMenuBitmap(wxSearchCtrl* self, const wxBitmap* bmp)
173    {
174        #ifdef __WXMAC__
175        #else
176            self->SetSearchMenuBitmap(*bmp);
177        #endif
178    }
179    %End
180
181    void SetCancelBitmap(const wxBitmap* bmp);
182    %Docstring
183        SetCancelBitmap(bmp)
184    %End
185    %MethodCode
186        PyErr_Clear();
187        Py_BEGIN_ALLOW_THREADS
188        _wxSearchCtrl_SetCancelBitmap(sipCpp, bmp);
189        Py_END_ALLOW_THREADS
190        if (PyErr_Occurred()) sipIsErr = 1;
191    %End
192    %TypeCode
193    void _wxSearchCtrl_SetCancelBitmap(wxSearchCtrl* self, const wxBitmap* bmp)
194    {
195        #ifdef __WXMAC__
196        #else
197            self->SetCancelBitmap(*bmp);
198        #endif
199    }
200    %End
201
202    bool SetMargins(
203        const wxPoint & pt
204    );
205    %Docstring
206        SetMargins(pt) -> bool
207        SetMargins(left, top=-1) -> bool
208
209        Attempts to set the control margins.
210    %End
211
212    bool SetMargins(
213        wxCoord left,
214        wxCoord top = -1
215    );
216
217    void AppendText(
218        const wxString & text
219    );
220    %Docstring
221        AppendText(text)
222
223        Appends the text to the end of the text control.
224    %End
225
226    bool AutoComplete(
227        const wxArrayString & choices
228    );
229    %Docstring
230        AutoComplete(choices) -> bool
231        AutoComplete(completer) -> bool
232
233        Call this function to enable auto-completion of the text typed in a
234        single-line text control using the given choices.
235    %End
236
237    bool AutoComplete(
238        wxTextCompleter * completer   /Transfer/
239    );
240
241    bool AutoCompleteFileNames();
242    %Docstring
243        AutoCompleteFileNames() -> bool
244
245        Call this function to enable auto-completion of the text typed in a
246        single-line text control using all valid file system paths.
247    %End
248
249    bool AutoCompleteDirectories();
250    %Docstring
251        AutoCompleteDirectories() -> bool
252
253        Call this function to enable auto-completion of the text using the
254        file system directories.
255    %End
256
257    bool CanCopy() const;
258    %Docstring
259        CanCopy() -> bool
260
261        Returns true if the selection can be copied to the clipboard.
262    %End
263
264    bool CanCut() const;
265    %Docstring
266        CanCut() -> bool
267
268        Returns true if the selection can be cut to the clipboard.
269    %End
270
271    bool CanPaste() const;
272    %Docstring
273        CanPaste() -> bool
274
275        Returns true if the contents of the clipboard can be pasted into the
276        text control.
277    %End
278
279    bool CanRedo() const;
280    %Docstring
281        CanRedo() -> bool
282
283        Returns true if there is a redo facility available and the last
284        operation can be redone.
285    %End
286
287    bool CanUndo() const;
288    %Docstring
289        CanUndo() -> bool
290
291        Returns true if there is an undo facility available and the last
292        operation can be undone.
293    %End
294
295    void ChangeValue(
296        const wxString & value
297    );
298    %Docstring
299        ChangeValue(value)
300
301        Sets the new text control value.
302    %End
303
304    void Clear();
305    %Docstring
306        Clear()
307
308        Clears the text in the control.
309    %End
310
311    void Copy();
312    %Docstring
313        Copy()
314
315        Copies the selected text to the clipboard.
316    %End
317
318    void Cut();
319    %Docstring
320        Cut()
321
322        Copies the selected text to the clipboard and removes it from the
323        control.
324    %End
325
326    long GetInsertionPoint() const;
327    %Docstring
328        GetInsertionPoint() -> long
329
330        Returns the insertion point, or cursor, position.
331    %End
332
333    wxTextPos GetLastPosition() const;
334    %Docstring
335        GetLastPosition() -> TextPos
336
337        Returns the zero based index of the last position in the text control,
338        which is equal to the number of characters in the control.
339    %End
340
341    wxString GetRange(
342        long from_,
343        long to_
344    ) const;
345    %Docstring
346        GetRange(from_, to_) -> String
347
348        Returns the string containing the text starting in the positions from
349        and up to to in the control.
350    %End
351
352    void GetSelection(
353        long * from   /Out/,
354        long * to   /Out/
355    ) const;
356    %Docstring
357        GetSelection() -> (from, to)
358
359        Gets the current selection span.
360    %End
361
362    wxString GetStringSelection() const;
363    %Docstring
364        GetStringSelection() -> String
365
366        Gets the text currently selected in the control.
367    %End
368
369    wxString GetValue() const;
370    %Docstring
371        GetValue() -> String
372
373        Gets the contents of the control.
374    %End
375
376    bool IsEditable() const;
377    %Docstring
378        IsEditable() -> bool
379
380        Returns true if the controls contents may be edited by user (note that
381        it always can be changed by the program).
382    %End
383
384    bool IsEmpty() const;
385    %Docstring
386        IsEmpty() -> bool
387
388        Returns true if the control is currently empty.
389    %End
390
391    void Paste();
392    %Docstring
393        Paste()
394
395        Pastes text from the clipboard to the text item.
396    %End
397
398    void Redo();
399    %Docstring
400        Redo()
401
402        If there is a redo facility and the last operation can be redone,
403        redoes the last operation.
404    %End
405
406    void Remove(
407        long from_,
408        long to_
409    );
410    %Docstring
411        Remove(from_, to_)
412
413        Removes the text starting at the first given position up to (but not
414        including) the character at the last position.
415    %End
416
417    void Replace(
418        long from_,
419        long to_,
420        const wxString & value
421    );
422    %Docstring
423        Replace(from_, to_, value)
424
425        Replaces the text starting at the first position up to (but not
426        including) the character at the last position with the given text.
427    %End
428
429    void SetEditable(
430        bool editable
431    );
432    %Docstring
433        SetEditable(editable)
434
435        Makes the text item editable or read-only, overriding the
436        wxTE_READONLY flag.
437    %End
438
439    void SetInsertionPoint(
440        long pos
441    );
442    %Docstring
443        SetInsertionPoint(pos)
444
445        Sets the insertion point at the given position.
446    %End
447
448    void SetInsertionPointEnd();
449    %Docstring
450        SetInsertionPointEnd()
451
452        Sets the insertion point at the end of the text control.
453    %End
454
455    void SetMaxLength(
456        unsigned long len
457    );
458    %Docstring
459        SetMaxLength(len)
460
461        This function sets the maximum number of characters the user can enter
462        into the control.
463    %End
464
465    void SetSelection(
466        long from_,
467        long to_
468    );
469    %Docstring
470        SetSelection(from_, to_)
471
472        Selects the text starting at the first position up to (but not
473        including) the character at the last position.
474    %End
475
476    void SelectAll();
477    %Docstring
478        SelectAll()
479
480        Selects all text in the control.
481    %End
482
483    void SelectNone();
484    %Docstring
485        SelectNone()
486
487        Deselects selected text in the control.
488    %End
489
490    bool SetHint(
491        const wxString & hint
492    );
493    %Docstring
494        SetHint(hint) -> bool
495
496        Sets a hint shown in an empty unfocused text control.
497    %End
498
499    wxString GetHint() const;
500    %Docstring
501        GetHint() -> String
502
503        Returns the current hint string.
504    %End
505
506    wxPoint GetMargins() const;
507    %Docstring
508        GetMargins() -> Point
509
510        Returns the margins used by the control.
511    %End
512
513    void SetValue(
514        const wxString & value
515    );
516    %Docstring
517        SetValue(value)
518
519        Sets the new text control value.
520    %End
521
522    void Undo();
523    %Docstring
524        Undo()
525
526        If there is an undo facility and the last operation can be undone,
527        undoes the last operation.
528    %End
529
530    void WriteText(
531        const wxString & text
532    );
533    %Docstring
534        WriteText(text)
535
536        Writes the text into the text control at the current insertion
537        position.
538    %End
539
540    void DiscardEdits();
541    %Docstring
542        DiscardEdits()
543
544        Resets the internal modified flag as if the current changes had been
545        saved.
546    %End
547
548    bool EmulateKeyPress(
549        const wxKeyEvent & event
550    );
551    %Docstring
552        EmulateKeyPress(event) -> bool
553
554        This function inserts into the control the character which would have
555        been inserted if the given key event had occurred in the text control.
556    %End
557
558    const wxTextAttr & GetDefaultStyle() const;
559    %Docstring
560        GetDefaultStyle() -> TextAttr
561
562        Returns the style currently used for the new text.
563    %End
564
565    int GetLineLength(
566        long lineNo
567    ) const;
568    %Docstring
569        GetLineLength(lineNo) -> int
570
571        Gets the length of the specified line, not including any trailing
572        newline character(s).
573    %End
574
575    wxString GetLineText(
576        long lineNo
577    ) const;
578    %Docstring
579        GetLineText(lineNo) -> String
580
581        Returns the contents of a given line in the text control, not
582        including any trailing newline character(s).
583    %End
584
585    int GetNumberOfLines() const;
586    %Docstring
587        GetNumberOfLines() -> int
588
589        Returns the number of lines in the text control buffer.
590    %End
591
592    bool GetStyle(
593        long position,
594        wxTextAttr & style
595    );
596    %Docstring
597        GetStyle(position, style) -> bool
598
599        Returns the style at this position in the text control.
600    %End
601
602    wxTextCtrlHitTestResult HitTest(
603        const wxPoint & pt,
604        long * pos   /Out/
605    ) const   /PyName=HitTestPos/;
606    %Docstring
607        HitTestPos(pt) -> (TextCtrlHitTestResult, pos)
608
609        Finds the position of the character at the specified point.
610    %End
611
612    wxTextCtrlHitTestResult HitTest(
613        const wxPoint & pt,
614        wxTextCoord * col   /Out/,
615        wxTextCoord * row   /Out/
616    ) const;
617    %Docstring
618        HitTest(pt) -> (TextCtrlHitTestResult, col, row)
619
620        Finds the row and column of the character at the specified point.
621    %End
622
623    bool IsModified() const;
624    %Docstring
625        IsModified() -> bool
626
627        Returns true if the text has been modified by user.
628    %End
629
630    bool IsMultiLine() const;
631    %Docstring
632        IsMultiLine() -> bool
633
634        Returns true if this is a multi line edit control and false otherwise.
635    %End
636
637    bool IsSingleLine() const;
638    %Docstring
639        IsSingleLine() -> bool
640
641        Returns true if this is a single line edit control and false
642        otherwise.
643    %End
644
645    void MarkDirty();
646    %Docstring
647        MarkDirty()
648
649        Mark text as modified (dirty).
650    %End
651
652    bool PositionToXY(
653        long pos,
654        long * x   /Out/,
655        long * y   /Out/
656    ) const;
657    %Docstring
658        PositionToXY(pos) -> (bool, x, y)
659
660        Converts given position to a zero-based column, line number pair.
661    %End
662
663    wxPoint PositionToCoords(
664        long pos
665    ) const;
666    %Docstring
667        PositionToCoords(pos) -> Point
668
669        Converts given text position to client coordinates in pixels.
670    %End
671
672    bool SetDefaultStyle(
673        const wxTextAttr & style
674    );
675    %Docstring
676        SetDefaultStyle(style) -> bool
677
678        Changes the default style to use for the new text which is going to be
679        added to the control using WriteText() or AppendText().
680    %End
681
682    void SetModified(
683        bool modified
684    );
685    %Docstring
686        SetModified(modified)
687
688        Marks the control as being modified by the user or not.
689    %End
690
691    bool SetStyle(
692        long start,
693        long end,
694        const wxTextAttr & style
695    );
696    %Docstring
697        SetStyle(start, end, style) -> bool
698
699        Changes the style of the given range.
700    %End
701
702    void ShowPosition(
703        long pos
704    );
705    %Docstring
706        ShowPosition(pos)
707
708        Makes the line containing the given position visible.
709    %End
710
711    long XYToPosition(
712        long x,
713        long y
714    ) const;
715    %Docstring
716        XYToPosition(x, y) -> long
717
718        Converts the given zero based column and line number to a position.
719    %End
720
721    static
722    wxVisualAttributes GetClassDefaultAttributes(
723        wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL
724    );
725    %Docstring
726        GetClassDefaultAttributes(variant=WINDOW_VARIANT_NORMAL) -> VisualAttributes
727    %End
728    %PreMethodCode
729        if (!wxPyCheckForApp()) return NULL;
730    %End
731
732    void write(const wxString* text);
733    %Docstring
734        write(text)
735
736        Append text to the textctrl, for file-like compatibility.
737    %End
738    %MethodCode
739        PyErr_Clear();
740        Py_BEGIN_ALLOW_THREADS
741        _wxSearchCtrl_write(sipCpp, text);
742        Py_END_ALLOW_THREADS
743        if (PyErr_Occurred()) sipIsErr = 1;
744    %End
745    %TypeCode
746    void _wxSearchCtrl_write(wxSearchCtrl* self, const wxString* text)
747    {
748        self->AppendText(*text);
749    }
750    %End
751
752    void flush();
753    %Docstring
754        flush()
755
756        NOP, for file-like compatibility.
757    %End
758    %MethodCode
759        PyErr_Clear();
760        Py_BEGIN_ALLOW_THREADS
761        _wxSearchCtrl_flush(sipCpp);
762        Py_END_ALLOW_THREADS
763        if (PyErr_Occurred()) sipIsErr = 1;
764    %End
765    %TypeCode
766    void _wxSearchCtrl_flush(wxSearchCtrl* self)
767    {
768
769    }
770    %End
771
772    %Property(name=SearchButtonVisible, get=IsSearchButtonVisible, set=ShowSearchButton)
773    %Property(name=CancelButtonVisible, get=IsCancelButtonVisible, set=ShowCancelButton)
774    public:
775
776
777    %Property(name=DefaultStyle, get=GetDefaultStyle, set=SetDefaultStyle)
778    %Property(name=DescriptiveText, get=GetDescriptiveText, set=SetDescriptiveText)
779    %Property(name=Hint, get=GetHint, set=SetHint)
780    %Property(name=InsertionPoint, get=GetInsertionPoint, set=SetInsertionPoint)
781    %Property(name=LastPosition, get=GetLastPosition)
782    %Property(name=Margins, get=GetMargins, set=SetMargins)
783    %Property(name=Menu, get=GetMenu, set=SetMenu)
784    %Property(name=NumberOfLines, get=GetNumberOfLines)
785    %Property(name=StringSelection, get=GetStringSelection)
786    %Property(name=Value, get=GetValue, set=SetValue)
787    public:
788    virtual wxPoint GetClientAreaOrigin() const;
789    virtual bool Validate();
790    virtual bool TransferDataToWindow();
791    virtual bool TransferDataFromWindow();
792    virtual void InitDialog();
793    virtual bool AcceptsFocus() const;
794    virtual bool AcceptsFocusRecursively() const;
795    virtual bool AcceptsFocusFromKeyboard() const;
796    virtual void AddChild( wxWindowBase *child );
797    virtual void RemoveChild( wxWindowBase *child );
798    virtual void InheritAttributes();
799    virtual bool ShouldInheritColours() const;
800    virtual void OnInternalIdle();
801    virtual wxWindow *GetMainWindowOfCompositeControl();
802    virtual bool InformFirstDirection(int direction, int size, int availableOtherDir);
803    virtual void SetCanFocus(bool canFocus);
804    virtual bool Destroy();
805    virtual void SetValidator( const wxValidator &validator );
806    virtual wxValidator* GetValidator();
807
808
809    protected:
810    virtual bool ProcessEvent(wxEvent & event);
811    virtual void DoEnable(bool enable);
812    virtual void DoGetPosition(int *x, int *y) const;
813    virtual void DoGetSize(int *width, int *height) const;
814    virtual void DoGetClientSize(int *width, int *height) const;
815    virtual wxSize DoGetBestSize() const;
816    virtual wxSize DoGetBestClientSize() const;
817    virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags);
818    virtual void DoSetClientSize(int width, int height);
819    virtual void DoSetSizeHints( int minW, int minH, int maxW, int maxH, int incW, int incH );
820    virtual wxSize DoGetBorderSize() const;
821    virtual void DoMoveWindow(int x, int y, int width, int height);
822    virtual void DoSetWindowVariant( wxWindowVariant variant);
823    virtual wxBorder GetDefaultBorder() const;
824    virtual wxBorder GetDefaultBorderForControl() const;
825    virtual void DoFreeze();
826    virtual void DoThaw();
827    virtual bool HasTransparentBackground();
828    virtual bool TryBefore(wxEvent& event);
829    virtual bool TryAfter(wxEvent& event);
830
831
832    public:
833
834
835};  // end of class wxSearchCtrl
836
837
838%Extract(id=pycode_core)
839EVT_SEARCHCTRL_CANCEL_BTN = wx.PyEventBinder( wxEVT_SEARCHCTRL_CANCEL_BTN, 1)
840EVT_SEARCHCTRL_SEARCH_BTN = wx.PyEventBinder( wxEVT_SEARCHCTRL_SEARCH_BTN, 1)
841
842# deprecated wxEVT aliases
843wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN  = wxEVT_SEARCHCTRL_CANCEL_BTN
844wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN  = wxEVT_SEARCHCTRL_SEARCH_BTN
845
846%End
847
848
849//---------------------------------------------------------------------------
850
851