cave-story-solaris/external/fltk/FL/Fl_Choice.H
Clownacy ac465d29b4 Mean CMake dependency overhaul
I'm taking a page from Dolphin's book, and including copies of each
dependency's source code. This combines the ease of use of including
pre-built libraries instead of needing to navigate a package manager
 - as is (or was) the case for MSVC - with the portability of using
packages. Granted, this method's more of a jack of all trades,
master of none, since it's *less* user-friendly than prebuilt
packages (compilation times), and you don't get the per-distro
compatibility fixes you'd get from a package manager.

You can still use system libs if you want. In fact, it's still the
default behaviour: compiling the libs manually is just a fallback.
I'll add an option to force-enable this soon, however, since it's a
nicer way to produce static MSYS2 builds than the hackish nightmare
that I was using before. Not to mention, having my own copy of the
sources means I can provide my own fixes and tweaks your package
manager may not. For example, I can combine MSYS2's FreeType
subpixel rendering with vcpkg's fix for SDL2 exporting its symbols
in static builds.
2019-04-26 01:52:02 +01:00

106 lines
3.5 KiB
C++

//
// "$Id$"
//
// Choice header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2010 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
// file is missing or damaged, see the license at:
//
// http://www.fltk.org/COPYING.php
//
// Please report all bugs and problems on the following page:
//
// http://www.fltk.org/str.php
//
/* \file
Fl_Choice widget . */
#ifndef Fl_Choice_H
#define Fl_Choice_H
#include "Fl_Menu_.H"
/**
\class Fl_Choice
\brief A button that is used to pop up a menu.
This is a button that, when pushed, pops up a menu (or hierarchy of menus)
defined by an array of Fl_Menu_Item objects.
Motif calls this an OptionButton.
The only difference between this and a Fl_Menu_Button is that the name of
the most recent chosen menu item is displayed inside the box, while the
label is displayed outside the box. However, since the use of this is most
often to control a single variable rather than do individual callbacks,
some of the Fl_Menu_Button methods are redescribed here in those terms.
When the user clicks a menu item, value() is set to that item
and then:
- The item's callback is done if one has been set; the
Fl_Choice is passed as the Fl_Widget* argument,
along with any userdata configured for the callback.
- If the item does not have a callback, the Fl_Choice widget's
callback is done instead, along with any userdata configured
for it. The callback can determine which item was picked using
value(), mvalue(), item_pathname(), etc.
All three mouse buttons pop up the menu. The Forms behavior of the first
two buttons to increment/decrement the choice is not implemented. This
could be added with a subclass, however.
The menu will also pop up in response to shortcuts indicated by putting
a '\&' character in the label(). See Fl_Button::shortcut(int s) for a
description of this.
Typing the shortcut() of any of the items will do exactly the same as when
you pick the item with the mouse. The '\&' character in item names are
only looked at when the menu is popped up, however.
\image html choice.png
\image latex choice.png "Fl_Choice" width=4cm
\todo Refactor the doxygen comments for Fl_Choice changed() documentation.
\li <tt>int Fl_Widget::changed() const</tt>
This value is true the user picks a different value. <em>It is turned
off by value() and just before doing a callback (the callback can turn
it back on if desired).</em>
\li <tt>void Fl_Widget::set_changed()</tt>
This method sets the changed() flag.
\li <tt>void Fl_Widget::clear_changed()</tt>
This method clears the changed() flag.
\li <tt>Fl_Boxtype Fl_Choice::down_box() const</tt>
Gets the current down box, which is used when the menu is popped up.
The default down box type is \c FL_DOWN_BOX.
\li <tt>void Fl_Choice::down_box(Fl_Boxtype b)</tt>
Sets the current down box type to \p b.
*/
class FL_EXPORT Fl_Choice : public Fl_Menu_ {
protected:
void draw();
public:
int handle(int);
Fl_Choice(int X, int Y, int W, int H, const char *L = 0);
/**
Gets the index of the last item chosen by the user.
The index is zero initially.
*/
int value() const {return Fl_Menu_::value();}
int value(int v);
int value(const Fl_Menu_Item* v);
};
#endif
//
// End of "$Id$".
//