fltk 1.3.0rc3
About: FLTK (Fast Light Tool Kit) is a cross-platform C++ GUI toolkit for UNIX/Linux (X11), Microsoft Windows, and MacOS X. Release candidate.
  SfR Fresh Dox: fltk-1.3.0rc3-source.tar.gz ("inofficial" and yet experimental doxygen-generated source code documentation)  

Fl_Value_Input Class Reference

#include <Fl_Value_Input.H>

Inheritance diagram for Fl_Value_Input:
Collaboration diagram for Fl_Value_Input:

List of all members.

Public Member Functions

int handle (int)
void resize (int, int, int, int)
 Fl_Value_Input (int x, int y, int w, int h, const char *l=0)
 ~Fl_Value_Input ()
void soft (char s)
char soft () const
int shortcut () const
void shortcut (int s)
Fl_Font textfont () const
void textfont (Fl_Font s)
Fl_Fontsize textsize () const
void textsize (Fl_Fontsize s)
Fl_Color textcolor () const
void textcolor (Fl_Color n)
Fl_Color cursor_color () const
void cursor_color (Fl_Color n)

Public Attributes

Fl_Input input

Protected Member Functions

void draw ()

Detailed Description

The Fl_Value_Input widget displays a numeric value. The user can click in the text field and edit it - there is in fact a hidden Fl_Input widget with type(FL_FLOAT_INPUT) or type(FL_INT_INPUT) in there - and when they hit return or tab the value updates to what they typed and the callback is done.

If step() is non-zero and integral, then the range of numbers is limited to integers instead of floating point numbers. As well as displaying the value as an integer, typed input is also limited to integer values, even if the hidden Fl_Input widget is of type(FL_FLOAT_INPUT).

If step() is non-zero, the user can also drag the mouse across the object and thus slide the value. The left button moves one step() per pixel, the middle by 10 step(), and the right button by 100 * step(). It is therefore impossible to select text by dragging across it, although clicking can still move the insertion cursor.

If step() is non-zero and integral, then the range of numbers are limited to integers instead of floating point values.

Fl_Value_Input.png

Definition at line 65 of file Fl_Value_Input.H.


Constructor & Destructor Documentation

Fl_Value_Input::Fl_Value_Input ( int  X,
int  Y,
int  W,
int  H,
const char *  l = 0 
)

Creates a new Fl_Value_Input widget using the given position, size, and label string. The default boxtype is FL_DOWN_BOX.

Definition at line 125 of file Fl_Value_Input.cxx.

References Fl_Widget::align(), Fl_Widget::box(), Fl_Widget::callback(), Fl_Widget::color(), FL_ALIGN_LEFT, FL_WHEN_CHANGED, input, Fl_Widget::parent(), Fl_Group::remove(), Fl_Widget::selection_color(), Fl_Widget::set_flag(), Fl_Widget::SHORTCUT_LABEL, and Fl_Widget::when().

Fl_Value_Input::~Fl_Value_Input ( )

Definition at line 141 of file Fl_Value_Input.cxx.

References input, and Fl_Widget::parent().


Member Function Documentation

Fl_Color Fl_Value_Input::cursor_color ( ) const [inline]

Gets the color of the text cursor. The text cursor is black by default.

Definition at line 125 of file Fl_Value_Input.H.

void Fl_Value_Input::cursor_color ( Fl_Color  n) [inline]

Sets the color of the text cursor. The text cursor is black by default.

Definition at line 127 of file Fl_Value_Input.H.

void Fl_Value_Input::draw ( ) [protected, virtual]

Draws the widget. Never call this function directly. FLTK will schedule redrawing whenever needed. If your widget must be redrawn as soon as possible, call redraw() instead.

Override this function to draw your own widgets.

If you ever need to call another widget's draw method from within your own draw() method, e.g. for an embedded scrollbar, you can do it (because draw() is virtual) like this:

        Fl_Widget *s = &scroll;         // scroll is an embedded Fl_Scrollbar
        s->draw();                      // calls Fl_Scrollbar::draw()

Implements Fl_Widget.

Definition at line 51 of file Fl_Value_Input.cxx.

References Fl_Widget::box(), Fl_Widget::clear_damage(), Fl_Widget::color(), Fl_Widget::damage(), Fl_Widget::draw(), FL_DAMAGE_ALL, FL_DAMAGE_CHILD, i, input, and Fl_Widget::selection_color().

int Fl_Value_Input::handle ( int  event) [virtual]

Handles the specified event. You normally don't call this method directly, but instead let FLTK do it when the user interacts with the widget.

When implemented in a widget, this function must return 0 if the widget does not use the event or 1 otherwise.

Most of the time, you want to call the inherited handle() method in your overridden method so that you don't short-circuit events that you don't handle. In this last case you should return the callee retval.

Parameters:
[in]eventthe kind of event received
Return values:
0if the event was not used or understood
1if the event was used and can be deleted
See also:
Fl_Event

Reimplemented from Fl_Widget.

Definition at line 71 of file Fl_Value_Input.cxx.

References Fl_Valuator::clamp(), Fl::event_button(), Fl::event_is_click(), Fl::event_x_root(), Fl_Widget_Tracker::exists(), FL_DRAG, FL_FLOAT_INPUT, FL_FOCUS, FL_INT_INPUT, FL_PUSH, FL_RELEASE, FL_SHORTCUT, Fl_Input::handle(), Fl_Valuator::handle_drag(), Fl_Valuator::handle_push(), Fl_Valuator::handle_release(), Fl_Valuator::increment(), input, Fl_Valuator::previous_value(), Fl_Valuator::round(), soft(), Fl_Valuator::softclamp(), Fl_Valuator::step(), Fl_Widget::take_focus(), Fl_Widget::type(), Fl_Valuator::value(), and Fl_Widget::when().

void Fl_Value_Input::resize ( int  x,
int  y,
int  w,
int  h 
) [virtual]

Changes the size or position of the widget.

This is a virtual function so that the widget may implement its own handling of resizing. The default version does not call the redraw() method, but instead relies on the parent widget to do so because the parent may know a faster way to update the display, such as scrolling from the old position.

Some window managers under X11 call resize() a lot more often than needed. Please verify that the position or size of a widget did actually change before doing any extensive calculations.

position(X, Y) is a shortcut for resize(X, Y, w(), h()), and size(W, H) is a shortcut for resize(x(), y(), W, H).

Parameters:
[in]x,ynew position relative to the parent window
[in]w,hnew size
See also:
position(int,int), size(int,int)

Reimplemented from Fl_Widget.

Definition at line 59 of file Fl_Value_Input.cxx.

References input, and Fl_Input_::resize().

int Fl_Value_Input::shortcut ( ) const [inline]

The first form returns the current shortcut key for the Input.

The second form sets the shortcut key to key. Setting this overrides the use of '&' in the label(). The value is a bitwise OR of a key and a set of shift flags, for example FL_ALT | 'a' , FL_ALT | (FL_F + 10), or just 'a'. A value of 0 disables the shortcut.

The key can be any value returned by Fl::event_key(), but will usually be an ASCII letter. Use a lower-case letter unless you require the shift key to be held down.

The shift flags can be any set of values accepted by Fl::event_state(). If the bit is on that shift key must be pushed. Meta, Alt, Ctrl, and Shift must be off if they are not in the shift flags (zero for the other bits indicates a "don't care" setting).

Definition at line 108 of file Fl_Value_Input.H.

Referenced by Fl_Widget_Type::copy_properties(), shortcut_in_cb(), and Fl_Widget_Type::write_properties().

void Fl_Value_Input::shortcut ( int  s) [inline]

See int Fl_Value_Input::shortcut() const

Definition at line 110 of file Fl_Value_Input.H.

void Fl_Value_Input::soft ( char  s) [inline]

See void Fl_Value_Input::soft(char s)

Definition at line 84 of file Fl_Value_Input.H.

char Fl_Value_Input::soft ( ) const [inline]

If "soft" is turned on, the user is allowed to drag the value outside the range. If they drag the value to one of the ends, let go, then grab again and continue to drag, they can get to any value. The default is true.

Definition at line 91 of file Fl_Value_Input.H.

Referenced by handle().

void Fl_Value_Input::textcolor ( Fl_Color  n) [inline]

Sets the color of the text in the value box.

Definition at line 123 of file Fl_Value_Input.H.

Fl_Color Fl_Value_Input::textcolor ( ) const [inline]

Gets the color of the text in the value box.

Definition at line 121 of file Fl_Value_Input.H.

Referenced by Fl_Value_Input_Type::textstuff().

void Fl_Value_Input::textfont ( Fl_Font  s) [inline]

Sets the typeface of the text in the value box.

Definition at line 115 of file Fl_Value_Input.H.

Fl_Font Fl_Value_Input::textfont ( ) const [inline]

Gets the typeface of the text in the value box.

Definition at line 113 of file Fl_Value_Input.H.

Referenced by Fl_Value_Input_Type::ideal_size(), and Fl_Value_Input_Type::textstuff().

Fl_Fontsize Fl_Value_Input::textsize ( ) const [inline]

Gets the size of the text in the value box.

Definition at line 117 of file Fl_Value_Input.H.

Referenced by Fl_Value_Input_Type::ideal_size(), make_widget_panel(), and Fl_Value_Input_Type::textstuff().

void Fl_Value_Input::textsize ( Fl_Fontsize  s) [inline]

Sets the size of the text in the value box.

Definition at line 119 of file Fl_Value_Input.H.


Member Data Documentation


The documentation for this class was generated from the following files: