fox_paradise 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +101 -0
- data/doc/README.gen +75 -0
- data/doc/SNIPPETS.md +161 -0
- data/doc/TODO.md +3 -0
- data/fox_paradise.gemspec +44 -0
- data/lib/fox_paradise/admin_panel/admin_panel.rb +87 -0
- data/lib/fox_paradise/autoinitialize.rb +7 -0
- data/lib/fox_paradise/examples/001_hello_world.rb +19 -0
- data/lib/fox_paradise/examples/002_simple_window.rb +15 -0
- data/lib/fox_paradise/examples/003_tool_tip_example.rb +15 -0
- data/lib/fox_paradise/examples/004_show_this_image.rb +26 -0
- data/lib/fox_paradise/examples/005_two_buttons_in_a_resizable_panel.rb +49 -0
- data/lib/fox_paradise/examples/006_notebook_tab_example.rb +93 -0
- data/lib/fox_paradise/fox_classes/README.md +1 -0
- data/lib/fox_paradise/fox_classes/fx_app.rb +21 -0
- data/lib/fox_paradise/fox_classes/fx_button.rb +166 -0
- data/lib/fox_paradise/fox_classes/fx_frame.rb +11 -0
- data/lib/fox_paradise/fox_classes/fx_horizontal_frame.rb +11 -0
- data/lib/fox_paradise/fox_classes/fx_label.rb +18 -0
- data/lib/fox_paradise/fox_classes/fx_list.rb +18 -0
- data/lib/fox_paradise/fox_classes/fx_main_window.rb +29 -0
- data/lib/fox_paradise/toplevel_methods/misc.rb +204 -0
- data/lib/fox_paradise/version/version.rb +14 -0
- data/lib/fox_paradise.rb +8 -0
- metadata +104 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e26dfb3b7912622a1a465a66a5f5a93a9eb11ba4f8a3c09cf17a01b42f7043ec
|
4
|
+
data.tar.gz: f2d43768b1500f6282a9c2b30bea67fb69afaab22d8d9cc610be85455e951f77
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5c9036a4b15ce05d6bf923430211d843456b076a77c57cb154402f52bbf5cd5593447a439d46651e454a6361c81c5afecc8b465bd39d032c1841947f664d927d
|
7
|
+
data.tar.gz: fbad1f842cb3b5fe997876929c3f2fbfd58b8ac76927775cb62b548ab06244438b6531b95170e775694129fd60bc4fae9682deb738e545b9502fe4d11ccd0a2d
|
data/README.md
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
[![forthebadge](http://forthebadge.com/images/badges/built-with-love.svg)](https://www.gobolinux.org/)
|
2
|
+
[![forthebadge](http://forthebadge.com/images/badges/made-with-ruby.svg)](https://www.ruby-lang.org/en/)
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/fox_paradise.svg)](https://badge.fury.io/rb/fox_paradise)
|
4
|
+
|
5
|
+
## Introduction
|
6
|
+
|
7
|
+
**FOX** stands for Free Objects for X. It is a small, light-weight
|
8
|
+
GUI toolkit for Linux, Windows and Mac OSX.
|
9
|
+
|
10
|
+
The **fox_paradise gem**, written in ruby, attempts to **enhance**
|
11
|
+
the default fxruby gem.
|
12
|
+
|
13
|
+
The chosen API for the fox_paradise gem has been primarily inspired by
|
14
|
+
my other GUI-related toolset project called **gtk_paradise**. API
|
15
|
+
such as **.on_clicked {}** and similar - expect more goodies to
|
16
|
+
come for the fox_paradise gem in the long run. \o/ *does a little
|
17
|
+
ASCII dance*
|
18
|
+
|
19
|
+
Personally I still use ruby-gtk primarily, since it looks so pretty
|
20
|
+
on Linux - but Fox/fxruby is easier to work with on windows
|
21
|
+
(without WSL), so I needed some code to help me "bootstrap" that
|
22
|
+
as well.
|
23
|
+
|
24
|
+
## Installation and Using the project
|
25
|
+
|
26
|
+
gem install fox_paradise
|
27
|
+
|
28
|
+
And then:
|
29
|
+
|
30
|
+
require 'fox_paradise'
|
31
|
+
|
32
|
+
Note that this currently is hardcoded to fox16. I am using
|
33
|
+
**fox version 1.6.57**. In the future this may become more
|
34
|
+
flexible, but for now this is how it is.
|
35
|
+
|
36
|
+
Next, the content of the file called **SNIPPETS.md** will
|
37
|
+
be shown. I gather all fox-specific knowledge into that
|
38
|
+
file.
|
39
|
+
|
40
|
+
## Auto-initializing
|
41
|
+
|
42
|
+
To auto-initialize, do simply require the fox_paradise gem
|
43
|
+
in the following manner:
|
44
|
+
|
45
|
+
require 'fox_paradise/autoinitialize'
|
46
|
+
|
47
|
+
## Tooltips:
|
48
|
+
|
49
|
+
Tooltips can be set via:
|
50
|
+
|
51
|
+
button.tipText = ' Push Me! '
|
52
|
+
|
53
|
+
If you use the fox_paradise gem then the .hint alias exists:
|
54
|
+
|
55
|
+
button.hint = ' Push Me! '
|
56
|
+
|
57
|
+
## Buttons:
|
58
|
+
|
59
|
+
To add a shortcut, as a key-combination, prefix the text
|
60
|
+
via '&'. Example:
|
61
|
+
|
62
|
+
button = FXButton.new(main, "&Hello, World!", nil, application, FXApp::ID_QUIT)
|
63
|
+
|
64
|
+
You can give the button HTML colours such as:
|
65
|
+
|
66
|
+
button.background_colour = :steelblue
|
67
|
+
|
68
|
+
And you can set the foreground colour as well:
|
69
|
+
|
70
|
+
button.foreground_colour = :lightblue
|
71
|
+
button.foreground = :royalblue # this works as well
|
72
|
+
|
73
|
+
This functionality depends on the **colours** gem.
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
## Contact information
|
78
|
+
|
79
|
+
If your creative mind has ideas and specific suggestions to make this
|
80
|
+
gem more useful in general, feel free to drop me an email at any
|
81
|
+
time, via:
|
82
|
+
|
83
|
+
shevy@inbox.lt
|
84
|
+
|
85
|
+
Before that email I used an email account at Google gmail, but in **2021** I
|
86
|
+
decided to slowly abandon gmail for various reasons. In part this is because
|
87
|
+
the UI annoys me (on non-chrome browser loading takes too long), but also
|
88
|
+
because of Google's attempt to establish mass surveillance via its
|
89
|
+
federated cohorts sniffing (FLoC). I do not know what happened at Google,
|
90
|
+
but enough is enough - there is only so much you can take while supporting
|
91
|
+
greed. When it comes to data mining done by private groups, ultimately
|
92
|
+
the user became the product.
|
93
|
+
|
94
|
+
Do keep in mind that responding to emails may take some time,
|
95
|
+
depending on the amount of work I may have at that moment, due
|
96
|
+
to reallife time constraints. I will, however had, read feedback
|
97
|
+
eventually. Patches and code changes are welcome too, of course,
|
98
|
+
as long as they are in the spirit of the project at hand, e. g.
|
99
|
+
fitting to the general theme. For this I may make use of github
|
100
|
+
as a discussion site, but this has a low priority right now.
|
101
|
+
|
data/doc/README.gen
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
RUBY_HEADER
|
2
|
+
|
3
|
+
## Introduction
|
4
|
+
|
5
|
+
**FOX** stands for Free Objects for X. It is a small, light-weight
|
6
|
+
GUI toolkit for Linux, Windows and Mac OSX.
|
7
|
+
|
8
|
+
The **fox_paradise gem**, written in ruby, attempts to **enhance**
|
9
|
+
the default fxruby gem.
|
10
|
+
|
11
|
+
The chosen API for the fox_paradise gem has been primarily inspired by
|
12
|
+
my other GUI-related toolset project called **gtk_paradise**. API
|
13
|
+
such as **.on_clicked {}** and similar - expect more goodies to
|
14
|
+
come for the fox_paradise gem in the long run. \o/ *does a little
|
15
|
+
ASCII dance*
|
16
|
+
|
17
|
+
Personally I still use ruby-gtk primarily, since it looks so pretty
|
18
|
+
on Linux - but Fox/fxruby is easier to work with on windows
|
19
|
+
(without WSL), so I needed some code to help me "bootstrap" that
|
20
|
+
as well.
|
21
|
+
|
22
|
+
## Installation and Using the project
|
23
|
+
|
24
|
+
gem install fox_paradise
|
25
|
+
|
26
|
+
And then:
|
27
|
+
|
28
|
+
require 'fox_paradise'
|
29
|
+
|
30
|
+
Note that this currently is hardcoded to fox16. I am using
|
31
|
+
**fox version 1.6.57**. In the future this may become more
|
32
|
+
flexible, but for now this is how it is.
|
33
|
+
|
34
|
+
Next, the content of the file called **SNIPPETS.md** will
|
35
|
+
be shown. I gather all fox-specific knowledge into that
|
36
|
+
file.
|
37
|
+
|
38
|
+
## Auto-initializing
|
39
|
+
|
40
|
+
To auto-initialize, do simply require the fox_paradise gem
|
41
|
+
in the following manner:
|
42
|
+
|
43
|
+
require 'fox_paradise/autoinitialize'
|
44
|
+
|
45
|
+
## Tooltips:
|
46
|
+
|
47
|
+
Tooltips can be set via:
|
48
|
+
|
49
|
+
button.tipText = ' Push Me! '
|
50
|
+
|
51
|
+
If you use the fox_paradise gem then the .hint alias exists:
|
52
|
+
|
53
|
+
button.hint = ' Push Me! '
|
54
|
+
|
55
|
+
## Buttons:
|
56
|
+
|
57
|
+
To add a shortcut, as a key-combination, prefix the text
|
58
|
+
via '&'. Example:
|
59
|
+
|
60
|
+
button = FXButton.new(main, "&Hello, World!", nil, application, FXApp::ID_QUIT)
|
61
|
+
|
62
|
+
You can give the button HTML colours such as:
|
63
|
+
|
64
|
+
button.background_colour = :steelblue
|
65
|
+
|
66
|
+
And you can set the foreground colour as well:
|
67
|
+
|
68
|
+
button.foreground_colour = :lightblue
|
69
|
+
button.foreground = :royalblue # this works as well
|
70
|
+
|
71
|
+
This functionality depends on the **colours** gem.
|
72
|
+
|
73
|
+
EMBED_THIS_FILE SNIPPETS.md
|
74
|
+
|
75
|
+
ADD_CONTACT_INFORMATION
|
data/doc/SNIPPETS.md
ADDED
@@ -0,0 +1,161 @@
|
|
1
|
+
This file will collect fxruby-related snippets.
|
2
|
+
|
3
|
+
To require fxruby, do:
|
4
|
+
|
5
|
+
require 'fox16'
|
6
|
+
|
7
|
+
Toplevel inclusion via:
|
8
|
+
|
9
|
+
include Fox # I don't recommend it, though.
|
10
|
+
|
11
|
+
Create a new application:
|
12
|
+
|
13
|
+
application = Fox::FXApp.new # The application object is responsible for the main event loop.
|
14
|
+
application = Fox::FXApp.new('Hello World!', 'FoxTest')
|
15
|
+
application = Fox::FXApp.new
|
16
|
+
|
17
|
+
Create a new main window:
|
18
|
+
|
19
|
+
# first argument should be a FXApp instance:
|
20
|
+
main_window = Fox::FXMainWindow.new(application, 'Hello', nil, nil, DECOR_ALL)
|
21
|
+
main_window = Fox::FXMainWindow.new(application, 'Hello')
|
22
|
+
|
23
|
+
Subclass from the main window:
|
24
|
+
|
25
|
+
class HelloWindow < Fox::FXMainWindow
|
26
|
+
|
27
|
+
Create a button (button tag):
|
28
|
+
|
29
|
+
# The button should be embedded into the main-window:
|
30
|
+
FXButton.new(main_window, "&Hello, Fox World!", nil, application, FXApp::ID_QUIT)
|
31
|
+
button = FXButton.new(main_window, "Hey its me")
|
32
|
+
button = Fox::FXButton.new(main_window, "Hello, World!")
|
33
|
+
|
34
|
+
Style a button:
|
35
|
+
|
36
|
+
button = FXButton.new(parent_widget,
|
37
|
+
'&Some text',
|
38
|
+
opts: FRAME_SUNKEN|FRAME_THICK
|
39
|
+
)
|
40
|
+
|
41
|
+
button.frameStyle = FRAME_SUNKEN|FRAME_THICK # Set the frame-style in use.
|
42
|
+
|
43
|
+
Add a tooltip to the button (or to other widgets):
|
44
|
+
|
45
|
+
button.tipText = ' Push Me! '
|
46
|
+
button.hint = 'Or use this.' # This is available via the fox_paradise gem.
|
47
|
+
|
48
|
+
Add a check-button:
|
49
|
+
|
50
|
+
vertical_frame = FXVerticalFrame.new(self, LAYOUT_SIDE_RIGHT|LAYOUT_FILL_Y|PACK_UNIFORM_WIDTH)
|
51
|
+
check_button = FXCheckButton.new(vertical_frame, "Toolbar Style\tCool \"poppy\" style buttons")
|
52
|
+
check_button.connect(SEL_COMMAND) { |sender, sel, checked|
|
53
|
+
if checked
|
54
|
+
@button.buttonStyle |= BUTTON_TOOLBAR
|
55
|
+
@button.frameStyle = FRAME_RAISED
|
56
|
+
else
|
57
|
+
@button.buttonStyle &= ~BUTTON_TOOLBAR
|
58
|
+
@button.frameStyle = FRAME_RAISED|FRAME_THICK
|
59
|
+
end
|
60
|
+
}
|
61
|
+
|
62
|
+
Create a vertical frame:
|
63
|
+
|
64
|
+
vertical_frame = FXVerticalFrame.new(self, LAYOUT_SIDE_RIGHT|LAYOUT_FILL_Y|PACK_UNIFORM_WIDTH)
|
65
|
+
|
66
|
+
React to on-key-press events (on click actions, click tag, clicked tag):
|
67
|
+
|
68
|
+
button.connect(SEL_COMMAND) { |sender, selector, data|
|
69
|
+
puts 22 * 2222
|
70
|
+
}
|
71
|
+
button.connect(Fox::SEL_COMMAND) { |sender, selector, data|
|
72
|
+
puts 'Hi! And bye!'
|
73
|
+
exit
|
74
|
+
}
|
75
|
+
|
76
|
+
Create a text-view widget via FXText:
|
77
|
+
|
78
|
+
@text = FXText.new(main_window)
|
79
|
+
@text.style = FXText::STYLE_UNDERLINE # Underline the text.
|
80
|
+
|
81
|
+
Add a vertical separator:
|
82
|
+
|
83
|
+
Fox::FXVerticalSeparator.new(
|
84
|
+
main_window, Fox::LAYOUT_SIDE_RIGHT|Fox::LAYOUT_FILL_Y|Fox::SEPARATOR_RIDGE
|
85
|
+
)
|
86
|
+
|
87
|
+
Add layout hints:
|
88
|
+
|
89
|
+
button.layoutHints = LAYOUT_CENTER_X
|
90
|
+
|
91
|
+
Initialize the application:
|
92
|
+
|
93
|
+
application.create # Do this before .run()
|
94
|
+
|
95
|
+
Show stuff in the main-window:
|
96
|
+
|
97
|
+
main_window.show(PLACEMENT_SCREEN) # PLACEMENT_SCREEN ensures that the main window is visible when the program starts to run. This is equivalent to being centered.
|
98
|
+
|
99
|
+
Run the application:
|
100
|
+
|
101
|
+
application.run
|
102
|
+
|
103
|
+
To use a custom font, on a button, try:
|
104
|
+
|
105
|
+
font = Fox::FXFont.new(@app, 'times', 22)
|
106
|
+
button = Fox::FXButton.new(main_window, name)
|
107
|
+
button.setFont(font) # Set the font here.
|
108
|
+
|
109
|
+
# Or simpler via the fox_paradise_gem:
|
110
|
+
|
111
|
+
USE_THIS_FONT = Fox.font('Hack', 50)
|
112
|
+
button = Fox.button
|
113
|
+
button.use_this_font = USE_THIS_FONT
|
114
|
+
|
115
|
+
Set the font size:
|
116
|
+
|
117
|
+
@font = FXFont.new(app, "Hack,12")
|
118
|
+
|
119
|
+
Set a totally custom font:
|
120
|
+
|
121
|
+
"helvetica [bitstream],12,bold,i,normal,iso8859-1,0"
|
122
|
+
|
123
|
+
Setting a table (table tag):
|
124
|
+
|
125
|
+
@table = Fox::FXTable.new(frame, opts:
|
126
|
+
Fox::TABLE_COL_SIZABLE|Fox::TABLE_ROW_SIZABLE|Fox::LAYOUT_FILL_X|Fox::LAYOUT_FILL_Y,
|
127
|
+
padding: 2)
|
128
|
+
|
129
|
+
@table.visibleRows = 20
|
130
|
+
@table.visibleColumns = 8
|
131
|
+
|
132
|
+
@table.setTableSize(50, 14)
|
133
|
+
|
134
|
+
@table.setBackColor(Fox::FXRGB(255, 255, 255))
|
135
|
+
@table.setCellColor(0, 0, Fox::FXRGB(255, 255, 255))
|
136
|
+
@table.setCellColor(0, 1, Fox::FXRGB(255, 240, 240))
|
137
|
+
@table.setCellColor(1, 0, Fox::FXRGB(240, 255, 240))
|
138
|
+
@table.setCellColor(1, 1, Fox::FXRGB(240, 240, 255))
|
139
|
+
|
140
|
+
@table.setItemText(r, c, “r:#{r} c:#{c}”) # Set a specific text.
|
141
|
+
@table.setColumnText(c, Date::MONTHNAMES[c+1]) } # set text on a column.
|
142
|
+
|
143
|
+
Colours/Colors in fxruby:
|
144
|
+
|
145
|
+
require 'fox16/colors'
|
146
|
+
blue = Fox::FXColor::Blue # This will refer to blue.
|
147
|
+
|
148
|
+
Use a four-splitter widget:
|
149
|
+
|
150
|
+
splitter = FX4Splitter.new(self, LAYOUT_SIDE_TOP|LAYOUT_FILL_X|LAYOUT_FILL_Y|FOURSPLITTER_TRACKING)
|
151
|
+
|
152
|
+
Create a status bar:
|
153
|
+
|
154
|
+
Fox::FXStatusBar.new(self, LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X|STATUSBAR_WITH_DRAGCORNER)
|
155
|
+
|
156
|
+
Fox and FXRuby specific links:
|
157
|
+
|
158
|
+
Documentation pertaining to Fox and FXRuby:
|
159
|
+
|
160
|
+
http://fox-toolkit.org/
|
161
|
+
http://fox-toolkit.org/ref16/hierarchy.html
|
data/doc/TODO.md
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# =========================================================================== #
|
2
|
+
# Gemspec for fox_paradise.
|
3
|
+
# =========================================================================== #
|
4
|
+
require 'fox_paradise/version/version.rb'
|
5
|
+
require 'roebe'
|
6
|
+
|
7
|
+
Gem::Specification.new { |s|
|
8
|
+
|
9
|
+
s.name = 'fox_paradise'
|
10
|
+
s.version = Fox::VERSION
|
11
|
+
s.date = Time.now.strftime('%Y-%m-%d')
|
12
|
+
|
13
|
+
DESCRIPTION = <<-EOF
|
14
|
+
|
15
|
+
This library is called fox_paradise. It bundles together code that
|
16
|
+
can be used for the FOX toolkit, via the fxruby bindings.
|
17
|
+
|
18
|
+
The project is very beta-ish though. Do not use it for anything
|
19
|
+
in production yet.
|
20
|
+
|
21
|
+
EOF
|
22
|
+
|
23
|
+
s.summary = DESCRIPTION
|
24
|
+
s.description = DESCRIPTION
|
25
|
+
|
26
|
+
s.extra_rdoc_files = %w()
|
27
|
+
|
28
|
+
s.authors = ['Robert A. Heiler']
|
29
|
+
s.email = Roebe.email?
|
30
|
+
s.files = Dir['**/*']
|
31
|
+
s.licenses = 'LGPL-2.1'
|
32
|
+
s.homepage = 'https://rubygems.org/gems/fox_paradise'
|
33
|
+
|
34
|
+
s.required_ruby_version = '>= '+Roebe.third_most_stable_version_of_ruby
|
35
|
+
s.required_rubygems_version = '>= '+Gem::VERSION
|
36
|
+
s.rubygems_version = '>= '+Gem::VERSION
|
37
|
+
|
38
|
+
# ========================================================================= #
|
39
|
+
# Dependencies for the project:
|
40
|
+
# ========================================================================= #
|
41
|
+
s.add_dependency 'colours'
|
42
|
+
s.add_dependency 'fxruby'
|
43
|
+
|
44
|
+
}
|
@@ -0,0 +1,87 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# === FoxParadise::AdminPanel
|
6
|
+
#
|
7
|
+
# Usage example:
|
8
|
+
#
|
9
|
+
# FoxParadise::AdminPanel.new
|
10
|
+
#
|
11
|
+
# =========================================================================== #
|
12
|
+
# require 'fox_paradise/admin_panel/admin_panel.rb'
|
13
|
+
# =========================================================================== #
|
14
|
+
require 'colours'
|
15
|
+
require 'esystem/method'
|
16
|
+
require 'opn'
|
17
|
+
require 'save_file'
|
18
|
+
require 'fox16'
|
19
|
+
|
20
|
+
module FoxParadise
|
21
|
+
|
22
|
+
class AdminPanel # < Base # === Foo::AdminPanel
|
23
|
+
|
24
|
+
include Colours
|
25
|
+
|
26
|
+
# ========================================================================= #
|
27
|
+
# === initialize
|
28
|
+
# ========================================================================= #
|
29
|
+
def initialize(
|
30
|
+
commandline_arguments = nil,
|
31
|
+
run_already = true
|
32
|
+
)
|
33
|
+
reset
|
34
|
+
set_commandline_arguments(
|
35
|
+
commandline_arguments
|
36
|
+
)
|
37
|
+
run if run_already
|
38
|
+
end
|
39
|
+
|
40
|
+
# ========================================================================= #
|
41
|
+
# === reset (reset tag)
|
42
|
+
# ========================================================================= #
|
43
|
+
def reset
|
44
|
+
super()
|
45
|
+
end
|
46
|
+
|
47
|
+
# ========================================================================= #
|
48
|
+
# === set_commandline_arguments
|
49
|
+
# ========================================================================= #
|
50
|
+
def set_commandline_arguments(i = '')
|
51
|
+
i = [i].flatten.compact
|
52
|
+
@commandline_arguments = i
|
53
|
+
end
|
54
|
+
|
55
|
+
# ========================================================================= #
|
56
|
+
# === commandline_arguments?
|
57
|
+
# ========================================================================= #
|
58
|
+
def commandline_arguments?
|
59
|
+
@commandline_arguments
|
60
|
+
end
|
61
|
+
|
62
|
+
# ========================================================================= #
|
63
|
+
# === first_argument?
|
64
|
+
# ========================================================================= #
|
65
|
+
def first_argument?
|
66
|
+
@commandline_arguments.first
|
67
|
+
end; alias first? first_argument? # === first?
|
68
|
+
|
69
|
+
# ========================================================================= #
|
70
|
+
# === run (run tag)
|
71
|
+
# ========================================================================= #
|
72
|
+
def run
|
73
|
+
pp self # for debugging
|
74
|
+
end
|
75
|
+
|
76
|
+
# ========================================================================= #
|
77
|
+
# === AdminPanel[]
|
78
|
+
# ========================================================================= #
|
79
|
+
def self.[](i = '')
|
80
|
+
new(i)
|
81
|
+
end
|
82
|
+
|
83
|
+
end; end
|
84
|
+
|
85
|
+
if __FILE__ == $PROGRAM_NAME
|
86
|
+
FoxParadise::AdminPanel.new(ARGV)
|
87
|
+
end # admin_panel.rb
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
require 'fox_paradise'
|
6
|
+
|
7
|
+
application = Fox.app('Hello World!', 'FoxTest')
|
8
|
+
window = Fox.window(application, 'Hello', nil, nil, Fox::DECOR_ALL)
|
9
|
+
window.width_height(1400, 800)
|
10
|
+
|
11
|
+
Fox.button(
|
12
|
+
window,
|
13
|
+
"&Hello, Fox World!",
|
14
|
+
nil, application,
|
15
|
+
Fox::FXApp::ID_QUIT
|
16
|
+
)
|
17
|
+
application.create
|
18
|
+
window.do_show
|
19
|
+
application.run
|
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
require 'fox_paradise/autoinitialize'
|
6
|
+
|
7
|
+
alias e puts
|
8
|
+
|
9
|
+
window = Fox.window(Fox.application_window?, 'Hello')
|
10
|
+
button = Fox.button(window, "Hey it's me!")
|
11
|
+
button.on_clicked { |sender, selector, data|
|
12
|
+
e 'The button was clicked.' # This text will be displayed on the commandline.
|
13
|
+
}
|
14
|
+
|
15
|
+
Fox.create_then_run # rb $FOX/simple_windows.rb
|
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
require 'fox_paradise/autoinitialize'
|
6
|
+
|
7
|
+
window = Fox.window(Fox.the_app?, 'Hello')
|
8
|
+
|
9
|
+
button = Fox.button(window, 'Hello, World!')
|
10
|
+
button.tipText = ' Push Me! '
|
11
|
+
button.on_clicked { exit }
|
12
|
+
|
13
|
+
Fox::FXToolTip.new(Fox.the_app?)
|
14
|
+
|
15
|
+
Fox.create_then_run # rb $FOX/tool_tip_example.rb
|
@@ -0,0 +1,26 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
require 'fox_paradise/autoinitialize'
|
6
|
+
|
7
|
+
USE_THIS_IMAGE = '/home/x/data/images/RPG/SARLEM/CASTLES/TulisNe_Burg.jpg'
|
8
|
+
|
9
|
+
# =========================================================================== #
|
10
|
+
# Supply your image here:
|
11
|
+
# =========================================================================== #
|
12
|
+
if ARGV.empty?
|
13
|
+
image_path = USE_THIS_IMAGE
|
14
|
+
else
|
15
|
+
image_path = ARGV.first
|
16
|
+
end
|
17
|
+
|
18
|
+
main_window = Fox.window(::Fox.main_app?, 'Hello')
|
19
|
+
# =========================================================================== #
|
20
|
+
# Add a button:
|
21
|
+
# =========================================================================== #
|
22
|
+
button = Fox.button(main_window, "Hello, World!")
|
23
|
+
button.hint = 'This will show an image.'
|
24
|
+
button.use_this_image = image_path
|
25
|
+
button.is_a_quit_button
|
26
|
+
Fox.create_then_run
|
@@ -0,0 +1,49 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
require 'fox_paradise/autoinitialize'
|
6
|
+
|
7
|
+
alias e puts
|
8
|
+
|
9
|
+
window = Fox.window(Fox.main_application?, :the_filename_is_the_title)
|
10
|
+
window.width_height(1400, 800)
|
11
|
+
|
12
|
+
# =========================================================================== #
|
13
|
+
# === FONT_TO_USE
|
14
|
+
# =========================================================================== #
|
15
|
+
FONT_TO_USE = Fox.font('Hack', 30)
|
16
|
+
|
17
|
+
splitter = Fox::FX4Splitter.new(
|
18
|
+
window, Fox::LAYOUT_SIDE_TOP|Fox::LAYOUT_FILL_X|Fox::LAYOUT_FILL_Y|Fox::FOURSPLITTER_TRACKING
|
19
|
+
)
|
20
|
+
|
21
|
+
button1 = Fox.button(
|
22
|
+
splitter,
|
23
|
+
'&Button1',
|
24
|
+
nil,
|
25
|
+
Fox.main_application?
|
26
|
+
)
|
27
|
+
button1.background_colour :black
|
28
|
+
button1.foreground_colour :tomato
|
29
|
+
button1.pads(80) # This combines pad_right= and pad_left=.
|
30
|
+
button1.hint = 'Button #1 can be clicked.'
|
31
|
+
button1.on_clicked { e 'Button #1 was clicked.' }
|
32
|
+
button1.use_this_font = FONT_TO_USE
|
33
|
+
|
34
|
+
button2 = Fox.button(
|
35
|
+
splitter,
|
36
|
+
'B&utton2',
|
37
|
+
nil,
|
38
|
+
Fox.main_application?
|
39
|
+
)
|
40
|
+
button2.background_colour :lightblue
|
41
|
+
button2.foreground_colour :royalblue
|
42
|
+
button2.pads(20)
|
43
|
+
button2.hint = 'Button #2 can be clicked.'
|
44
|
+
button2.on_clicked { e 'Button #2 was clicked.' }
|
45
|
+
button2.use_this_font = FONT_TO_USE
|
46
|
+
|
47
|
+
Fox.status_bar(window)
|
48
|
+
|
49
|
+
Fox.create_then_run
|
@@ -0,0 +1,93 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
require 'fox_paradise/autoinitialize'
|
6
|
+
|
7
|
+
alias e puts
|
8
|
+
|
9
|
+
window = Fox.window(Fox.main_application?, :the_filename_is_the_title)
|
10
|
+
window.width_height(1400, 800)
|
11
|
+
|
12
|
+
# =========================================================================== #
|
13
|
+
# === FONT_TO_USE
|
14
|
+
# =========================================================================== #
|
15
|
+
FONT_TO_USE = Fox.font('Hack', 30)
|
16
|
+
|
17
|
+
# =========================================================================== #
|
18
|
+
# Add a small separator:
|
19
|
+
# =========================================================================== #
|
20
|
+
Fox.horizontal_separator(window)
|
21
|
+
|
22
|
+
# =========================================================================== #
|
23
|
+
# Contents
|
24
|
+
# =========================================================================== #
|
25
|
+
contents = Fox.horizontal_frame(window)
|
26
|
+
|
27
|
+
# =========================================================================== #
|
28
|
+
# Switcher
|
29
|
+
# =========================================================================== #
|
30
|
+
@tabbook = Fox::FXTabBook.new(contents, opts: Fox::LAYOUT_FILL_X|Fox::LAYOUT_FILL_Y|Fox::LAYOUT_RIGHT)
|
31
|
+
|
32
|
+
# =========================================================================== #
|
33
|
+
# First tab:
|
34
|
+
# =========================================================================== #
|
35
|
+
@tab1 = Fox::FXTabItem.new(@tabbook, '&Simple List', nil)
|
36
|
+
listframe = Fox::FXHorizontalFrame.new(@tabbook, Fox::FRAME_THICK|Fox::FRAME_RAISED)
|
37
|
+
simplelist = Fox::FXList.new(listframe, opts: Fox::LIST_EXTENDEDSELECT|Fox::LAYOUT_FILL_X|Fox::LAYOUT_FILL_Y)
|
38
|
+
simplelist.use_this_font = FONT_TO_USE
|
39
|
+
simplelist.appendItem('First Entry')
|
40
|
+
simplelist.appendItem('Second Entry')
|
41
|
+
simplelist.appendItem('Third Entry')
|
42
|
+
simplelist.appendItem('Fourth Entry')
|
43
|
+
|
44
|
+
# =========================================================================== #
|
45
|
+
# Second tab:
|
46
|
+
# =========================================================================== #
|
47
|
+
@tab2 = Fox::FXTabItem.new(@tabbook, 'F&ile List', nil)
|
48
|
+
|
49
|
+
@fileframe = Fox.horizontal_frame(@tabbook, Fox::FRAME_THICK|Fox::FRAME_RAISED)
|
50
|
+
|
51
|
+
filelist = Fox::FXFileList.new(@fileframe, opts: Fox::ICONLIST_EXTENDEDSELECT|Fox::LAYOUT_FILL_X|Fox::LAYOUT_FILL_Y)
|
52
|
+
|
53
|
+
# =========================================================================== #
|
54
|
+
# Third tab (third tag):
|
55
|
+
# =========================================================================== #
|
56
|
+
@tab3 = Fox.tab_item(@tabbook, '&Buttons', nil)
|
57
|
+
dirframe = Fox::FXHorizontalFrame.new(@tabbook, Fox::FRAME_THICK|Fox::FRAME_RAISED)
|
58
|
+
|
59
|
+
splitter = Fox::FX4Splitter.new(
|
60
|
+
dirframe, Fox::LAYOUT_SIDE_TOP|Fox::LAYOUT_FILL_X|Fox::LAYOUT_FILL_Y|Fox::FOURSPLITTER_TRACKING
|
61
|
+
)
|
62
|
+
|
63
|
+
button1 = Fox.button(
|
64
|
+
splitter,
|
65
|
+
'&Button1',
|
66
|
+
nil,
|
67
|
+
Fox.main_application?
|
68
|
+
)
|
69
|
+
button1.background_colour :black
|
70
|
+
button1.foreground_colour :tomato
|
71
|
+
button1.pads(40) # This combines pad_right= and pad_left=.
|
72
|
+
button1.hint = 'Button #1 can be clicked.'
|
73
|
+
button1.on_clicked { e 'Button #1 was clicked.' }
|
74
|
+
button1.use_this_font = FONT_TO_USE
|
75
|
+
|
76
|
+
button2 = Fox.button(
|
77
|
+
splitter,
|
78
|
+
'B&utton2',
|
79
|
+
nil,
|
80
|
+
Fox.main_application?
|
81
|
+
)
|
82
|
+
button2.background_colour :lightblue
|
83
|
+
button2.foreground_colour :royalblue
|
84
|
+
button2.pads(40)
|
85
|
+
button2.hint = 'Button #2 can be clicked.'
|
86
|
+
button2.on_clicked { e 'Button #2 was clicked.' }
|
87
|
+
button2.use_this_font = FONT_TO_USE
|
88
|
+
|
89
|
+
Fox.horizontal_separator(window)
|
90
|
+
Fox.status_bar(window)
|
91
|
+
Fox.horizontal_separator(window)
|
92
|
+
|
93
|
+
Fox.create_then_run
|
@@ -0,0 +1 @@
|
|
1
|
+
This directory contains modifications to core fox-classes.
|
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'fox_paradise/fox_classes/fx_app.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module Fox
|
8
|
+
|
9
|
+
class FXApp
|
10
|
+
|
11
|
+
# ========================================================================= #
|
12
|
+
# === create_then_run
|
13
|
+
#
|
14
|
+
# This method simply combines two other methods.
|
15
|
+
# ========================================================================= #
|
16
|
+
def create_then_run
|
17
|
+
create
|
18
|
+
run
|
19
|
+
end
|
20
|
+
|
21
|
+
end; end
|
@@ -0,0 +1,166 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'fox_paradise/fox_classes/fx_button.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module Fox
|
8
|
+
|
9
|
+
class FXButton
|
10
|
+
|
11
|
+
begin
|
12
|
+
require 'colours'
|
13
|
+
rescue LoadError; end
|
14
|
+
|
15
|
+
# ========================================================================= #
|
16
|
+
# === background_colour
|
17
|
+
# ========================================================================= #
|
18
|
+
def background_colour(
|
19
|
+
array = [128, 128, 0]
|
20
|
+
)
|
21
|
+
if ( array.is_a?(String) or array.is_a?(Symbol) ) and
|
22
|
+
Colours.is_a_html_colour?(array)
|
23
|
+
array = Colours.html_colour_to_rgb_value(array).split(';').map {|entry| # Is initially something like "106;90;205".
|
24
|
+
entry.to_i
|
25
|
+
}
|
26
|
+
end
|
27
|
+
self.backColor = ::Fox::FXRGB(*array)
|
28
|
+
end; alias background_colour= background_colour # === background_colour=
|
29
|
+
|
30
|
+
# ========================================================================= #
|
31
|
+
# === foreground_colour
|
32
|
+
# ========================================================================= #
|
33
|
+
def foreground_colour(
|
34
|
+
array = [128, 128, 0]
|
35
|
+
)
|
36
|
+
if ( array.is_a?(String) or array.is_a?(Symbol) ) and
|
37
|
+
Colours.is_a_html_colour?(array)
|
38
|
+
array = Colours.html_colour_to_rgb_value(array).split(';').map {|entry| # Is initially something like "106;90;205".
|
39
|
+
entry.to_i
|
40
|
+
}
|
41
|
+
end
|
42
|
+
self.textColor = ::Fox::FXRGB(*array)
|
43
|
+
end; alias foreground_colour= foreground_colour # === foreground_colour=
|
44
|
+
alias foreground= foreground_colour # === foreground=
|
45
|
+
|
46
|
+
# ========================================================================= #
|
47
|
+
# === use_this_image=
|
48
|
+
#
|
49
|
+
# This method can be used to handle images.
|
50
|
+
# ========================================================================= #
|
51
|
+
def use_this_image=(
|
52
|
+
image_path,
|
53
|
+
use_this_as_the_main_app = ::Fox.main_app?
|
54
|
+
)
|
55
|
+
dataset = File.open(image_path, 'rb').read
|
56
|
+
case image_path
|
57
|
+
# ======================================================================= #
|
58
|
+
# === png files
|
59
|
+
# ======================================================================= #
|
60
|
+
when /.png$/
|
61
|
+
self.icon = ::Fox::FXPNGIcon.new(use_this_as_the_main_app, dataset)
|
62
|
+
# ======================================================================= #
|
63
|
+
# === jpg files
|
64
|
+
# ======================================================================= #
|
65
|
+
when /.jpg$/,
|
66
|
+
/.jpeg$/
|
67
|
+
self.icon = ::Fox::FXJPGIcon.new(use_this_as_the_main_app, dataset)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
# ========================================================================= #
|
72
|
+
# === on_clicked
|
73
|
+
#
|
74
|
+
# This is the method that will be run when the user clicks on the
|
75
|
+
# button, via the mouse pointer.
|
76
|
+
# ========================================================================= #
|
77
|
+
def on_clicked(&block)
|
78
|
+
connect(::Fox::SEL_COMMAND, &block)
|
79
|
+
end
|
80
|
+
|
81
|
+
# ========================================================================= #
|
82
|
+
# === is_a_quit_button
|
83
|
+
# ========================================================================= #
|
84
|
+
def is_a_quit_button
|
85
|
+
on_clicked { exit }
|
86
|
+
end
|
87
|
+
|
88
|
+
# ========================================================================= #
|
89
|
+
# === pads
|
90
|
+
#
|
91
|
+
# This refers to side-padding; the "s" stands for "side".
|
92
|
+
# ========================================================================= #
|
93
|
+
def pads(
|
94
|
+
pad_by_n_pixel = 10
|
95
|
+
)
|
96
|
+
self.pad_right = pad_by_n_pixel
|
97
|
+
self.pad_left = pad_by_n_pixel
|
98
|
+
end
|
99
|
+
|
100
|
+
# ========================================================================= #
|
101
|
+
# === hint=
|
102
|
+
#
|
103
|
+
# This method sets up the tooltip to use.
|
104
|
+
# ========================================================================= #
|
105
|
+
def hint=(
|
106
|
+
i, main_app = ::Fox.main_app?
|
107
|
+
)
|
108
|
+
self.tipText = i
|
109
|
+
::Fox::FXToolTip.new(main_app)
|
110
|
+
end; alias fancy_tooltip= hint= # === fancy-tooltip=
|
111
|
+
|
112
|
+
alias pad_right= padRight= # === pad_right=
|
113
|
+
|
114
|
+
alias pad_left= padLeft= # === pad_left=
|
115
|
+
|
116
|
+
end
|
117
|
+
|
118
|
+
|
119
|
+
# ========================================================================= #
|
120
|
+
# === Fox.button (button tag)
|
121
|
+
#
|
122
|
+
# This method can be used to create a button.
|
123
|
+
#
|
124
|
+
# The normal "vanilla" API would look like this:
|
125
|
+
#
|
126
|
+
# FXButton.new(parent_widget,
|
127
|
+
# '&Some text',
|
128
|
+
# opts: FRAME_SUNKEN|FRAME_THICK
|
129
|
+
# )
|
130
|
+
#
|
131
|
+
# ========================================================================= #
|
132
|
+
def self.button(
|
133
|
+
onto_which_widget = nil, # The parent widget.
|
134
|
+
text = "&Hello, Fox World!",
|
135
|
+
options_hash = {},
|
136
|
+
no_idea = nil,
|
137
|
+
evidently_something_related_to_quit = :no_special_action
|
138
|
+
)
|
139
|
+
case evidently_something_related_to_quit
|
140
|
+
# ======================================================================= #
|
141
|
+
# === :pass_through
|
142
|
+
# ======================================================================= #
|
143
|
+
when :pass_through,
|
144
|
+
:no_special_action,
|
145
|
+
:default # This is also the default.
|
146
|
+
# ===================================================================== #
|
147
|
+
# In this case nothing will be done, except for setting it to 0.
|
148
|
+
# ===================================================================== #
|
149
|
+
evidently_something_related_to_quit = 0
|
150
|
+
# ======================================================================= #
|
151
|
+
# === :quit
|
152
|
+
# ======================================================================= #
|
153
|
+
when :quit
|
154
|
+
evidently_something_related_to_quit = ::Fox::FXApp::ID_QUIT
|
155
|
+
end
|
156
|
+
::Fox::FXButton.new(
|
157
|
+
onto_which_widget,
|
158
|
+
text,
|
159
|
+
options_hash,
|
160
|
+
no_idea,
|
161
|
+
evidently_something_related_to_quit
|
162
|
+
)
|
163
|
+
end
|
164
|
+
|
165
|
+
|
166
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'fox_paradise/fox_classes/fx_frame.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module Fox
|
8
|
+
|
9
|
+
class FXFrame
|
10
|
+
|
11
|
+
end; end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'fox_paradise/fox_classes/fx_horizontal_frame.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module Fox
|
8
|
+
|
9
|
+
class FXHorizontalFrame
|
10
|
+
|
11
|
+
end; end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'fox_paradise/fox_classes/fx_label.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module Fox
|
8
|
+
|
9
|
+
class FXLabel
|
10
|
+
|
11
|
+
# ========================================================================= #
|
12
|
+
# === use_this_font=
|
13
|
+
# ========================================================================= #
|
14
|
+
def use_this_font=(i)
|
15
|
+
setFont(i)
|
16
|
+
end; alias set_font use_this_font= # === set_font
|
17
|
+
|
18
|
+
end; end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'fox_paradise/fox_classes/fx_list.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module Fox
|
8
|
+
|
9
|
+
class FXList
|
10
|
+
|
11
|
+
# ========================================================================= #
|
12
|
+
# === use_this_font=
|
13
|
+
# ========================================================================= #
|
14
|
+
def use_this_font=(i)
|
15
|
+
setFont(i)
|
16
|
+
end; alias set_font use_this_font= # === set_font
|
17
|
+
|
18
|
+
end; end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
module Fox
|
6
|
+
|
7
|
+
class FXMainWindow
|
8
|
+
|
9
|
+
# ========================================================================= #
|
10
|
+
# === do_show
|
11
|
+
# ========================================================================= #
|
12
|
+
def do_show(
|
13
|
+
i = ::Fox::PLACEMENT_SCREEN
|
14
|
+
)
|
15
|
+
show(i)
|
16
|
+
end
|
17
|
+
|
18
|
+
# ========================================================================= #
|
19
|
+
# === width_height
|
20
|
+
# ========================================================================= #
|
21
|
+
def width_height(
|
22
|
+
width = 1400,
|
23
|
+
height = 800
|
24
|
+
)
|
25
|
+
self.width = width
|
26
|
+
self.height = height
|
27
|
+
end
|
28
|
+
|
29
|
+
end; end
|
@@ -0,0 +1,204 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'fox_paradise/toplevel_methods/misc.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module Fox
|
8
|
+
|
9
|
+
require 'fox_paradise/fox_classes/fx_app.rb'
|
10
|
+
require 'fox_paradise/fox_classes/fx_button.rb'
|
11
|
+
require 'fox_paradise/fox_classes/fx_label.rb'
|
12
|
+
require 'fox_paradise/fox_classes/fx_frame.rb'
|
13
|
+
require 'fox_paradise/fox_classes/fx_horizontal_frame.rb'
|
14
|
+
require 'fox_paradise/fox_classes/fx_list.rb'
|
15
|
+
require 'fox_paradise/fox_classes/fx_main_window.rb'
|
16
|
+
|
17
|
+
alias e puts
|
18
|
+
|
19
|
+
# ========================================================================= #
|
20
|
+
# === @application_window
|
21
|
+
#
|
22
|
+
# This variable can be used to keep track of the main application
|
23
|
+
# window.
|
24
|
+
# ========================================================================= #
|
25
|
+
@application_window = nil
|
26
|
+
|
27
|
+
# ========================================================================= #
|
28
|
+
# === Fox.application_window?
|
29
|
+
# ========================================================================= #
|
30
|
+
def self.application_window?
|
31
|
+
@application_window
|
32
|
+
end; self.instance_eval { alias the_app? application_window? } # === Fox.the_app?
|
33
|
+
self.instance_eval { alias main_app? application_window? } # === Fox.main_app?
|
34
|
+
self.instance_eval { alias main_application? application_window? } # === Fox.main_application?
|
35
|
+
|
36
|
+
# ========================================================================= #
|
37
|
+
# === Fox.set_application_window
|
38
|
+
# ========================================================================= #
|
39
|
+
def self.set_application_window(i)
|
40
|
+
@application_window = i
|
41
|
+
end
|
42
|
+
|
43
|
+
# ========================================================================= #
|
44
|
+
# === Fox.create_then_run
|
45
|
+
# ========================================================================= #
|
46
|
+
def self.create_then_run
|
47
|
+
::Fox.application_window?.create_then_run
|
48
|
+
end
|
49
|
+
|
50
|
+
# ========================================================================= #
|
51
|
+
# === Fox.run
|
52
|
+
# ========================================================================= #
|
53
|
+
def self.run(
|
54
|
+
this = ::Fox.application_window?
|
55
|
+
)
|
56
|
+
this.run
|
57
|
+
end
|
58
|
+
|
59
|
+
# ========================================================================= #
|
60
|
+
# === Fox.initialize_application_window
|
61
|
+
#
|
62
|
+
# This method is similar to:
|
63
|
+
#
|
64
|
+
# app = Fox::FXApp.new
|
65
|
+
#
|
66
|
+
# ========================================================================= #
|
67
|
+
def self.initialize_application_window
|
68
|
+
@application_window = app # Call .app().
|
69
|
+
end
|
70
|
+
|
71
|
+
# ========================================================================= #
|
72
|
+
# === Fox.app
|
73
|
+
#
|
74
|
+
# This method can be used to create a new Fox-Application.
|
75
|
+
# ========================================================================= #
|
76
|
+
def self.app(
|
77
|
+
a = 'Hello world!',
|
78
|
+
b = 'FoxTest'
|
79
|
+
)
|
80
|
+
return ::Fox::FXApp.new(a, b)
|
81
|
+
end
|
82
|
+
|
83
|
+
# ========================================================================= #
|
84
|
+
# === Fox.font (font tag)
|
85
|
+
#
|
86
|
+
# Simplified toplevel-method to assign to a font.
|
87
|
+
# ========================================================================= #
|
88
|
+
def self.font(
|
89
|
+
use_this_font_name = 'Hack',
|
90
|
+
use_this_for_the_font_size = 20,
|
91
|
+
use_this_application = Fox.main_application?
|
92
|
+
)
|
93
|
+
Fox::FXFont.new(
|
94
|
+
use_this_application, use_this_font_name, use_this_for_the_font_size
|
95
|
+
)
|
96
|
+
end
|
97
|
+
|
98
|
+
# ========================================================================= #
|
99
|
+
# === Fox.tab_item
|
100
|
+
# ========================================================================= #
|
101
|
+
def self.tab_item(
|
102
|
+
window,
|
103
|
+
text = '&Buttons',
|
104
|
+
whatever = nil
|
105
|
+
)
|
106
|
+
Fox::FXTabItem.new(window, text,whatever)
|
107
|
+
end
|
108
|
+
|
109
|
+
# ========================================================================= #
|
110
|
+
# === Fox.filelist
|
111
|
+
# ========================================================================= #
|
112
|
+
def self.filelist(
|
113
|
+
window,
|
114
|
+
options = Fox::ICONLIST_EXTENDEDSELECT|Fox::LAYOUT_FILL_X|Fox::LAYOUT_FILL_Y
|
115
|
+
)
|
116
|
+
Fox::FXFileList.new(
|
117
|
+
window, options
|
118
|
+
)
|
119
|
+
end
|
120
|
+
|
121
|
+
# ========================================================================= #
|
122
|
+
# === Fox.horizontal_separator
|
123
|
+
#
|
124
|
+
# The first argument must be the parent window. This is mandatory.
|
125
|
+
# ========================================================================= #
|
126
|
+
def self.horizontal_separator(
|
127
|
+
window,
|
128
|
+
use_this_as_the_layout = Fox::LAYOUT_SIDE_TOP|Fox::LAYOUT_FILL_X|Fox::SEPARATOR_GROOVE
|
129
|
+
)
|
130
|
+
Fox::FXHorizontalSeparator.new(
|
131
|
+
window,
|
132
|
+
use_this_as_the_layout
|
133
|
+
)
|
134
|
+
end; self.instance_eval { alias hseparator horizontal_separator } # === Fox.hseparator
|
135
|
+
|
136
|
+
# ========================================================================= #
|
137
|
+
# === Fox.horizontal_frame (frame tag)
|
138
|
+
#
|
139
|
+
# This method will create a horizontal frame.
|
140
|
+
# ========================================================================= #
|
141
|
+
def self.horizontal_frame(
|
142
|
+
use_this_the_main_window = nil,
|
143
|
+
options_to_use = Fox::LAYOUT_SIDE_TOP|Fox::FRAME_NONE|Fox::LAYOUT_FILL_X|Fox::LAYOUT_FILL_Y|Fox::PACK_UNIFORM_WIDTH
|
144
|
+
)
|
145
|
+
Fox::FXHorizontalFrame.new(
|
146
|
+
use_this_the_main_window,
|
147
|
+
options_to_use
|
148
|
+
)
|
149
|
+
end
|
150
|
+
|
151
|
+
# ========================================================================= #
|
152
|
+
# === Fox.status_bar
|
153
|
+
#
|
154
|
+
# The first argument must be the parent window. This is mandatory.
|
155
|
+
# ========================================================================= #
|
156
|
+
def self.status_bar(
|
157
|
+
use_this_the_main_window = nil,
|
158
|
+
options_to_use = Fox::LAYOUT_SIDE_BOTTOM|Fox::LAYOUT_FILL_X|Fox::STATUSBAR_WITH_DRAGCORNER
|
159
|
+
)
|
160
|
+
Fox::FXStatusBar.new(
|
161
|
+
use_this_the_main_window,
|
162
|
+
options_to_use
|
163
|
+
)
|
164
|
+
end; self.instance_eval { alias statusbar status_bar } # === Fox.statusbar
|
165
|
+
|
166
|
+
# ========================================================================= #
|
167
|
+
# === Fox.window
|
168
|
+
#
|
169
|
+
# Note that this method will automatically call .show() on the window.
|
170
|
+
# This may be subject to change at a later time (written August 2021).
|
171
|
+
#
|
172
|
+
# This is actually a "main window".
|
173
|
+
# ========================================================================= #
|
174
|
+
def self.window(
|
175
|
+
root = :create_new,
|
176
|
+
title = '', # This is the main window's title. It will be displayed in the window's title bar.
|
177
|
+
a = nil,
|
178
|
+
b = nil,
|
179
|
+
decor_type = Fox::DECOR_ALL
|
180
|
+
)
|
181
|
+
case title
|
182
|
+
when :the_filename_is_the_title
|
183
|
+
title = File.basename($PROGRAM_NAME) # We only need the short variant.
|
184
|
+
end
|
185
|
+
case root # case tag
|
186
|
+
# ======================================================================= #
|
187
|
+
# === :create_new
|
188
|
+
# ======================================================================= #
|
189
|
+
when :create_new
|
190
|
+
root = ::Fox.app
|
191
|
+
Fox.set_application_window(root)
|
192
|
+
end
|
193
|
+
main_window = ::Fox::FXMainWindow.new(
|
194
|
+
root,
|
195
|
+
title,
|
196
|
+
a,
|
197
|
+
b,
|
198
|
+
decor_type
|
199
|
+
)
|
200
|
+
main_window.show # See the explanation on top of this method.
|
201
|
+
return main_window
|
202
|
+
end
|
203
|
+
|
204
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'fox_paradise/version/version.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module Fox
|
8
|
+
|
9
|
+
# ========================================================================= #
|
10
|
+
# === VERSION
|
11
|
+
# ========================================================================= #
|
12
|
+
VERSION = '0.0.12'
|
13
|
+
|
14
|
+
end
|
data/lib/fox_paradise.rb
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'fox_paradise'
|
6
|
+
# =========================================================================== #
|
7
|
+
require 'fox16' # This is the hardcoded version. It may change at a later moment in time.
|
8
|
+
require 'fox_paradise/toplevel_methods/misc.rb'
|
metadata
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fox_paradise
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.12
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Robert A. Heiler
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-08-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: colours
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: fxruby
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: |2+
|
42
|
+
|
43
|
+
This library is called fox_paradise. It bundles together code that
|
44
|
+
can be used for the FOX toolkit, via the fxruby bindings.
|
45
|
+
|
46
|
+
The project is very beta-ish though. Do not use it for anything
|
47
|
+
in production yet.
|
48
|
+
|
49
|
+
email: shevy@inbox.lt
|
50
|
+
executables: []
|
51
|
+
extensions: []
|
52
|
+
extra_rdoc_files: []
|
53
|
+
files:
|
54
|
+
- README.md
|
55
|
+
- doc/README.gen
|
56
|
+
- doc/SNIPPETS.md
|
57
|
+
- doc/TODO.md
|
58
|
+
- fox_paradise.gemspec
|
59
|
+
- lib/fox_paradise.rb
|
60
|
+
- lib/fox_paradise/admin_panel/admin_panel.rb
|
61
|
+
- lib/fox_paradise/autoinitialize.rb
|
62
|
+
- lib/fox_paradise/examples/001_hello_world.rb
|
63
|
+
- lib/fox_paradise/examples/002_simple_window.rb
|
64
|
+
- lib/fox_paradise/examples/003_tool_tip_example.rb
|
65
|
+
- lib/fox_paradise/examples/004_show_this_image.rb
|
66
|
+
- lib/fox_paradise/examples/005_two_buttons_in_a_resizable_panel.rb
|
67
|
+
- lib/fox_paradise/examples/006_notebook_tab_example.rb
|
68
|
+
- lib/fox_paradise/fox_classes/README.md
|
69
|
+
- lib/fox_paradise/fox_classes/fx_app.rb
|
70
|
+
- lib/fox_paradise/fox_classes/fx_button.rb
|
71
|
+
- lib/fox_paradise/fox_classes/fx_frame.rb
|
72
|
+
- lib/fox_paradise/fox_classes/fx_horizontal_frame.rb
|
73
|
+
- lib/fox_paradise/fox_classes/fx_label.rb
|
74
|
+
- lib/fox_paradise/fox_classes/fx_list.rb
|
75
|
+
- lib/fox_paradise/fox_classes/fx_main_window.rb
|
76
|
+
- lib/fox_paradise/toplevel_methods/misc.rb
|
77
|
+
- lib/fox_paradise/version/version.rb
|
78
|
+
homepage: https://rubygems.org/gems/fox_paradise
|
79
|
+
licenses:
|
80
|
+
- LGPL-2.1
|
81
|
+
metadata: {}
|
82
|
+
post_install_message:
|
83
|
+
rdoc_options: []
|
84
|
+
require_paths:
|
85
|
+
- lib
|
86
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: 2.5.8
|
91
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: 3.2.25
|
96
|
+
requirements: []
|
97
|
+
rubygems_version: 3.2.25
|
98
|
+
signing_key:
|
99
|
+
specification_version: 4
|
100
|
+
summary: This library is called fox_paradise. It bundles together code that can be
|
101
|
+
used for the FOX toolkit, via the fxruby bindings. The project is very beta-ish
|
102
|
+
though. Do not use it for anything in production yet.
|
103
|
+
test_files: []
|
104
|
+
...
|