-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathcontrol_gallery.cr
More file actions
84 lines (69 loc) · 1.83 KB
/
control_gallery.cr
File metadata and controls
84 lines (69 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
require "../src/iu"
require "./control_gallery/**"
# :nodoc:
module ControlGallery
# Define a global component storage
COMPONENTS = {} of String => Iu::Component
# :nodoc:
class Application < Iu::Application
include Iu::Components
def initialize_component
# Menu bar for the application
file_menu = Menu.new "File"
open_item = file_menu.append_item "Open"
save_item = file_menu.append_item "Save"
file_menu.append_quit_item
edit_meu = Menu.new "Edit"
edit_meu.append_check_item "Checkable Item"
disabled_item = edit_meu.append_item "Disabled Item"
disabled_item.disable
edit_meu.append_preferences_item
help_menu = Menu.new "Help"
help_menu.append_item "Help"
help_menu.append_about_item
window =
Iu::Components::Window.new(
title: "Control gallery",
width: 1200,
height: 600,
menu_bar: true
)
COMPONENTS["MainWindow"] = window
window.margined = true
window
.adopt(
VerticalBox
.new(padded: true)
.adopt(
HorizontalBox
.new(padded: true)
.adopt(
BasicControlsComponent.new,
stretchy: true
)
.adopt(
VerticalBox
.new(padded: true)
.adopt(
NumbersComponent.new,
)
.adopt(
ListsComponent.new
),
stretchy: true
),
stretchy: true
)
)
window.closing.on do
exit(0)
end
window.show
end
end
end
app = ControlGallery::Application.new
app.should_quit.on do
exit(0)
end
app.start