Repository navigation
Expand file tree
/
Copy pathbutton_factory.grace
More file actions
126 lines (104 loc) · 2.66 KB
/
Copy pathbutton_factory.grace
File metadata and controls
126 lines (104 loc) · 2.66 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
import "gtk" as gtk
def runButton = gtk.button
def consoleClear = gtk.button
def consoleOut = gtk.button
def consoleError = gtk.button
def consolePop = gtk.button
def newButton = gtk.button
def openButton = gtk.button
def saveButton = gtk.button
def saveAsButton = gtk.button
def closeButton = gtk.button
// Returns a different type of button, depending on the argument
method make(arg : String) is public {
if (arg == "run") then {
return run()
}
if (arg == "clear") then {
return clear()
}
if(arg == "out") then {
return out()
}
if(arg == "error") then {
return error()
}
if(arg == "pop") then {
return pop()
}
if (arg == "new") then {
return new()
}
if (arg == "open") then {
return open()
}
if (arg == "save") then {
return save()
}
if(arg == "saveAs") then {
return saveAs()
}
if(arg == "close") then {
return close()
}
}
method run {
runButton.label := "Run"
runButton.tooltip_text := "Runs the program"
runButton.set_size_request(100, 50)
return runButton
}
method clear {
consoleClear.label := "Clear"
consoleClear.tooltip_text := "Clears the Console"
consoleClear.set_size_request(25, 15)
return consoleClear
}
method out {
consoleOut.label := "Output"
consoleOut.tooltip_text := "Shows any output the program might create"
consoleOut.set_size_request(25, 15)
return consoleOut
}
method error {
consoleError.label := "Errors"
consoleError.tooltip_text := "Displays any errors there may be"
consoleError.set_size_request(25, 15)
return consoleError
}
method pop {
consolePop.label := "Pop Out"
consolePop.tooltip_text := "Will pop the console out into a new window"
consolePop.set_size_request(25, 15)
return consolePop
}
method new {
newButton.label := "New"
newButton.tooltip_text := "Creates a new file"
newButton.set_size_request(25, 15)
return newButton
}
method open {
openButton.label := "Open"
openButton.tooltip_text := "Opens a file"
openButton.set_size_request(25, 15)
return openButton
}
method save {
saveButton.label := "Save"
saveButton.tooltip_text := "Saves the file"
saveButton.set_size_request(25, 15)
return saveButton
}
method saveAs {
saveAsButton.label := "Save As"
saveAsButton.tooltip_text := "Saves the text into a new file"
saveAsButton.set_size_request(25, 15)
return saveAsButton
}
method close {
closeButton.label := "Close Tab"
closeButton.tooltip_text := "Closes the current tab"
closeButton.set_size_request(50, 25)
return closeButton
}