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/clrpicker.h>
13#include <wx/filepicker.h>
14#include <wx/fontpicker.h>
15%End
16
17
18//---------------------------------------------------------------------------
19
20const int wxPB_USE_TEXTCTRL;
21const int wxPB_SMALL;
22const int wxCLRP_USE_TEXTCTRL;
23const int wxCLRP_DEFAULT_STYLE;
24const int wxCLRP_SHOW_LABEL;
25wxEventType wxEVT_COLOURPICKER_CHANGED   /PyName=wxEVT_COLOURPICKER_CHANGED/;
26
27const int wxFLP_OPEN;
28const int wxFLP_SAVE;
29const int wxFLP_OVERWRITE_PROMPT;
30const int wxFLP_FILE_MUST_EXIST;
31const int wxFLP_CHANGE_DIR;
32const int wxFLP_SMALL;
33const int wxFLP_USE_TEXTCTRL;
34const int wxFLP_DEFAULT_STYLE;
35const int wxDIRP_DIR_MUST_EXIST;
36const int wxDIRP_CHANGE_DIR;
37const int wxDIRP_SMALL;
38const int wxDIRP_USE_TEXTCTRL;
39const int wxDIRP_DEFAULT_STYLE;
40wxEventType wxEVT_FILEPICKER_CHANGED   /PyName=wxEVT_FILEPICKER_CHANGED/;
41
42wxEventType wxEVT_DIRPICKER_CHANGED   /PyName=wxEVT_DIRPICKER_CHANGED/;
43
44const int wxFNTP_FONTDESC_AS_LABEL;
45const int wxFNTP_USEFONT_FOR_LABEL;
46const int wxFONTBTN_DEFAULT_STYLE;
47const int wxFNTP_USE_TEXTCTRL;
48const int wxFNTP_DEFAULT_STYLE;
49wxEventType wxEVT_FONTPICKER_CHANGED   /PyName=wxEVT_FONTPICKER_CHANGED/;
50
51class wxPickerBase : wxControl
52{
53    %Docstring
54        PickerBase()
55
56        Base abstract class for all pickers which support an auxiliary text
57        control.
58    %End
59    %TypeHeaderCode
60        #include <wx/pickerbase.h>
61    %End
62
63public:
64    wxPickerBase();
65
66    virtual
67    ~wxPickerBase();
68
69    bool CreateBase(
70        wxWindow * parent,
71        wxWindowID id = wxID_ANY,
72        const wxString & text = wxEmptyString,
73        const wxPoint & pos = wxDefaultPosition,
74        const wxSize & size = wxDefaultSize,
75        long style = 0,
76        const wxValidator & validator = wxDefaultValidator,
77        const wxString & name = wxButtonNameStr
78    );
79    %Docstring
80        CreateBase(parent, id=ID_ANY, text=EmptyString, pos=DefaultPosition, size=DefaultSize, style=0, validator=DefaultValidator, name=ButtonNameStr) -> bool
81    %End
82
83    int GetInternalMargin() const;
84    %Docstring
85        GetInternalMargin() -> int
86
87        Returns the margin (in pixel) between the picker and the text control.
88    %End
89
90    int GetPickerCtrlProportion() const;
91    %Docstring
92        GetPickerCtrlProportion() -> int
93
94        Returns the proportion value of the picker.
95    %End
96
97    wxTextCtrl * GetTextCtrl();
98    %Docstring
99        GetTextCtrl() -> TextCtrl
100
101        Returns a pointer to the text control handled by this window or NULL
102        if the wxPB_USE_TEXTCTRL style was not specified when this control was
103        created.
104    %End
105
106    wxControl * GetPickerCtrl();
107    %Docstring
108        GetPickerCtrl() -> Control
109
110        Returns the native implementation of the real picker control.
111    %End
112
113    int GetTextCtrlProportion() const;
114    %Docstring
115        GetTextCtrlProportion() -> int
116
117        Returns the proportion value of the text control.
118    %End
119
120    bool HasTextCtrl() const;
121    %Docstring
122        HasTextCtrl() -> bool
123
124        Returns true if this window has a valid text control (i.e. if the
125        wxPB_USE_TEXTCTRL style was given when creating this control).
126    %End
127
128    bool IsPickerCtrlGrowable() const;
129    %Docstring
130        IsPickerCtrlGrowable() -> bool
131
132        Returns true if the picker control is growable.
133    %End
134
135    bool IsTextCtrlGrowable() const;
136    %Docstring
137        IsTextCtrlGrowable() -> bool
138
139        Returns true if the text control is growable.
140    %End
141
142    void SetInternalMargin(
143        int margin
144    );
145    %Docstring
146        SetInternalMargin(margin)
147
148        Sets the margin (in pixel) between the picker and the text control.
149    %End
150
151    void SetPickerCtrlGrowable(
152        bool grow = true
153    );
154    %Docstring
155        SetPickerCtrlGrowable(grow=True)
156
157        Sets the picker control as growable when grow is true.
158    %End
159
160    void SetPickerCtrlProportion(
161        int prop
162    );
163    %Docstring
164        SetPickerCtrlProportion(prop)
165
166        Sets the proportion value of the picker.
167    %End
168
169    void SetTextCtrlGrowable(
170        bool grow = true
171    );
172    %Docstring
173        SetTextCtrlGrowable(grow=True)
174
175        Sets the text control as growable when grow is true.
176    %End
177
178    void SetTextCtrlProportion(
179        int prop
180    );
181    %Docstring
182        SetTextCtrlProportion(prop)
183
184        Sets the proportion value of the text control.
185    %End
186
187    void SetTextCtrl(
188        wxTextCtrl * text
189    );
190    %Docstring
191        SetTextCtrl(text)
192    %End
193
194    void SetPickerCtrl(
195        wxControl * picker
196    );
197    %Docstring
198        SetPickerCtrl(picker)
199    %End
200
201    virtual
202    void UpdatePickerFromTextCtrl() = 0;
203    %Docstring
204        UpdatePickerFromTextCtrl()
205    %End
206
207    virtual
208    void UpdateTextCtrlFromPicker() = 0;
209    %Docstring
210        UpdateTextCtrlFromPicker()
211    %End
212
213    public:
214
215
216    %Property(name=InternalMargin, get=GetInternalMargin, set=SetInternalMargin)
217    %Property(name=PickerCtrl, get=GetPickerCtrl, set=SetPickerCtrl)
218    %Property(name=PickerCtrlProportion, get=GetPickerCtrlProportion, set=SetPickerCtrlProportion)
219    %Property(name=TextCtrl, get=GetTextCtrl, set=SetTextCtrl)
220    %Property(name=TextCtrlProportion, get=GetTextCtrlProportion, set=SetTextCtrlProportion)
221
222protected:
223    virtual
224    long GetTextCtrlStyle(
225        long style
226    ) const;
227    %Docstring
228        GetTextCtrlStyle(style) -> long
229    %End
230
231    virtual
232    long GetPickerStyle(
233        long style
234    ) const;
235    %Docstring
236        GetPickerStyle(style) -> long
237    %End
238
239    void PostCreation();
240    %Docstring
241        PostCreation()
242    %End
243
244};  // end of class wxPickerBase
245
246
247const char* wxColourPickerWidgetNameStr;
248
249const char* wxColourPickerCtrlNameStr;
250
251class wxColourPickerCtrl : wxPickerBase
252{
253    %Docstring
254        ColourPickerCtrl()
255        ColourPickerCtrl(parent, id=ID_ANY, colour=BLACK, pos=DefaultPosition, size=DefaultSize, style=CLRP_DEFAULT_STYLE, validator=DefaultValidator, name=ColourPickerCtrlNameStr)
256
257        This control allows the user to select a colour.
258    %End
259    %TypeHeaderCode
260        #include <wx/clrpicker.h>
261    %End
262
263public:
264    wxColourPickerCtrl();
265    %PreMethodCode
266        if (!wxPyCheckForApp()) return NULL;
267    %End
268
269    wxColourPickerCtrl(
270        wxWindow * parent   /TransferThis/,
271        wxWindowID id = wxID_ANY,
272        const wxColour & colour = *wxBLACK,
273        const wxPoint & pos = wxDefaultPosition,
274        const wxSize & size = wxDefaultSize,
275        long style = wxCLRP_DEFAULT_STYLE,
276        const wxValidator & validator = wxDefaultValidator,
277        const wxString & name = wxColourPickerCtrlNameStr
278    );
279    %PreMethodCode
280        if (!wxPyCheckForApp()) return NULL;
281    %End
282
283    void SetColour(
284        const wxColour & col
285    );
286    %Docstring
287        SetColour(col)
288        SetColour(colname)
289
290        Sets the currently selected colour.
291    %End
292
293    void SetColour(
294        const wxString & colname
295    );
296
297    bool Create(
298        wxWindow * parent   /TransferThis/,
299        wxWindowID id = wxID_ANY,
300        const wxColour & colour = *wxBLACK,
301        const wxPoint & pos = wxDefaultPosition,
302        const wxSize & size = wxDefaultSize,
303        long style = wxCLRP_DEFAULT_STYLE,
304        const wxValidator & validator = wxDefaultValidator,
305        const wxString & name = wxColourPickerCtrlNameStr
306    );
307    %Docstring
308        Create(parent, id=ID_ANY, colour=BLACK, pos=DefaultPosition, size=DefaultSize, style=CLRP_DEFAULT_STYLE, validator=DefaultValidator, name=ColourPickerCtrlNameStr) -> bool
309
310        Creates a colour picker with the given arguments.
311    %End
312
313    wxColour GetColour() const;
314    %Docstring
315        GetColour() -> Colour
316
317        Returns the currently selected colour.
318    %End
319
320    public:
321    virtual wxPoint GetClientAreaOrigin() const;
322    virtual bool Validate();
323    virtual bool TransferDataToWindow();
324    virtual bool TransferDataFromWindow();
325    virtual void InitDialog();
326    virtual bool AcceptsFocus() const;
327    virtual bool AcceptsFocusRecursively() const;
328    virtual bool AcceptsFocusFromKeyboard() const;
329    virtual void AddChild( wxWindowBase *child );
330    virtual void RemoveChild( wxWindowBase *child );
331    virtual void InheritAttributes();
332    virtual bool ShouldInheritColours() const;
333    virtual void OnInternalIdle();
334    virtual wxWindow *GetMainWindowOfCompositeControl();
335    virtual bool InformFirstDirection(int direction, int size, int availableOtherDir);
336    virtual void SetCanFocus(bool canFocus);
337    virtual bool Destroy();
338    virtual void SetValidator( const wxValidator &validator );
339    virtual wxValidator* GetValidator();
340
341
342    protected:
343    virtual bool ProcessEvent(wxEvent & event);
344    virtual void DoEnable(bool enable);
345    virtual void DoGetPosition(int *x, int *y) const;
346    virtual void DoGetSize(int *width, int *height) const;
347    virtual void DoGetClientSize(int *width, int *height) const;
348    virtual wxSize DoGetBestSize() const;
349    virtual wxSize DoGetBestClientSize() const;
350    virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags);
351    virtual void DoSetClientSize(int width, int height);
352    virtual void DoSetSizeHints( int minW, int minH, int maxW, int maxH, int incW, int incH );
353    virtual wxSize DoGetBorderSize() const;
354    virtual void DoMoveWindow(int x, int y, int width, int height);
355    virtual void DoSetWindowVariant( wxWindowVariant variant);
356    virtual wxBorder GetDefaultBorder() const;
357    virtual wxBorder GetDefaultBorderForControl() const;
358    virtual void DoFreeze();
359    virtual void DoThaw();
360    virtual bool HasTransparentBackground();
361    virtual bool TryBefore(wxEvent& event);
362    virtual bool TryAfter(wxEvent& event);
363
364
365    public:
366
367
368    static
369    wxVisualAttributes GetClassDefaultAttributes(
370        wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL
371    );
372    %Docstring
373        GetClassDefaultAttributes(variant=WINDOW_VARIANT_NORMAL) -> VisualAttributes
374    %End
375    %PreMethodCode
376        if (!wxPyCheckForApp()) return NULL;
377    %End
378
379            virtual void UpdatePickerFromTextCtrl();
380            virtual void UpdateTextCtrlFromPicker();
381
382
383    public:
384
385
386    %Property(name=Colour, get=GetColour, set=SetColour)
387};  // end of class wxColourPickerCtrl
388
389
390class wxColourPickerEvent : wxCommandEvent
391{
392    %Docstring
393        ColourPickerEvent()
394        ColourPickerEvent(generator, id, colour)
395
396        This event class is used for the events generated by
397        wxColourPickerCtrl.
398    %End
399    %TypeHeaderCode
400        #include <wx/clrpicker.h>
401    %End
402
403public:
404    wxColourPickerEvent();
405
406    wxColourPickerEvent(
407        wxObject * generator,
408        int id,
409        const wxColour & colour
410    );
411
412    wxColour GetColour() const;
413    %Docstring
414        GetColour() -> Colour
415
416        Retrieve the colour the user has just selected.
417    %End
418
419    void SetColour(
420        const wxColour & pos
421    );
422    %Docstring
423        SetColour(pos)
424
425        Set the colour associated with the event.
426    %End
427
428    public:
429    virtual wxEvent* Clone() const /Factory/;
430
431
432    private:
433        wxColourPickerEvent& operator=(const wxColourPickerEvent&);
434
435
436    public:
437
438
439    %Property(name=Colour, get=GetColour, set=SetColour)
440};  // end of class wxColourPickerEvent
441
442
443const char* wxFilePickerWidgetLabel;
444
445const char* wxFilePickerWidgetNameStr;
446
447const char* wxFilePickerCtrlNameStr;
448
449const char* wxFileSelectorPromptStr;
450
451const char* wxFileSelectorDefaultWildcardStr;
452
453class wxFilePickerCtrl : wxPickerBase
454{
455    %Docstring
456        FilePickerCtrl()
457        FilePickerCtrl(parent, id=ID_ANY, path=EmptyString, message=FileSelectorPromptStr, wildcard=FileSelectorDefaultWildcardStr, pos=DefaultPosition, size=DefaultSize, style=FLP_DEFAULT_STYLE, validator=DefaultValidator, name=FilePickerCtrlNameStr)
458
459        This control allows the user to select a file.
460    %End
461    %TypeHeaderCode
462        #include <wx/filepicker.h>
463    %End
464
465public:
466    wxFilePickerCtrl();
467    %PreMethodCode
468        if (!wxPyCheckForApp()) return NULL;
469    %End
470
471    wxFilePickerCtrl(
472        wxWindow * parent   /TransferThis/,
473        wxWindowID id = wxID_ANY,
474        const wxString & path = wxEmptyString,
475        const wxString & message = wxFileSelectorPromptStr,
476        const wxString & wildcard = wxFileSelectorDefaultWildcardStr,
477        const wxPoint & pos = wxDefaultPosition,
478        const wxSize & size = wxDefaultSize,
479        long style = wxFLP_DEFAULT_STYLE,
480        const wxValidator & validator = wxDefaultValidator,
481        const wxString & name = wxFilePickerCtrlNameStr
482    );
483    %PreMethodCode
484        if (!wxPyCheckForApp()) return NULL;
485    %End
486
487    bool Create(
488        wxWindow * parent   /TransferThis/,
489        wxWindowID id = wxID_ANY,
490        const wxString & path = wxEmptyString,
491        const wxString & message = wxFileSelectorPromptStr,
492        const wxString & wildcard = wxFileSelectorDefaultWildcardStr,
493        const wxPoint & pos = wxDefaultPosition,
494        const wxSize & size = wxDefaultSize,
495        long style = wxFLP_DEFAULT_STYLE,
496        const wxValidator & validator = wxDefaultValidator,
497        const wxString & name = wxFilePickerCtrlNameStr
498    );
499    %Docstring
500        Create(parent, id=ID_ANY, path=EmptyString, message=FileSelectorPromptStr, wildcard=FileSelectorDefaultWildcardStr, pos=DefaultPosition, size=DefaultSize, style=FLP_DEFAULT_STYLE, validator=DefaultValidator, name=FilePickerCtrlNameStr) -> bool
501
502        Creates this widget with the given parameters.
503    %End
504
505    wxString GetPath() const;
506    %Docstring
507        GetPath() -> String
508
509        Returns the absolute path of the currently selected file.
510    %End
511
512    void SetInitialDirectory(
513        const wxString & dir
514    );
515    %Docstring
516        SetInitialDirectory(dir)
517
518        Set the directory to show when starting to browse for files.
519    %End
520
521    void SetPath(
522        const wxString & filename
523    );
524    %Docstring
525        SetPath(filename)
526
527        Sets the absolute path of the currently selected file.
528    %End
529
530    public:
531    virtual wxPoint GetClientAreaOrigin() const;
532    virtual bool Validate();
533    virtual bool TransferDataToWindow();
534    virtual bool TransferDataFromWindow();
535    virtual void InitDialog();
536    virtual bool AcceptsFocus() const;
537    virtual bool AcceptsFocusRecursively() const;
538    virtual bool AcceptsFocusFromKeyboard() const;
539    virtual void AddChild( wxWindowBase *child );
540    virtual void RemoveChild( wxWindowBase *child );
541    virtual void InheritAttributes();
542    virtual bool ShouldInheritColours() const;
543    virtual void OnInternalIdle();
544    virtual wxWindow *GetMainWindowOfCompositeControl();
545    virtual bool InformFirstDirection(int direction, int size, int availableOtherDir);
546    virtual void SetCanFocus(bool canFocus);
547    virtual bool Destroy();
548    virtual void SetValidator( const wxValidator &validator );
549    virtual wxValidator* GetValidator();
550
551
552    protected:
553    virtual bool ProcessEvent(wxEvent & event);
554    virtual void DoEnable(bool enable);
555    virtual void DoGetPosition(int *x, int *y) const;
556    virtual void DoGetSize(int *width, int *height) const;
557    virtual void DoGetClientSize(int *width, int *height) const;
558    virtual wxSize DoGetBestSize() const;
559    virtual wxSize DoGetBestClientSize() const;
560    virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags);
561    virtual void DoSetClientSize(int width, int height);
562    virtual void DoSetSizeHints( int minW, int minH, int maxW, int maxH, int incW, int incH );
563    virtual wxSize DoGetBorderSize() const;
564    virtual void DoMoveWindow(int x, int y, int width, int height);
565    virtual void DoSetWindowVariant( wxWindowVariant variant);
566    virtual wxBorder GetDefaultBorder() const;
567    virtual wxBorder GetDefaultBorderForControl() const;
568    virtual void DoFreeze();
569    virtual void DoThaw();
570    virtual bool HasTransparentBackground();
571    virtual bool TryBefore(wxEvent& event);
572    virtual bool TryAfter(wxEvent& event);
573
574
575    public:
576
577
578    static
579    wxVisualAttributes GetClassDefaultAttributes(
580        wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL
581    );
582    %Docstring
583        GetClassDefaultAttributes(variant=WINDOW_VARIANT_NORMAL) -> VisualAttributes
584    %End
585    %PreMethodCode
586        if (!wxPyCheckForApp()) return NULL;
587    %End
588
589            virtual void UpdatePickerFromTextCtrl();
590            virtual void UpdateTextCtrlFromPicker();
591
592
593    public:
594
595
596    %Property(name=Path, get=GetPath, set=SetPath)
597};  // end of class wxFilePickerCtrl
598
599
600const char* wxDirPickerWidgetLabel;
601
602const char* wxDirPickerWidgetNameStr;
603
604const char* wxDirPickerCtrlNameStr;
605
606const char* wxDirSelectorPromptStr;
607
608class wxDirPickerCtrl : wxPickerBase
609{
610    %Docstring
611        DirPickerCtrl()
612        DirPickerCtrl(parent, id=ID_ANY, path=EmptyString, message=DirSelectorPromptStr, pos=DefaultPosition, size=DefaultSize, style=DIRP_DEFAULT_STYLE, validator=DefaultValidator, name=DirPickerCtrlNameStr)
613
614        This control allows the user to select a directory.
615    %End
616    %TypeHeaderCode
617        #include <wx/filepicker.h>
618    %End
619
620public:
621    wxDirPickerCtrl();
622    %PreMethodCode
623        if (!wxPyCheckForApp()) return NULL;
624    %End
625
626    wxDirPickerCtrl(
627        wxWindow * parent   /TransferThis/,
628        wxWindowID id = wxID_ANY,
629        const wxString & path = wxEmptyString,
630        const wxString & message = wxDirSelectorPromptStr,
631        const wxPoint & pos = wxDefaultPosition,
632        const wxSize & size = wxDefaultSize,
633        long style = wxDIRP_DEFAULT_STYLE,
634        const wxValidator & validator = wxDefaultValidator,
635        const wxString & name = wxDirPickerCtrlNameStr
636    );
637    %PreMethodCode
638        if (!wxPyCheckForApp()) return NULL;
639    %End
640
641    bool Create(
642        wxWindow * parent   /TransferThis/,
643        wxWindowID id = wxID_ANY,
644        const wxString & path = wxEmptyString,
645        const wxString & message = wxDirSelectorPromptStr,
646        const wxPoint & pos = wxDefaultPosition,
647        const wxSize & size = wxDefaultSize,
648        long style = wxDIRP_DEFAULT_STYLE,
649        const wxValidator & validator = wxDefaultValidator,
650        const wxString & name = wxDirPickerCtrlNameStr
651    );
652    %Docstring
653        Create(parent, id=ID_ANY, path=EmptyString, message=DirSelectorPromptStr, pos=DefaultPosition, size=DefaultSize, style=DIRP_DEFAULT_STYLE, validator=DefaultValidator, name=DirPickerCtrlNameStr) -> bool
654
655        Creates the widgets with the given parameters.
656    %End
657
658    wxString GetPath() const;
659    %Docstring
660        GetPath() -> String
661
662        Returns the absolute path of the currently selected directory.
663    %End
664
665    void SetInitialDirectory(
666        const wxString & dir
667    );
668    %Docstring
669        SetInitialDirectory(dir)
670
671        Set the directory to show when starting to browse for directories.
672    %End
673
674    void SetPath(
675        const wxString & dirname
676    );
677    %Docstring
678        SetPath(dirname)
679
680        Sets the absolute path of the currently selected directory (the
681        default converter uses current locale's charset).
682    %End
683
684    public:
685    virtual wxPoint GetClientAreaOrigin() const;
686    virtual bool Validate();
687    virtual bool TransferDataToWindow();
688    virtual bool TransferDataFromWindow();
689    virtual void InitDialog();
690    virtual bool AcceptsFocus() const;
691    virtual bool AcceptsFocusRecursively() const;
692    virtual bool AcceptsFocusFromKeyboard() const;
693    virtual void AddChild( wxWindowBase *child );
694    virtual void RemoveChild( wxWindowBase *child );
695    virtual void InheritAttributes();
696    virtual bool ShouldInheritColours() const;
697    virtual void OnInternalIdle();
698    virtual wxWindow *GetMainWindowOfCompositeControl();
699    virtual bool InformFirstDirection(int direction, int size, int availableOtherDir);
700    virtual void SetCanFocus(bool canFocus);
701    virtual bool Destroy();
702    virtual void SetValidator( const wxValidator &validator );
703    virtual wxValidator* GetValidator();
704
705
706    protected:
707    virtual bool ProcessEvent(wxEvent & event);
708    virtual void DoEnable(bool enable);
709    virtual void DoGetPosition(int *x, int *y) const;
710    virtual void DoGetSize(int *width, int *height) const;
711    virtual void DoGetClientSize(int *width, int *height) const;
712    virtual wxSize DoGetBestSize() const;
713    virtual wxSize DoGetBestClientSize() const;
714    virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags);
715    virtual void DoSetClientSize(int width, int height);
716    virtual void DoSetSizeHints( int minW, int minH, int maxW, int maxH, int incW, int incH );
717    virtual wxSize DoGetBorderSize() const;
718    virtual void DoMoveWindow(int x, int y, int width, int height);
719    virtual void DoSetWindowVariant( wxWindowVariant variant);
720    virtual wxBorder GetDefaultBorder() const;
721    virtual wxBorder GetDefaultBorderForControl() const;
722    virtual void DoFreeze();
723    virtual void DoThaw();
724    virtual bool HasTransparentBackground();
725    virtual bool TryBefore(wxEvent& event);
726    virtual bool TryAfter(wxEvent& event);
727
728
729    public:
730
731
732    static
733    wxVisualAttributes GetClassDefaultAttributes(
734        wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL
735    );
736    %Docstring
737        GetClassDefaultAttributes(variant=WINDOW_VARIANT_NORMAL) -> VisualAttributes
738    %End
739    %PreMethodCode
740        if (!wxPyCheckForApp()) return NULL;
741    %End
742
743            virtual void UpdatePickerFromTextCtrl();
744            virtual void UpdateTextCtrlFromPicker();
745
746
747    public:
748
749
750    %Property(name=Path, get=GetPath, set=SetPath)
751};  // end of class wxDirPickerCtrl
752
753
754class wxFileDirPickerEvent : wxCommandEvent
755{
756    %Docstring
757        FileDirPickerEvent()
758        FileDirPickerEvent(type, generator, id, path)
759
760        This event class is used for the events generated by wxFilePickerCtrl
761        and by wxDirPickerCtrl.
762    %End
763    %TypeHeaderCode
764        #include <wx/filepicker.h>
765    %End
766
767public:
768    wxFileDirPickerEvent();
769
770    wxFileDirPickerEvent(
771        wxEventType type,
772        wxObject * generator,
773        int id,
774        const wxString & path
775    );
776
777    wxString GetPath() const;
778    %Docstring
779        GetPath() -> String
780
781        Retrieve the absolute path of the file/directory the user has just
782        selected.
783    %End
784
785    void SetPath(
786        const wxString & path
787    );
788    %Docstring
789        SetPath(path)
790
791        Set the absolute path of the file/directory associated with the event.
792    %End
793
794    public:
795    virtual wxEvent* Clone() const /Factory/;
796
797
798    private:
799        wxFileDirPickerEvent& operator=(const wxFileDirPickerEvent&);
800
801
802    public:
803
804
805    %Property(name=Path, get=GetPath, set=SetPath)
806};  // end of class wxFileDirPickerEvent
807
808
809const char* wxFontPickerWidgetNameStr;
810
811const char* wxFontPickerCtrlNameStr;
812
813class wxFontPickerCtrl : wxPickerBase
814{
815    %Docstring
816        FontPickerCtrl()
817        FontPickerCtrl(parent, id=ID_ANY, font=NullFont, pos=DefaultPosition, size=DefaultSize, style=FNTP_DEFAULT_STYLE, validator=DefaultValidator, name=FontPickerCtrlNameStr)
818
819        This control allows the user to select a font.
820    %End
821    %TypeHeaderCode
822        #include <wx/fontpicker.h>
823    %End
824
825public:
826    wxFontPickerCtrl();
827    %PreMethodCode
828        if (!wxPyCheckForApp()) return NULL;
829    %End
830
831    wxFontPickerCtrl(
832        wxWindow * parent   /TransferThis/,
833        wxWindowID id = wxID_ANY,
834        const wxFont & font = wxNullFont,
835        const wxPoint & pos = wxDefaultPosition,
836        const wxSize & size = wxDefaultSize,
837        long style = wxFNTP_DEFAULT_STYLE,
838        const wxValidator & validator = wxDefaultValidator,
839        const wxString & name = wxFontPickerCtrlNameStr
840    );
841    %PreMethodCode
842        if (!wxPyCheckForApp()) return NULL;
843    %End
844
845    bool Create(
846        wxWindow * parent   /TransferThis/,
847        wxWindowID id = wxID_ANY,
848        const wxFont & font = wxNullFont,
849        const wxPoint & pos = wxDefaultPosition,
850        const wxSize & size = wxDefaultSize,
851        long style = wxFNTP_DEFAULT_STYLE,
852        const wxValidator & validator = wxDefaultValidator,
853        const wxString & name = wxFontPickerCtrlNameStr
854    );
855    %Docstring
856        Create(parent, id=ID_ANY, font=NullFont, pos=DefaultPosition, size=DefaultSize, style=FNTP_DEFAULT_STYLE, validator=DefaultValidator, name=FontPickerCtrlNameStr) -> bool
857
858        Creates this widget with given parameters.
859    %End
860
861    unsigned int GetMaxPointSize() const;
862    %Docstring
863        GetMaxPointSize() -> unsignedint
864
865        Returns the maximum point size value allowed for the user-chosen font.
866    %End
867
868    wxFont GetSelectedFont() const;
869    %Docstring
870        GetSelectedFont() -> Font
871
872        Returns the currently selected font.
873    %End
874
875    void SetMaxPointSize(
876        unsigned int max
877    );
878    %Docstring
879        SetMaxPointSize(max)
880
881        Sets the maximum point size value allowed for the user-chosen font.
882    %End
883
884    void SetSelectedFont(
885        const wxFont & font
886    );
887    %Docstring
888        SetSelectedFont(font)
889
890        Sets the currently selected font.
891    %End
892
893    public:
894    virtual wxPoint GetClientAreaOrigin() const;
895    virtual bool Validate();
896    virtual bool TransferDataToWindow();
897    virtual bool TransferDataFromWindow();
898    virtual void InitDialog();
899    virtual bool AcceptsFocus() const;
900    virtual bool AcceptsFocusRecursively() const;
901    virtual bool AcceptsFocusFromKeyboard() const;
902    virtual void AddChild( wxWindowBase *child );
903    virtual void RemoveChild( wxWindowBase *child );
904    virtual void InheritAttributes();
905    virtual bool ShouldInheritColours() const;
906    virtual void OnInternalIdle();
907    virtual wxWindow *GetMainWindowOfCompositeControl();
908    virtual bool InformFirstDirection(int direction, int size, int availableOtherDir);
909    virtual void SetCanFocus(bool canFocus);
910    virtual bool Destroy();
911    virtual void SetValidator( const wxValidator &validator );
912    virtual wxValidator* GetValidator();
913
914
915    protected:
916    virtual bool ProcessEvent(wxEvent & event);
917    virtual void DoEnable(bool enable);
918    virtual void DoGetPosition(int *x, int *y) const;
919    virtual void DoGetSize(int *width, int *height) const;
920    virtual void DoGetClientSize(int *width, int *height) const;
921    virtual wxSize DoGetBestSize() const;
922    virtual wxSize DoGetBestClientSize() const;
923    virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags);
924    virtual void DoSetClientSize(int width, int height);
925    virtual void DoSetSizeHints( int minW, int minH, int maxW, int maxH, int incW, int incH );
926    virtual wxSize DoGetBorderSize() const;
927    virtual void DoMoveWindow(int x, int y, int width, int height);
928    virtual void DoSetWindowVariant( wxWindowVariant variant);
929    virtual wxBorder GetDefaultBorder() const;
930    virtual wxBorder GetDefaultBorderForControl() const;
931    virtual void DoFreeze();
932    virtual void DoThaw();
933    virtual bool HasTransparentBackground();
934    virtual bool TryBefore(wxEvent& event);
935    virtual bool TryAfter(wxEvent& event);
936
937
938    public:
939
940
941    static
942    wxVisualAttributes GetClassDefaultAttributes(
943        wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL
944    );
945    %Docstring
946        GetClassDefaultAttributes(variant=WINDOW_VARIANT_NORMAL) -> VisualAttributes
947    %End
948    %PreMethodCode
949        if (!wxPyCheckForApp()) return NULL;
950    %End
951
952            virtual void UpdatePickerFromTextCtrl();
953            virtual void UpdateTextCtrlFromPicker();
954
955
956    public:
957
958
959    %Property(name=MaxPointSize, get=GetMaxPointSize, set=SetMaxPointSize)
960    %Property(name=SelectedFont, get=GetSelectedFont, set=SetSelectedFont)
961};  // end of class wxFontPickerCtrl
962
963
964class wxFontPickerEvent : wxCommandEvent
965{
966    %Docstring
967        FontPickerEvent(generator, id, font)
968
969        This event class is used for the events generated by wxFontPickerCtrl.
970    %End
971    %TypeHeaderCode
972        #include <wx/fontpicker.h>
973    %End
974
975public:
976    wxFontPickerEvent(
977        wxObject * generator,
978        int id,
979        const wxFont & font
980    );
981
982    wxFont GetFont() const;
983    %Docstring
984        GetFont() -> Font
985
986        Retrieve the font the user has just selected.
987    %End
988
989    void SetFont(
990        const wxFont & f
991    );
992    %Docstring
993        SetFont(f)
994
995        Set the font associated with the event.
996    %End
997
998    public:
999    virtual wxEvent* Clone() const /Factory/;
1000
1001
1002    private:
1003        wxFontPickerEvent& operator=(const wxFontPickerEvent&);
1004
1005
1006    public:
1007
1008
1009    %Property(name=Font, get=GetFont, set=SetFont)
1010};  // end of class wxFontPickerEvent
1011
1012
1013%Extract(id=pycode_core)
1014EVT_COLOURPICKER_CHANGED = wx.PyEventBinder( wxEVT_COLOURPICKER_CHANGED, 1 )
1015
1016# deprecated wxEVT alias
1017wxEVT_COMMAND_COLOURPICKER_CHANGED  = wxEVT_COLOURPICKER_CHANGED
1018
1019%End
1020
1021%Extract(id=pycode_core)
1022EVT_FILEPICKER_CHANGED = wx.PyEventBinder( wxEVT_FILEPICKER_CHANGED, 1 )
1023EVT_DIRPICKER_CHANGED = wx.PyEventBinder( wxEVT_DIRPICKER_CHANGED, 1 )
1024
1025# deprecated wxEVT aliases
1026wxEVT_COMMAND_FILEPICKER_CHANGED   = wxEVT_FILEPICKER_CHANGED
1027wxEVT_COMMAND_DIRPICKER_CHANGED    = wxEVT_DIRPICKER_CHANGED
1028
1029%End
1030
1031%Extract(id=pycode_core)
1032EVT_FONTPICKER_CHANGED = wx.PyEventBinder( wxEVT_FONTPICKER_CHANGED, 1 )
1033
1034# deprecated wxEVT alias
1035wxEVT_COMMAND_FONTPICKER_CHANGED  = wxEVT_FONTPICKER_CHANGED
1036
1037%End
1038
1039%Extract(id=pycode_core)
1040if 'wxMac' in wx.PlatformInfo:
1041    class ColourPickerCtrl(PickerBase):
1042        '''
1043        This control allows the user to select a colour. The
1044        implementation varies by platform but is usually a button which
1045        brings up a `wx.ColourDialog` when clicked.
1046
1047
1048        Window Styles
1049        -------------
1050
1051            ======================  ============================================
1052            wx.CLRP_DEFAULT         Default style.
1053            wx.CLRP_USE_TEXTCTRL    Creates a text control to the left of the
1054                                    picker button which is completely managed
1055                                    by the `wx.ColourPickerCtrl` and which can
1056                                    be used by the user to specify a colour.
1057                                    The text control is automatically synchronized
1058                                    with the button's value. Use functions defined in
1059                                    `wx.PickerBase` to modify the text control.
1060            wx.CLRP_SHOW_LABEL      Shows the colour in HTML form (AABBCC) as the
1061                                    colour button label (instead of no label at all).
1062            ======================  ============================================
1063
1064        Events
1065        ------
1066
1067            ========================  ==========================================
1068            EVT_COLOURPICKER_CHANGED  The user changed the colour selected in the
1069                                      control either using the button or using the
1070                                      text control (see wx.CLRP_USE_TEXTCTRL; note
1071                                      that in this case the event is fired only if
1072                                      the user's input is valid, i.e. recognizable).
1073            ========================  ==========================================
1074        '''
1075
1076        # ColourData object to be shared by all colour pickers, so they can
1077        # share the custom colours
1078        _colourData = None
1079
1080        #--------------------------------------------------
1081        class ColourPickerButton(BitmapButton):
1082            def __init__(self, parent, id=-1, colour=wx.BLACK,
1083                         pos=wx.DefaultPosition, size=wx.DefaultSize,
1084                         style = CLRP_DEFAULT_STYLE,
1085                         validator = wx.DefaultValidator,
1086                         name = "colourpickerwidget"):
1087
1088                wx.BitmapButton.__init__(self, parent, id, wx.Bitmap(1,1),
1089                                         pos, size, style, validator, name)
1090                self.SetColour(colour)
1091                self.InvalidateBestSize()
1092                self.SetInitialSize(size)
1093                self.Bind(wx.EVT_BUTTON, self.OnButtonClick)
1094
1095                if ColourPickerCtrl._colourData is None:
1096                    ColourPickerCtrl._colourData = wx.ColourData()
1097                    ColourPickerCtrl._colourData.SetChooseFull(True)
1098                    grey = 0
1099                    for i in range(16):
1100                        c = wx.Colour(grey, grey, grey)
1101                        ColourPickerCtrl._colourData.SetCustomColour(i, c)
1102                        grey += 16
1103
1104            def SetColour(self, colour):
1105                # force a copy, in case the _colorData is shared
1106                self.colour = wx.Colour(colour)
1107                bmp = self._makeBitmap()
1108                self.SetBitmapLabel(bmp)
1109
1110            def GetColour(self):
1111                return self.colour
1112
1113            def OnButtonClick(self, evt):
1114                ColourPickerCtrl._colourData.SetColour(self.colour)
1115                dlg = wx.ColourDialog(self, ColourPickerCtrl._colourData)
1116                if dlg.ShowModal() == wx.ID_OK:
1117                    ColourPickerCtrl._colourData = dlg.GetColourData()
1118                    self.SetColour(ColourPickerCtrl._colourData.GetColour())
1119                    evt = wx.ColourPickerEvent(self, self.GetId(), self.GetColour())
1120                    self.GetEventHandler().ProcessEvent(evt)
1121
1122            def _makeBitmap(self):
1123                width = height = 24
1124                bg = self.GetColour()
1125                if self.HasFlag(CLRP_SHOW_LABEL):
1126                    w, h = self.GetTextExtent(bg.GetAsString(wx.C2S_HTML_SYNTAX))
1127                    width += w
1128                bmp = wx.Bitmap(width, height)
1129                dc = wx.MemoryDC(bmp)
1130                dc.SetBackground(wx.Brush(self.colour))
1131                dc.Clear()
1132                if self.HasFlag(CLRP_SHOW_LABEL):
1133                    from wx.lib.colourutils import BestLabelColour
1134                    fg = BestLabelColour(bg)
1135                    dc.SetTextForeground(fg)
1136                    dc.DrawText(bg.GetAsString(wx.C2S_HTML_SYNTAX),
1137                                (width - w)/2, (height - h)/2)
1138                return bmp
1139
1140        #--------------------------------------------------
1141
1142        def __init__(self, parent, id=-1, colour=wx.BLACK,
1143                     pos=wx.DefaultPosition, size=wx.DefaultSize,
1144                     style = CLRP_DEFAULT_STYLE,
1145                     validator = wx.DefaultValidator,
1146                     name = "colourpicker"):
1147            if type(colour) != wx.Colour:
1148                colour = wx.Colour(colour)
1149            wx.PickerBase.__init__(self)
1150            self.CreateBase(parent, id, colour.GetAsString(),
1151                            pos, size, style, validator, name)
1152            widget = ColourPickerCtrl.ColourPickerButton(
1153                self, -1, colour, style=self.GetPickerStyle(style))
1154            self.SetPickerCtrl(widget)
1155            widget.Bind(wx.EVT_COLOURPICKER_CHANGED, self.OnColourChange)
1156            self.PostCreation()
1157
1158
1159        def GetColour(self):
1160            '''Set the displayed colour.'''
1161            return self.GetPickerCtrl().GetColour()
1162
1163        def SetColour(self, colour):
1164            '''Returns the currently selected colour.'''
1165            self.GetPickerCtrl().SetColour(colour)
1166            self.UpdateTextCtrlFromPicker()
1167        Colour = property(GetColour, SetColour)
1168
1169
1170        def UpdatePickerFromTextCtrl(self):
1171            col = wx.Colour(self.GetTextCtrl().GetValue())
1172            if not col.IsOk():
1173                return
1174            if self.GetColour() != col:
1175                self.GetPickerCtrl().SetColour(col)
1176                evt = wx.ColourPickerEvent(self, self.GetId(), self.GetColour())
1177                self.GetEventHandler().ProcessEvent(evt)
1178
1179        def UpdateTextCtrlFromPicker(self):
1180            if not self.GetTextCtrl():
1181                return
1182            self.GetTextCtrl().SetValue(self.GetColour().GetAsString())
1183
1184        def GetPickerStyle(self, style):
1185            return style & CLRP_SHOW_LABEL
1186
1187        def OnColourChange(self, evt):
1188            self.UpdateTextCtrlFromPicker()
1189            evt = wx.ColourPickerEvent(self, self.GetId(), self.GetColour())
1190            self.GetEventHandler().ProcessEvent(evt)
1191
1192%End
1193
1194
1195//---------------------------------------------------------------------------
1196
1197