fidgit 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +7 -7
- data/.rspec +2 -2
- data/CHANGELOG.md +30 -30
- data/Gemfile +3 -3
- data/LICENSE.txt +19 -19
- data/README.textile +139 -139
- data/Rakefile +37 -37
- data/config/default_schema.yml +216 -216
- data/examples/_all_examples.rb +9 -9
- data/examples/align_example.rb +55 -55
- data/examples/button_and_toggle_button_example.rb +37 -37
- data/examples/color_picker_example.rb +16 -16
- data/examples/color_well_example.rb +24 -24
- data/examples/combo_box_example.rb +23 -23
- data/examples/file_dialog_example.rb +41 -41
- data/examples/grid_packer_example.rb +28 -28
- data/examples/helpers/example_window.rb +16 -16
- data/examples/label_example.rb +22 -22
- data/examples/list_example.rb +22 -22
- data/examples/menu_pane_example.rb +26 -26
- data/examples/message_dialog_example.rb +64 -64
- data/examples/radio_button_example.rb +36 -36
- data/examples/readme_example.rb +31 -31
- data/examples/scroll_window_example.rb +48 -48
- data/examples/slider_example.rb +33 -33
- data/examples/splash_example.rb +41 -41
- data/examples/text_area_example.rb +32 -32
- data/fidgit.gemspec +35 -35
- data/lib/fidgit.rb +50 -50
- data/lib/fidgit/chingu_ext/window.rb +5 -5
- data/lib/fidgit/cursor.rb +37 -37
- data/lib/fidgit/elements/button.rb +112 -112
- data/lib/fidgit/elements/color_picker.rb +62 -62
- data/lib/fidgit/elements/color_well.rb +38 -38
- data/lib/fidgit/elements/combo_box.rb +113 -113
- data/lib/fidgit/elements/composite.rb +16 -16
- data/lib/fidgit/elements/container.rb +208 -208
- data/lib/fidgit/elements/element.rb +297 -297
- data/lib/fidgit/elements/file_browser.rb +151 -151
- data/lib/fidgit/elements/grid.rb +226 -226
- data/lib/fidgit/elements/group.rb +64 -64
- data/lib/fidgit/elements/horizontal.rb +11 -11
- data/lib/fidgit/elements/image_frame.rb +64 -64
- data/lib/fidgit/elements/label.rb +84 -84
- data/lib/fidgit/elements/list.rb +46 -46
- data/lib/fidgit/elements/main_packer.rb +24 -24
- data/lib/fidgit/elements/menu_pane.rb +160 -160
- data/lib/fidgit/elements/packer.rb +41 -41
- data/lib/fidgit/elements/radio_button.rb +85 -85
- data/lib/fidgit/elements/scroll_area.rb +67 -67
- data/lib/fidgit/elements/scroll_bar.rb +127 -127
- data/lib/fidgit/elements/scroll_window.rb +82 -82
- data/lib/fidgit/elements/slider.rb +124 -124
- data/lib/fidgit/elements/text_area.rb +493 -493
- data/lib/fidgit/elements/text_line.rb +91 -91
- data/lib/fidgit/elements/toggle_button.rb +66 -66
- data/lib/fidgit/elements/tool_tip.rb +34 -34
- data/lib/fidgit/elements/vertical.rb +11 -11
- data/lib/fidgit/event.rb +158 -158
- data/lib/fidgit/gosu_ext/color.rb +135 -135
- data/lib/fidgit/gosu_ext/gosu_module.rb +24 -24
- data/lib/fidgit/history.rb +90 -90
- data/lib/fidgit/redirector.rb +82 -82
- data/lib/fidgit/schema.rb +123 -123
- data/lib/fidgit/selection.rb +105 -105
- data/lib/fidgit/standard_ext/hash.rb +20 -20
- data/lib/fidgit/states/dialog_state.rb +51 -51
- data/lib/fidgit/states/file_dialog.rb +24 -24
- data/lib/fidgit/states/gui_state.rb +329 -329
- data/lib/fidgit/states/message_dialog.rb +60 -60
- data/lib/fidgit/version.rb +4 -4
- data/lib/fidgit/window.rb +19 -19
- data/spec/fidgit/elements/helpers/helper.rb +2 -2
- data/spec/fidgit/elements/helpers/tex_play_helper.rb +8 -8
- data/spec/fidgit/elements/image_frame_spec.rb +68 -68
- data/spec/fidgit/elements/label_spec.rb +36 -36
- data/spec/fidgit/event_spec.rb +209 -209
- data/spec/fidgit/gosu_ext/color_spec.rb +129 -129
- data/spec/fidgit/gosu_ext/helpers/helper.rb +2 -2
- data/spec/fidgit/helpers/helper.rb +3 -3
- data/spec/fidgit/history_spec.rb +153 -153
- data/spec/fidgit/redirector_spec.rb +77 -77
- data/spec/fidgit/schema_spec.rb +66 -66
- data/spec/fidgit/schema_test.yml +32 -32
- metadata +67 -22
data/.gitignore
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
pkg/*
|
2
|
-
*.gem
|
3
|
-
.bundle
|
4
|
-
Gemfile.lock
|
5
|
-
doc/
|
6
|
-
.yardoc
|
7
|
-
README.html
|
1
|
+
pkg/*
|
2
|
+
*.gem
|
3
|
+
.bundle
|
4
|
+
Gemfile.lock
|
5
|
+
doc/
|
6
|
+
.yardoc
|
7
|
+
README.html
|
8
8
|
.idea/
|
data/.rspec
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
--colour
|
2
|
-
--format documentation
|
1
|
+
--colour
|
2
|
+
--format documentation
|
data/CHANGELOG.md
CHANGED
@@ -1,31 +1,31 @@
|
|
1
|
-
Fidgit changelog
|
2
|
-
================
|
3
|
-
|
4
|
-
v0.2.3
|
5
|
-
------
|
6
|
-
|
7
|
-
* Exposed #handle accessor for Slider.
|
8
|
-
* Made Slider accept being disabled.
|
9
|
-
* Made Slider handle show tip.
|
10
|
-
|
11
|
-
v0.2.2
|
12
|
-
------
|
13
|
-
|
14
|
-
* Prevented ToggleButton border colour changing.
|
15
|
-
* More careful about stripping out html tags in TextArea.
|
16
|
-
|
17
|
-
v0.2.1
|
18
|
-
------
|
19
|
-
|
20
|
-
* Added: Click in ScrollBar gutter to scroll window by height/width of view window.
|
21
|
-
* Added: Click and drag to select text in enabled TextArea.
|
22
|
-
* Fixed: Color changes on disabling buttons.
|
23
|
-
|
24
|
-
v0.2.0
|
25
|
-
------
|
26
|
-
|
27
|
-
* Added editable attribute to TextArea (Allows selection, but not alteration).
|
28
|
-
* Added Element#font= and :font option.
|
29
|
-
* Added Gosu::Color#colorize to use when using in-line text styling.
|
30
|
-
* Managed layout of entities and XML tags (Used by Gosu) in TextArea text better (tags still don't like newlines inside them).
|
1
|
+
Fidgit changelog
|
2
|
+
================
|
3
|
+
|
4
|
+
v0.2.3
|
5
|
+
------
|
6
|
+
|
7
|
+
* Exposed #handle accessor for Slider.
|
8
|
+
* Made Slider accept being disabled.
|
9
|
+
* Made Slider handle show tip.
|
10
|
+
|
11
|
+
v0.2.2
|
12
|
+
------
|
13
|
+
|
14
|
+
* Prevented ToggleButton border colour changing.
|
15
|
+
* More careful about stripping out html tags in TextArea.
|
16
|
+
|
17
|
+
v0.2.1
|
18
|
+
------
|
19
|
+
|
20
|
+
* Added: Click in ScrollBar gutter to scroll window by height/width of view window.
|
21
|
+
* Added: Click and drag to select text in enabled TextArea.
|
22
|
+
* Fixed: Color changes on disabling buttons.
|
23
|
+
|
24
|
+
v0.2.0
|
25
|
+
------
|
26
|
+
|
27
|
+
* Added editable attribute to TextArea (Allows selection, but not alteration).
|
28
|
+
* Added Element#font= and :font option.
|
29
|
+
* Added Gosu::Color#colorize to use when using in-line text styling.
|
30
|
+
* Managed layout of entities and XML tags (Used by Gosu) in TextArea text better (tags still don't like newlines inside them).
|
31
31
|
* Changed license from LGPL to MIT.
|
data/Gemfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
source "http://rubygems.org"
|
2
|
-
|
3
|
-
# Specify your gem's dependencies in fidgit.gemspec
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in fidgit.gemspec
|
4
4
|
gemspec
|
data/LICENSE.txt
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
Copyright (c) 2012 Bil Bas (Spooner)
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
1
|
+
Copyright (c) 2012 Bil Bas (Spooner)
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
20
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.textile
CHANGED
@@ -1,139 +1,139 @@
|
|
1
|
-
h1. Fidgit
|
2
|
-
|
3
|
-
Fidgit is a GUI framework built on "Gosu":http://libgosu.org/ and "Chingu":http://ippa.se/chingu
|
4
|
-
|
5
|
-
|
6
|
-
h2. Description
|
7
|
-
|
8
|
-
The API is inspired by "Shoes":http://shoesrb.com/, but since Shoes is very simplistic, the level of functionality is
|
9
|
-
based around "FXRuby":http://www.fxruby.org/ and other GUI APIs.
|
10
|
-
Fidgit was originally developed as a part of the Sidney game, but as it got more complex, it was obvious it would be
|
11
|
-
useful to separate them.
|
12
|
-
|
13
|
-
_WARNING: THIS PROJECT IS IN EARLY ALPHA DEVELOPMENT AND THE API IS LIABLE TO CONTINUOUS CHANGE AND IT IS QUITE UNSTABLE!_
|
14
|
-
|
15
|
-
Read the Yard documentation at "rubydoc.info":http://rubydoc.info/github/Spooner/fidgit/master
|
16
|
-
|
17
|
-
h2. Aim
|
18
|
-
|
19
|
-
Fidgit aims to be a toolkit which will provide the building blocks to quickly create a GUI either for a GUI-based game
|
20
|
-
or for options screens and menus within a regular Gosu game.
|
21
|
-
|
22
|
-
h2. License
|
23
|
-
|
24
|
-
MIT (see COPYING.txt)
|
25
|
-
|
26
|
-
h2. Requirements
|
27
|
-
|
28
|
-
* Ruby 1.9.2 (sorry, I'm lazy!).
|
29
|
-
* Gosu gem 0.7.27.1 ("gem install gosu")
|
30
|
-
** "Installing Gosu dependencies on Linux":http://code.google.com/p/gosu/wiki/GettingStartedOnLinux (On Win32 and OS X there are binary gems available)
|
31
|
-
* Chingu gem 0.9rc4 ("gem install chingu --pre").
|
32
|
-
|
33
|
-
h2. Example
|
34
|
-
|
35
|
-
<pre># examples/readme_example.rb
|
36
|
-
require 'fidgit'
|
37
|
-
|
38
|
-
class MyGame < Chingu::Window
|
39
|
-
def initialize
|
40
|
-
super(640, 480, false)
|
41
|
-
|
42
|
-
# To use the Fidgit features, a Fidgit::GuiState must be active.
|
43
|
-
push_game_state MyGuiState
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
class MyGuiState < Fidgit::GuiState
|
48
|
-
def initialize
|
49
|
-
super
|
50
|
-
|
51
|
-
# Create a vertically packed section, centred in the window.
|
52
|
-
vertical align: :center do
|
53
|
-
# Create a label with a dark green background.
|
54
|
-
my_label = label "Hello world!", background_color: Gosu::Color.rgb(0, 100, 0)
|
55
|
-
|
56
|
-
# Create a button that, when clicked, changes the label.
|
57
|
-
button("Goodbye", align_h: :center, tip: "Press me and be done with it!") do
|
58
|
-
my_label.text = "Goodbye cruel world!"
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
MyGame.new.show
|
65
|
-
</pre>
|
66
|
-
|
67
|
-
|
68
|
-
h2. API
|
69
|
-
|
70
|
-
As well as a cursor and tool-tips that are managed by the GuiState for you, there are several elements you can use inside your GuiState.
|
71
|
-
|
72
|
-
Elements are best added by using simple methods (listed below). Most of these method accept a block, some offering access to public methods of the element and others being default event handlers.
|
73
|
-
|
74
|
-
The GuiState itself only accepts #vertical/#horizontal/#grid, but any packer or group accepts any other element method.
|
75
|
-
|
76
|
-
h3. GuiState methods
|
77
|
-
|
78
|
-
* _pack([:vertical|:horizontal|:grid], ...)_ - Add a packer to the state (Block has access to public methods).
|
79
|
-
* _clear()_ - remove any packers added to the state.
|
80
|
-
* _menu(...)_ - Show a context menu (Block has access to public methods).
|
81
|
-
** _item(text, value, ...)_ - Item in a menu (Block handles :clicked_left_mouse_button event).
|
82
|
-
** _separator(...)_ - A horizontal separator between menu items.
|
83
|
-
* _message(text, ...)_ - Show a message box with button(s) (Block subscribes to a button getting clicked).
|
84
|
-
* _file_dialog([:open, :save], ...)_ - Open a file dialog to load or save a file (Block is passed the button pressed and the file path set).
|
85
|
-
|
86
|
-
h3. Container methods
|
87
|
-
|
88
|
-
h4. Arrangement managers
|
89
|
-
|
90
|
-
Fidgit uses automatic packers to manage layout.
|
91
|
-
|
92
|
-
* _pack([:vertical|:horizontal|:grid], ...)_ - Packer that packs its component elements (Block has access to public methods).
|
93
|
-
* _group(...)_ - Manages any groupable elements put inside it, such as radio-buttons (Block has access to public methods). Best to subscribe to :changed event handler.
|
94
|
-
* _scroll_window(...)_ - A window having content larger than what is shown, scrolled with scroll-bars (Block has access to public methods of the contents packer)
|
95
|
-
|
96
|
-
h4. Elements
|
97
|
-
|
98
|
-
Elements can be placed inside a packer or group.
|
99
|
-
|
100
|
-
* _button(text, ...)_ - Button with text and/or icon (Block handles :clicked_left_mouse_button event).
|
101
|
-
* _color_picker(...)_ - Red, green and blue sliders and colour indicator (Block handles :changed event).
|
102
|
-
* _image_frame(image, ...)_ - Wrapper around a Gosu::Image to embed it in the GUI.
|
103
|
-
* _label(text, ...)_ - Label with text and, optionally, an icon (No block accepted).
|
104
|
-
* _slider(...)_ - Horizontal slider with handle (Block handles :changed event).
|
105
|
-
* _text_area(...)_ - An multi-line element, containing editable text (Block handles :changed event).
|
106
|
-
* _toggle_button(text, ...)_ - Button that can be toggled on/off (Block handles :changed event).
|
107
|
-
|
108
|
-
h5. Groupable elements
|
109
|
-
|
110
|
-
These should be placed within a group (directly or indirectly) and only one of them will be selected. The group manages which one is selected.
|
111
|
-
|
112
|
-
* _color_well(color, ...)_ - A radio-button used to pick a colour (Block handles :clicked_left_mouse_button event).
|
113
|
-
* _radio_button(text, value, ...)_ - Button that is part of a group (Block handles :clicked_left_mouse_button event).
|
114
|
-
|
115
|
-
h5. Compound elements
|
116
|
-
|
117
|
-
These elements contain items, which can easily be added from within a block passed to them. One can subscribe to the :changed event, which is usually easier than managing each item separately.
|
118
|
-
|
119
|
-
* _combo_box(...)_ - Button that has a drop-down menu attached (Block has access to public methods).
|
120
|
-
** _item(text, value, ...)_ - Add an item to a combo box (Block handles :clicked_left_mouse_button event).
|
121
|
-
* _list(...)_ - A vertical list of items to select from (Block has access to public methods).
|
122
|
-
** _item(text, value, ...)_ - Add an item to a combo box (Block handles :clicked_left_mouse_button event).
|
123
|
-
|
124
|
-
|
125
|
-
h2. Alternative GUI frameworks
|
126
|
-
|
127
|
-
There are two other GUI tool-kits that work with Gosu:
|
128
|
-
|
129
|
-
* "Rubygoo":http://code.google.com/p/rubygoo/
|
130
|
-
** Additionally supports "Rubygame":http://rubygame.org/ (as well as Gosu).
|
131
|
-
** Only simple widgets are implemented.
|
132
|
-
** No longer supported.
|
133
|
-
|
134
|
-
* "GGLib":http://code.google.com/p/gglib/ (Gosu GUI Library)
|
135
|
-
** Pretty graphical themes.
|
136
|
-
** Only simple widgets are implemented.
|
137
|
-
** No longer supported (though author has commented that they would like to pick it up again).
|
138
|
-
|
139
|
-
Remember that if you primarily want a GUI for your GUI application, not just a GUI in your Gosu game, consider using a dedicated GUI tool-kit, such as "Shoes":http://shoesrb.com/, "FXRuby":http://www.fxruby.org/ or "wxRuby":http://wxruby.rubyforge.org/
|
1
|
+
h1. Fidgit
|
2
|
+
|
3
|
+
Fidgit is a GUI framework built on "Gosu":http://libgosu.org/ and "Chingu":http://ippa.se/chingu
|
4
|
+
|
5
|
+
|
6
|
+
h2. Description
|
7
|
+
|
8
|
+
The API is inspired by "Shoes":http://shoesrb.com/, but since Shoes is very simplistic, the level of functionality is
|
9
|
+
based around "FXRuby":http://www.fxruby.org/ and other GUI APIs.
|
10
|
+
Fidgit was originally developed as a part of the Sidney game, but as it got more complex, it was obvious it would be
|
11
|
+
useful to separate them.
|
12
|
+
|
13
|
+
_WARNING: THIS PROJECT IS IN EARLY ALPHA DEVELOPMENT AND THE API IS LIABLE TO CONTINUOUS CHANGE AND IT IS QUITE UNSTABLE!_
|
14
|
+
|
15
|
+
Read the Yard documentation at "rubydoc.info":http://rubydoc.info/github/Spooner/fidgit/master
|
16
|
+
|
17
|
+
h2. Aim
|
18
|
+
|
19
|
+
Fidgit aims to be a toolkit which will provide the building blocks to quickly create a GUI either for a GUI-based game
|
20
|
+
or for options screens and menus within a regular Gosu game.
|
21
|
+
|
22
|
+
h2. License
|
23
|
+
|
24
|
+
MIT (see COPYING.txt)
|
25
|
+
|
26
|
+
h2. Requirements
|
27
|
+
|
28
|
+
* Ruby 1.9.2 (sorry, I'm lazy!).
|
29
|
+
* Gosu gem 0.7.27.1 ("gem install gosu")
|
30
|
+
** "Installing Gosu dependencies on Linux":http://code.google.com/p/gosu/wiki/GettingStartedOnLinux (On Win32 and OS X there are binary gems available)
|
31
|
+
* Chingu gem 0.9rc4 ("gem install chingu --pre").
|
32
|
+
|
33
|
+
h2. Example
|
34
|
+
|
35
|
+
<pre># examples/readme_example.rb
|
36
|
+
require 'fidgit'
|
37
|
+
|
38
|
+
class MyGame < Chingu::Window
|
39
|
+
def initialize
|
40
|
+
super(640, 480, false)
|
41
|
+
|
42
|
+
# To use the Fidgit features, a Fidgit::GuiState must be active.
|
43
|
+
push_game_state MyGuiState
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
class MyGuiState < Fidgit::GuiState
|
48
|
+
def initialize
|
49
|
+
super
|
50
|
+
|
51
|
+
# Create a vertically packed section, centred in the window.
|
52
|
+
vertical align: :center do
|
53
|
+
# Create a label with a dark green background.
|
54
|
+
my_label = label "Hello world!", background_color: Gosu::Color.rgb(0, 100, 0)
|
55
|
+
|
56
|
+
# Create a button that, when clicked, changes the label.
|
57
|
+
button("Goodbye", align_h: :center, tip: "Press me and be done with it!") do
|
58
|
+
my_label.text = "Goodbye cruel world!"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
MyGame.new.show
|
65
|
+
</pre>
|
66
|
+
|
67
|
+
|
68
|
+
h2. API
|
69
|
+
|
70
|
+
As well as a cursor and tool-tips that are managed by the GuiState for you, there are several elements you can use inside your GuiState.
|
71
|
+
|
72
|
+
Elements are best added by using simple methods (listed below). Most of these method accept a block, some offering access to public methods of the element and others being default event handlers.
|
73
|
+
|
74
|
+
The GuiState itself only accepts #vertical/#horizontal/#grid, but any packer or group accepts any other element method.
|
75
|
+
|
76
|
+
h3. GuiState methods
|
77
|
+
|
78
|
+
* _pack([:vertical|:horizontal|:grid], ...)_ - Add a packer to the state (Block has access to public methods).
|
79
|
+
* _clear()_ - remove any packers added to the state.
|
80
|
+
* _menu(...)_ - Show a context menu (Block has access to public methods).
|
81
|
+
** _item(text, value, ...)_ - Item in a menu (Block handles :clicked_left_mouse_button event).
|
82
|
+
** _separator(...)_ - A horizontal separator between menu items.
|
83
|
+
* _message(text, ...)_ - Show a message box with button(s) (Block subscribes to a button getting clicked).
|
84
|
+
* _file_dialog([:open, :save], ...)_ - Open a file dialog to load or save a file (Block is passed the button pressed and the file path set).
|
85
|
+
|
86
|
+
h3. Container methods
|
87
|
+
|
88
|
+
h4. Arrangement managers
|
89
|
+
|
90
|
+
Fidgit uses automatic packers to manage layout.
|
91
|
+
|
92
|
+
* _pack([:vertical|:horizontal|:grid], ...)_ - Packer that packs its component elements (Block has access to public methods).
|
93
|
+
* _group(...)_ - Manages any groupable elements put inside it, such as radio-buttons (Block has access to public methods). Best to subscribe to :changed event handler.
|
94
|
+
* _scroll_window(...)_ - A window having content larger than what is shown, scrolled with scroll-bars (Block has access to public methods of the contents packer)
|
95
|
+
|
96
|
+
h4. Elements
|
97
|
+
|
98
|
+
Elements can be placed inside a packer or group.
|
99
|
+
|
100
|
+
* _button(text, ...)_ - Button with text and/or icon (Block handles :clicked_left_mouse_button event).
|
101
|
+
* _color_picker(...)_ - Red, green and blue sliders and colour indicator (Block handles :changed event).
|
102
|
+
* _image_frame(image, ...)_ - Wrapper around a Gosu::Image to embed it in the GUI.
|
103
|
+
* _label(text, ...)_ - Label with text and, optionally, an icon (No block accepted).
|
104
|
+
* _slider(...)_ - Horizontal slider with handle (Block handles :changed event).
|
105
|
+
* _text_area(...)_ - An multi-line element, containing editable text (Block handles :changed event).
|
106
|
+
* _toggle_button(text, ...)_ - Button that can be toggled on/off (Block handles :changed event).
|
107
|
+
|
108
|
+
h5. Groupable elements
|
109
|
+
|
110
|
+
These should be placed within a group (directly or indirectly) and only one of them will be selected. The group manages which one is selected.
|
111
|
+
|
112
|
+
* _color_well(color, ...)_ - A radio-button used to pick a colour (Block handles :clicked_left_mouse_button event).
|
113
|
+
* _radio_button(text, value, ...)_ - Button that is part of a group (Block handles :clicked_left_mouse_button event).
|
114
|
+
|
115
|
+
h5. Compound elements
|
116
|
+
|
117
|
+
These elements contain items, which can easily be added from within a block passed to them. One can subscribe to the :changed event, which is usually easier than managing each item separately.
|
118
|
+
|
119
|
+
* _combo_box(...)_ - Button that has a drop-down menu attached (Block has access to public methods).
|
120
|
+
** _item(text, value, ...)_ - Add an item to a combo box (Block handles :clicked_left_mouse_button event).
|
121
|
+
* _list(...)_ - A vertical list of items to select from (Block has access to public methods).
|
122
|
+
** _item(text, value, ...)_ - Add an item to a combo box (Block handles :clicked_left_mouse_button event).
|
123
|
+
|
124
|
+
|
125
|
+
h2. Alternative GUI frameworks
|
126
|
+
|
127
|
+
There are two other GUI tool-kits that work with Gosu:
|
128
|
+
|
129
|
+
* "Rubygoo":http://code.google.com/p/rubygoo/
|
130
|
+
** Additionally supports "Rubygame":http://rubygame.org/ (as well as Gosu).
|
131
|
+
** Only simple widgets are implemented.
|
132
|
+
** No longer supported.
|
133
|
+
|
134
|
+
* "GGLib":http://code.google.com/p/gglib/ (Gosu GUI Library)
|
135
|
+
** Pretty graphical themes.
|
136
|
+
** Only simple widgets are implemented.
|
137
|
+
** No longer supported (though author has commented that they would like to pick it up again).
|
138
|
+
|
139
|
+
Remember that if you primarily want a GUI for your GUI application, not just a GUI in your Gosu game, consider using a dedicated GUI tool-kit, such as "Shoes":http://shoesrb.com/, "FXRuby":http://www.fxruby.org/ or "wxRuby":http://wxruby.rubyforge.org/
|
data/Rakefile
CHANGED
@@ -1,38 +1,38 @@
|
|
1
|
-
require 'bundler'
|
2
|
-
Bundler::GemHelper.install_tasks
|
3
|
-
|
4
|
-
require 'yard'
|
5
|
-
require 'redcloth'
|
6
|
-
|
7
|
-
README_HTML = "README.html"
|
8
|
-
README_TEXTILE = "README.textile"
|
9
|
-
|
10
|
-
class EventHandlesHandler < YARD::Handlers::Ruby::Base
|
11
|
-
handles method_call(:handles)
|
12
|
-
|
13
|
-
def process
|
14
|
-
klass = statement.parent.parent.jump(:const)[0]
|
15
|
-
name = statement.method_name(true)
|
16
|
-
params = statement.parameters(false).dup
|
17
|
-
puts "Processing Event method: #{klass}.#{name} :#{params[0].jump(:ident)[0]}"
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
|
22
|
-
YARD::Rake::YardocTask.new
|
23
|
-
task :yard => README_HTML
|
24
|
-
|
25
|
-
desc "Convert readme to HTML"
|
26
|
-
file README_HTML => :readme
|
27
|
-
task :readme => README_TEXTILE do
|
28
|
-
puts "Converting readme to HTML"
|
29
|
-
File.open(README_HTML, "w") do |file|
|
30
|
-
file.write RedCloth.new(File.read(README_TEXTILE)).to_html
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
# Specs
|
35
|
-
desc "Run rspec 2.0"
|
36
|
-
task :rspec do
|
37
|
-
system "rspec spec"
|
1
|
+
require 'bundler'
|
2
|
+
Bundler::GemHelper.install_tasks
|
3
|
+
|
4
|
+
require 'yard'
|
5
|
+
require 'redcloth'
|
6
|
+
|
7
|
+
README_HTML = "README.html"
|
8
|
+
README_TEXTILE = "README.textile"
|
9
|
+
|
10
|
+
class EventHandlesHandler < YARD::Handlers::Ruby::Base
|
11
|
+
handles method_call(:handles)
|
12
|
+
|
13
|
+
def process
|
14
|
+
klass = statement.parent.parent.jump(:const)[0]
|
15
|
+
name = statement.method_name(true)
|
16
|
+
params = statement.parameters(false).dup
|
17
|
+
puts "Processing Event method: #{klass}.#{name} :#{params[0].jump(:ident)[0]}"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
YARD::Rake::YardocTask.new
|
23
|
+
task :yard => README_HTML
|
24
|
+
|
25
|
+
desc "Convert readme to HTML"
|
26
|
+
file README_HTML => :readme
|
27
|
+
task :readme => README_TEXTILE do
|
28
|
+
puts "Converting readme to HTML"
|
29
|
+
File.open(README_HTML, "w") do |file|
|
30
|
+
file.write RedCloth.new(File.read(README_TEXTILE)).to_html
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# Specs
|
35
|
+
desc "Run rspec 2.0"
|
36
|
+
task :rspec do
|
37
|
+
system "rspec spec"
|
38
38
|
end
|