luigi.gui
Luigi is an OpenGL based GUI library.
The goal is to provide a simple but flexible way to add a simple
GUI to an OpenGL program.
Luigi supports themes and input adaptors. Themes give you a way
to customize the look of GUI. Input adaptors do the work of
taking events from the OS or from a windowing toolkit like GLD, and
turning them into something Luigi can use.
- class
Luigi
;
- The singleton master object.
Holds GUI globals including the theme, the input adapter, and keeps track
of all the top-level Frames and Overlays.
- static Luigi
opCall
();
- Return the singleton instance
- static Luigi
inst
();
- Return the singleton instance
- Theme
theme
(Theme th);
- Set the
theme
- Theme
theme
();
- Get the current
theme
- void
add_overlay
(Overlay ov);
- Add a top level overlay.
This is called automatically by Overlay, so typically there is no
reason for users to call it themselves.
- Size
get_window_size
(WindowHandle win);
- Returns the size of the specified window
- void
adapter
(InputAdapter inputsys);
- Set the current input
adapter
- InputAdapter
adapter
();
- Get the current input
adapter
- class
Frame
;
- Represents a real OS window used exclusively by Luigi.
If the GUI is drawn on top of the app's GL window, use Overlay instead.
- class
Widget
: luigi.arranger.Arrangeable;
- The base class for any GUI entity that occupies space on the screen.
- Arranger
arranger
();
- Return the
arranger
used to arrange this widget's chilrend
- Arranger
arranger
(Arranger a);
- Set the
arranger
used to arrange this widget's chilren
- Arranger
arranged_by
();
- Return the arranger used to arrange this widget
- Rect
rect
();
- Return the items rectangle.
The rectangle coordinates are relative to the upper left corner of this
widget's parent.
- Widget
parent
();
- Return the
parent
of this item or null if it has no
parent
.
- Widget[]
children
();
- Return the list of items that are parented to this one.
Panels are the base type for all items with
children
.
- void
transform_window_to_widget
(inout Size winp);
- Transforms the given point from window coordinates into
the widget's coordinates. In widget coordinates,
(rect.x,rect.y) is the upper left corner of the widget.
- Widget
next_item
();
- Return the item after this one in the tab traversal order
- Widget
prev_item
();
- Return the item before this one in the tab traversal order
- Widget
get_root
();
- Find the widget at the root of this item's hierarchy
- bool
focused
();
- Returns whether this item has the keyboard focus.
- Widget
get_focus
();
- Finds the keyboard focus of this widget's hierarchy.
- bool
set_focus
(Widget newfocus);
- Sets the keyboard focus of this widget's hierarchy to newfocus.
If newfocus is null any current focus item in this widget tree
will be unfocused.
- bool
focus
();
- Set the keyboard
focus
to this item.
Returns true if successful, false otherwise.
- Widget
focus_next
();
- Moves focus to the next item in this widget's hierarchy, or
to the first item if nothing is currently focused.
Return the newly focused item.
- Widget
focus_prev
();
- Moves focus to the previous item in this widget hierarchy
- protected bool
_can_lose_focus
();
- Used internally before focusing a new item to make sure it's ok for the
current item to lose focus.
- class
Panel
: luigi.gui.Widget;
- The base class for any GUI entity that occupies space on the screen and can
potentially have children.
- Widget
find_item_at_point
(Size pos);
- Find the gui item at the specified point.
The point p is assumed to be in the widget coordinates for this item.
In widget coordinates (rect.x,rect.y) is the upper left corner of this widget.
- class
Overlay
: luigi.gui.Panel;
- Represents a GUI area laid on top of a user's OpenGL window. The overlay always
stretches to cover the full extent of the actual GL window, though actual
layout engine and children determine how much of that area is actually used.
Note:
This usage of the term overlay should not be confused with the hardware
overlays supported by some OpenGL implementations
- this(WindowHandle win = null);
- Constructor. Not every toolkit supports multiple windows (e.g. GLFW,SDL).
If yours doesn't then you may not need the parameter.
- void
draw
();
- Sets up the drawing state for 2D GUI drawing and draws it's children.
- InputAdapter
adapter
();
- Return the input
adapter
in current use. Equivalent to Luigi().
adapter
.
- class
Rollout
: luigi.gui.Panel;
- A Panel with a button at the top to open or close it
- class
Label
: luigi.gui.Widget;
- A simple static text label
- class
Button
: luigi.gui.Widget, luigi.gui.Valuator;
- A classic
Button
widget, with optional toggle button behavior.
- class
Checkbox
: luigi.gui.Button;
- A checkbox is just a toggle button with an alternate theme-defined look.
- alias
CheckBox
;
- An alternate spelling for Checkbox, because I can never remember which it is.
- alias
Textfield
;
- An alternate spelling for TextField, because I can never remember which it is.
- class
Slider
: luigi.gui.Widget, luigi.gui.Valuator;
-
Slider
represents a floating point value. Since it uses a double for
internal representation of the value it can also easily handle integral
numbers as large (larger even) than an int.
The model used for tracking the value is that users can
programmatically set any value they wish using value() and it will
be honored. However manipulations of the value through the UI are
restricted to integer multiples of the precision. Zero is always
attainable via the UI as long as it is between max and min.
- class
RadioButton
: luigi.gui.Button;
- A radio button is just a Button with an alternate appearance
determined by the theme.
- class
RadioGroup
: luigi.gui.Valuator;
-
RadioGroup
is a non-GUI class that implements exclusive selection
behavior using signals.
- void
add
(Button b, int val);
- Have button b join this group, using value val
- void
add
(Button b);
- Add button b to the group, generating an automatic id.
If this is the first item, the 0 is used as the id.
Otherwise the current max id plus one is used.
- void
multiadd
(ButtonOrInt...)(ButtonOrInt buttons);
- Have all the buttons in the parameter list join this group.
If all items are Buttons then call add(Button) to add to the group
using default values. If a button is followed by an integer, then
use that as it's id. For example:
Button b1,b2; Checkbox c1,c2; RadioButton r1,r2;
...
rgroup1.multiadd(b1,b2); // adds with ids 0 and 1.
rgroup2.multiadd(c1,5, c2,10); // adds with ids 5 and 10
rgroup3.multiadd(r1,1, r2); // adds with ids 1 and 2.
- void
remove
(Button b);
- Have button b leave this group
- Button[]
opIndex
(int v);
- Return the Button(s) assocated with the given group value.
- int
opIndex
(Button b);
- Return the group value associated with the given button.
Returns int.min if the item is not found
- int
min_val
();
- Return the minimum value associated with any item in the group.
Returns:
the minimum value or int.max if there are no items.
- int
max_val
();
- Return the maximum value associated with any item in the group.
- class
FlowPanel
: luigi.gui.Panel;
- A basic panel with a built-in FlowArranger
- class
GridPanel
: luigi.gui.Panel;
- A basic panel with a built-in GridArranger
- class
BorderPanel
: luigi.gui.Panel;
- A basic panel with a built-in BorderArranger
|