/
FXWizard.i
125 lines (109 loc) · 4.49 KB
/
FXWizard.i
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
/***********************************************************************
* FXRuby -- the Ruby language bindings for the FOX GUI toolkit.
* Copyright (c) 2001 by J. Lyle Johnson. All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* For further information please contact the author by e-mail
* at "lyle@lylejohnson.name".
***********************************************************************/
/**
* A Wizard widget guides the user through a number of panels
* in a predefined sequence; each step must be completed before
* moving on to the next step.
* For example, a Wizard may be used to install software components,
* and ask various questions at each step in the installation.
*/
class FXWizard : public FXDialogBox {
protected:
FXHorizontalFrame *buttons; // Button frame
FXImageFrame *sidebar; // Sidebar comprising image
FXButton *advance; // Advance to next stage
FXButton *retreat; // Retreat to last stage
FXButton *finish; // Finish panel
FXButton *cancel; // Cancel button
FXSwitcher *panels; // Sub panels
FXIcon *finishicon;
FXIcon *nexticon;
FXIcon *backicon;
protected:
FXWizard(){}
void construct();
private:
FXWizard(const FXWizard&);
FXWizard &operator=(const FXWizard&);
public:
long onUpdFinish(FXObject*,FXSelector,void* PTR_IGNORE);
long onCmdNext(FXObject*,FXSelector,void* PTR_IGNORE);
long onUpdNext(FXObject*,FXSelector,void* PTR_IGNORE);
long onCmdBack(FXObject*,FXSelector,void* PTR_IGNORE);
long onUpdBack(FXObject*,FXSelector,void* PTR_IGNORE);
public:
enum {
ID_NEXT=FXDialogBox::ID_LAST,
ID_BACK,
ID_LAST
};
public:
%extend {
/// Construct free-floating Wizard
FXWizard(FXApp* a,const FXString& name,FXImage *image,FXuint opts=DECOR_TITLE|DECOR_BORDER|DECOR_RESIZE,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=10,FXint pr=10,FXint pt=10,FXint pb=10,FXint hs=10,FXint vs=10){
return new FXRbWizard(a,name,image,opts,x,y,w,h,pl,pr,pt,pb,hs,vs);
}
/// Construct Wizard which will always float over the owner window
FXWizard(FXWindow* owner,const FXString& name,FXImage *image,FXuint opts=DECOR_TITLE|DECOR_BORDER|DECOR_RESIZE,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=10,FXint pr=10,FXint pt=10,FXint pb=10,FXint hs=10,FXint vs=10){
return new FXRbWizard(owner,name,image,opts,x,y,w,h,pl,pr,pt,pb,hs,vs);
}
}
/// Return a pointer to the button frame
FXHorizontalFrame *buttonFrame() const;
/// Return a pointer to the "Advance" button
FXButton *advanceButton() const;
/// Return a pointer to the "Retreat" button
FXButton *retreatButton() const;
/// Return a pointer to the "Finish" button
FXButton *finishButton() const;
/// Return a pointer to the "Cancel" button
FXButton *cancelButton() const;
/// Return the container used as parent for the subpanels
FXSwitcher *getContainer() const;
/// Change the image being displayed
void setImage(FXImage* img);
/// Return the current image
FXImage* getImage() const;
/// Return number of panels
FXint getNumPanels() const;
%extend {
/// Bring the child window at index to the top
void setCurrentPanel(FXint index) {
if(0<=index && index<self->getNumPanels()){
self->setCurrentPanel(index);
}
else{
rb_raise(rb_eIndexError,"panel index %d out of bounds",index);
}
}
}
/// Return the index of the child window currently on top
FXint getCurrentPanel() const;
// Destroy
virtual ~FXWizard();
};
DECLARE_FXOBJECT_VIRTUALS(FXWizard)
DECLARE_FXID_VIRTUALS(FXWizard)
DECLARE_FXDRAWABLE_VIRTUALS(FXWizard)
DECLARE_FXWINDOW_VIRTUALS(FXWizard)
DECLARE_FXTOPWINDOW_VIRTUALS(FXWizard)
DECLARE_FXDIALOGBOX_VIRTUALS(FXWizard)