2 // "$Id: Fl_Wizard.cxx 7903 2010-11-28 21:06:39Z matt $"
4 // Fl_Wizard widget routines.
6 // Copyright 1997-2010 by Easy Software Products.
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Library General Public
10 // License as published by the Free Software Foundation; either
11 // version 2 of the License, or (at your option) any later version.
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Library General Public License for more details.
18 // You should have received a copy of the GNU Library General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23 // Please report all bugs and problems on the following page:
25 // http://www.fltk.org/str.php
30 // Fl_Wizard::Fl_Wizard() - Create an Fl_Wizard widget.
31 // Fl_Wizard::draw() - Draw the wizard border and visible child.
32 // Fl_Wizard::next() - Show the next child.
33 // Fl_Wizard::prev() - Show the previous child.
34 // Fl_Wizard::value() - Return the current visible child.
35 // Fl_Wizard::value() - Set the visible child.
39 // Include necessary header files...
42 #include <FL/Fl_Wizard.H>
43 #include <FL/Fl_Window.H>
44 #include <FL/fl_draw.H>
48 // 'Fl_Wizard::Fl_Wizard()' - Create an Fl_Wizard widget.
52 The constructor creates the Fl_Wizard widget at the specified
54 <P>The inherited destructor destroys the widget and its children.
56 Fl_Wizard::Fl_Wizard(int xx
, // I - Lefthand position
57 int yy
, // I - Upper position
60 const char *l
) : // I - Label
61 Fl_Group(xx
, yy
, ww
, hh
, l
)
65 value_
= (Fl_Widget
*)0;
70 /** Draws the wizard border and visible child. */
71 void Fl_Wizard::draw() {
72 Fl_Widget
*kid
; // Visible child
77 if (damage() & FL_DAMAGE_ALL
)
79 // Redraw everything...
82 draw_box(box(), x(), y(), w(), h(), kid
->color());
86 draw_box(box(), x(), y(), w(), h(), color());
95 This method shows the next child of the wizard. If the last child
96 is already visible, this function does nothing.
98 void Fl_Wizard::next() {
100 Fl_Widget
* const *kids
;
103 if ((num_kids
= children()) == 0)
106 for (kids
= array(); num_kids
> 0; kids
++, num_kids
--)
107 if ((*kids
)->visible())
114 /** Shows the previous child.*/
115 void Fl_Wizard::prev()
118 Fl_Widget
* const *kids
;
121 if ((num_kids
= children()) == 0)
124 for (kids
= array(); num_kids
> 0; kids
++, num_kids
--)
125 if ((*kids
)->visible())
128 if (num_kids
> 0 && num_kids
< children())
132 /** Gets the current visible child widget. */
133 Fl_Widget
* Fl_Wizard::value()
136 Fl_Widget
* const *kids
;
140 if ((num_kids
= children()) == 0)
141 return ((Fl_Widget
*)0);
143 for (kids
= array(), kid
= (Fl_Widget
*)0; num_kids
> 0; kids
++, num_kids
--)
145 if ((*kids
)->visible())
164 /** Sets the child widget that is visible.*/
165 void Fl_Wizard::value(Fl_Widget
*kid
)
168 Fl_Widget
* const *kids
;
171 if ((num_kids
= children()) == 0)
174 for (kids
= array(); num_kids
> 0; kids
++, num_kids
--)
185 // This will restore the mouse pointer to the window's default cursor
186 // whenever the wizard pane is changed. Otherwise text widgets that
187 // show the next pane may leave the cursor set to the I beam, etc...
188 if (window()) window()->cursor(FL_CURSOR_DEFAULT
);
194 // End of "$Id: Fl_Wizard.cxx 7903 2010-11-28 21:06:39Z matt $".