· 8 years ago · Feb 21, 2018, 07:06 PM
1# ============================================================= #
2# For GTK2 Colours
3# ============================================================= #
4# require 'x/STD/std_gtk2.rb'
5# include GTK2Colours
6# GTK2Colours::BLACK
7# ============================================================= #
8# grepcomment $RUBY_STD/std_gtk2.rb
9# ============================================================= #
10
11begin
12 require 'gtk2'
13rescue LoadError => e
14 puts "LoadError: Cant load gtk2 (#{e})"
15end
16
17RUBY_RESERVED_WORDS = %w(
18 begin end module class def if then else
19 while unless do case when require yield
20)
21
22# ========================================================================= #
23# Needed that for some GTK thingy. Its also in std_classes.
24# ========================================================================= #
25class Integer
26 define_method(:is_odd?) { self % 2 != 0 }
27 define_method(:is_even?) { self % 2 == 0 }
28end
29
30# ========================================================================= #
31# Extend Gtk::Entry
32# add append_text method
33# ========================================================================= #
34class Gtk::Entry
35
36 # ======================================================================= #
37 # === append_text
38 # ======================================================================= #
39 def append_text(this_text)
40 self.set_text(self.text + this_text)
41 end
42
43end
44
45
46
47# ====================================================================== #
48# ImageMenuItem.new
49# A specialized Menuitem with a nice little icon to the left.
50# ====================================================================== #
51class ImageMenuItem < Gtk::MenuItem
52
53 # ==================================================== #
54 # img_location gives the path of the image.
55 # ==================================================== #
56 def initialize(text_to_display='Play Video',
57 img_location=nil,
58 n_pad=0) # default: add 0 spaces to our text
59 super()
60 if img_location.nil?
61 img_location = '/Users/x/DATA/IMG/STD/MINI_DOT.png'
62 end
63 @text_to_display = text_to_display
64 @text_to_display = pad_to(n_pad)
65 image = Gtk::Image.new(img_location)
66 @menu_item = Gtk::MenuItem.new(@text_to_display)
67 hbox = Gtk::HBox.new
68 hbox.add(image).add(@menu_item)
69 self.add(hbox)
70 end
71
72 # ==================================================== #
73 # just padd our string a bit
74 # ==================================================== #
75 def pad_to(n_times=0)
76 pad = ''
77 pad = ' ' * n_times unless n_times==0
78 _ = @text_to_display+ pad
79 return _
80 end
81
82end
83
84
85
86# ========================================================================= #
87# === create_main_window
88# Creates a main window.
89#
90# Alternatively (recommended) do one of these, with last comes best:
91# main_window.signal_connect('delete_event'){ Gtk::main_quit }
92# main_window = create_main_window(800,600)
93# main_window = create_main_window(height=600,width=400, optional_icon_path = nil,this_title=nil,border=nil)
94# main_window = create_main_window(600,400, 'iconpath','title',3)
95# ========================================================================= #
96def create_main_window(height=600, width=400, optional_icon_path=nil, this_title=nil,border=nil)
97 main_window = Gtk::Window.new()
98 #main_window.signal_connect('destroy') { Gtk.main_quit }
99 main_window.signal_connect('delete_event'){ Gtk::main_quit }
100 main_window.set_size_request(height, width)
101 main_window.set_title(this_title)
102 if optional_icon_path # if we pass a path to an icon, we will use it as icon
103 # puts optional_icon_path
104 main_window.set_icon(Gdk::Pixbuf.new(optional_icon_path))
105 end
106 unless border.nil?
107 main_window.border_width=border
108 end
109 return main_window
110end
111
112
113# ========================================================================= #
114# === create_gtk_source_view
115# Creates a default Gtk::SourceView object.
116# ========================================================================= #
117def create_gtk_source_view(buffer_to_use)
118 _ = Gtk::SourceView.new(buffer_to_use)
119 _.show_line_numbers=true
120 _.show_line_markers=true
121 _.smart_home_end=true
122 _.tabs_width=2
123 return _
124end
125
126
127# ========================================================================= #
128# === create_cell_renderer_text(foreground_colour,background_colour)
129# ========================================================================= #
130def create_cell_renderer_text
131 renderer=Gtk::CellRendererText.new
132 renderer.set_property( 'foreground', foreground_colour)
133 renderer.set_property( 'background', background_colour )
134 return renderer
135end
136
137
138# ========================================================================= #
139# === standard_file_chooser_dialog
140# returns a file chooser dialog.
141# ========================================================================= #
142def standard_file_chooser_dialog(title,widget)
143 _= Gtk::FileChooserDialog.new(title,widget,
144 Gtk::FileChooser::ACTION_OPEN, nil,
145 [Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL],
146 [Gtk::Stock::OPEN, Gtk::Dialog::RESPONSE_ACCEPT]
147 )
148 return _
149end
150
151
152# ========================================================================= #
153# === table1
154# will return a table with a 1 columns layout.
155# ========================================================================= #
156def table1(*all_args)
157 table = Gtk::Table.new(all_args.size, 2, true)
158 counter = 0
159 slow_counter = 0
160 for element in all_args
161 # print (counter % 2),' ',(counter % 2)+1,' ',slow_counter,' ',slow_counter+1,"\n"
162 table.attach_defaults(
163 element,
164 (counter % 1), (counter % 1)+1,
165 slow_counter, slow_counter+1
166 )
167 counter += 1
168 slow_counter += 1 #if counter % 2 == 0
169 end
170 return table
171end
172
173
174# ========================================================================= #
175# === table2
176# Will return a table with a 2 columns layout.
177# ========================================================================= #
178def table2(*all_args)
179 table = Gtk::Table.new(all_args.size / 2, 2, true)
180 counter = 0
181 slow_counter = 0
182 for element in all_args
183 # print (counter % 2),' ',(counter % 2)+1,' ',slow_counter,' ',slow_counter+1,"\n"
184 table.attach_defaults(
185 element,
186 (counter % 2), (counter % 2)+1,
187 slow_counter, slow_counter+1
188 )
189 counter += 1
190 slow_counter += 1 if counter % 2 == 0
191 end
192 return table
193end
194
195
196# ========================================================================= #
197# === table3
198# will return a table with a 3 columns layout.
199# ========================================================================= #
200def table3(*all_args)
201 table = Gtk::Table.new(all_args.size / 3, 2, true)
202
203 counter = 0
204 slow_counter = 0
205 for element in all_args
206 # print (counter % 2),' ',(counter % 2)+1,' ',slow_counter,' ',slow_counter+1,"\n"
207 table.attach_defaults(
208 element,
209 (counter % 3), (counter % 3)+1,
210 slow_counter, slow_counter+1
211 )
212 counter += 1
213 slow_counter += 1 if counter % 3 == 0
214 end
215 return table
216end
217
218
219# ========================================================================= #
220# === remove_all_pages
221# Removes all pages from a Gtk Notebook.
222# Examples:
223# remove_all_pages(@notebook)
224# ========================================================================= #
225def remove_all_pages(which_widget)
226 which_widget.n_pages.times do |index|
227 which_widget.remove_page(index)
228 end
229end
230
231
232# ========================================================================= #
233# === random_coordinate_move
234# this either returns - or +
235# random_coordinate_move(range=100)
236# ========================================================================= #
237def random_coordinate_move(range=100)
238 case rand(2)
239 when 0 then return rand(range)
240 when 1 then return -rand(range)
241 end
242end
243
244
245# ========================================================================= #
246# === which_mouse_button
247# puts event.button
248# which mouse button was pressed?
249# puts which_mouse_button(event.button)
250# ========================================================================= #
251def which_mouse_button(type)
252 case type
253 when 3 then return 'right'
254 when 2 then return 'middle'
255 when 1 then return 'left'
256 else
257 return 'unknown'
258 end
259end
260
261
262# ========================================================================= #
263# === create_canvas_rect
264# should create more
265# create_canvas_rect(@canvas_group)
266# ========================================================================= #
267def create_canvas_rect(widget,x1=115.0)
268 return Gnome::CanvasRect.new(widget,
269 {
270 :x1 => x1,
271 :y1 => 66.0,
272 :x2 => 220.0,
273 :y2 => 120.0,
274 :outline_color => 'black',
275 :fill_color => 'green',
276 :width_units => 2.0
277 }
278 )
279end
280
281
282# ========================================================================= #
283# === modify_label
284# Its for doing coloured labels. 2nd arg is default.
285# modify_label('test1','green')
286# modify_label('URL: ','darkblue')
287# ========================================================================= #
288def modify_label(name, colour = 'darkblue')
289 return Gtk::Label.new(name).set_markup( %Q[#{name} ], true)
290end
291
292
293# ========================================================================= #
294# === modify_bold_label
295# Wrapper to easier modify the colours
296# of a label, using bold label. Can be useful. The core of it
297# is the method set_markup, as in:
298# set_markup(%Q[<markup><span weight="bold" foreground="#{colour}">Test</span></markup>], true)
299# Usage examples:
300# modify_bold_label('LE: ','red')
301# modify_bold_label('AttackMe: ','slateblue')
302# ========================================================================= #
303def modify_bold_label(name, colour,justify=nil)
304 _ = Gtk::Label.new(name)
305 _.set_markup(%Q[<markup><span weight="bold" foreground="#{colour}">#{name} </span></markup>], true)
306 unless justify.nil?
307 case justify
308 when :center then _.set_justify(Gtk::JUSTIFY_CENTER)
309 when :left then _.set_justify(Gtk::JUSTIFY_RIGHT)
310 when :fill then _.set_justify(Gtk::JUSTIFY_FILL)
311 else
312 _.set_justify(Gtk::JUSTIFY_LEFT)
313 end
314 end
315 return _
316end
317
318
319# ========================================================================= #
320# === create_coloured_button('name')
321# See coloured_button.rb please!
322# ========================================================================= #
323
324
325
326# ========================================================================= #
327# === make_shortcut_key_for_gtk_entry
328# makes a shortcut key.
329# Arguments:
330# - main_window is the main window which covers all your sub
331# windows
332# Example Code:
333#
334# .make_shortcut_key_for_gtk_entry(@main_window,@accel_group,'1',@entry)
335# ========================================================================= #
336def make_shortcut_key_for_gtk_entry(main_window,
337 accel_group,
338 shortcut_key = 'b',
339 the_entry = '')
340 accel_group.connect(
341 Gdk::Keyval.from_name(shortcut_key.to_s),
342 Gdk::Window::MOD1_MASK,
343 Gtk::ACCEL_VISIBLE) do
344 set_focus_and_select(the_entry)
345 end
346 main_window.add_accel_group(accel_group).show_all
347end
348
349# ========================================================================= #
350# === set_focus_and_select
351# pass a GTK::Entry to this method.
352# ========================================================================= #
353def set_focus_and_select(this_entry)
354 this_entry.set_focus( true )
355 this_entry.select_region( 0, -1 )
356end
357
358# ========================================================================= #
359# === text
360# Creates a new Gtk::Label.
361# ========================================================================= #
362def text(this_string)
363 tmp = Gtk::Label.new(this_string)
364 return tmp
365end
366
367# ========================================================================= #
368# === create_entry_with_text_and_max_length
369# Creates a new gtk entry.
370# ========================================================================= #
371def create_entry_with_text_and_max_length(text='bla',max_length=50)
372 tmp = Gtk::Entry.new
373 tmp.set_max_length(max_length)
374 tmp.set_text(text)
375 return tmp
376end
377
378
379
380# ========================================================================= #
381# === create_event_image
382# Simple event.
383# create_event_image(file_url=HSS['IMG_RPG']+"ADOPTION/WALDSZENE.jpg")
384# ========================================================================= #
385def create_event_image(file_url=HSS['IMG_RPG']+'ADOPTION/WALDSZENE.jpg')
386 image = Gtk::Image.new(file_url)
387 event_box = Gtk::EventBox.new.add(image)
388 event_box.signal_connect("button_press_event") do
389 cme('Clicked.')
390 end
391 return event_box
392end
393
394
395
396
397# =============================================================== #
398# Contains key specific stuff.
399# =============================================================== #
400module GTK2Keys
401
402 ARROW_KEYS = [
403 Gdk::Keyval::GDK_Left,
404 Gdk::Keyval::GDK_Right,
405 Gdk::Keyval::GDK_Up,
406 Gdk::Keyval::GDK_Down
407 ]
408
409end
410
411
412# ==================================================================== #
413# Store xbm files in this Module.
414# include XbmIcons
415# Listing:
416# ==================================================================== #
417# XbmIcons::XBM_SWORD_ICON
418# XbmIcons::BOOK_CLOSED_XPM
419# XbmIcons::BOOK_OPENED_XPM
420# ==================================================================== #
421module XbmIcons
422 XBM_SWORD_ICON = [
423 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
424 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
425 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
426 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
427 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
428 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x40,
429 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
430 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
431 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08,
432 0x04, 0x00, 0x00, 0x00, 0x10, 0x07, 0x00, 0x00, 0x00, 0xc0, 0x02, 0x00,
433 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x00,
434 0x78, 0x03, 0x00, 0x00, 0x00, 0x58, 0x07, 0x00, 0x00, 0x00, 0x00, 0x0e,
435 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00,
436 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00,
437 0xe0, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00
438 ].pack("c*")
439
440
441 # Nun die XPM Icons.
442 # XbmIcons::BOOK_OPENED_XPM
443 BOOK_OPENED_XPM = [
444 "16 16 4 1",
445 " c None s None",
446 ". c black",
447 "X c #808080",
448 "o c white",
449 " ",
450 " .. ",
451 " .Xo. ... ",
452 " .Xoo. ..oo. ",
453 " .Xooo.Xooo... ",
454 " .Xooo.oooo.X. ",
455 " .Xooo.Xooo.X. ",
456 " .Xooo.oooo.X. ",
457 " .Xooo.Xooo.X. ",
458 " .Xooo.oooo.X. ",
459 " .Xoo.Xoo..X. ",
460 " .Xo.o..ooX. ",
461 " .X..XXXXX. ",
462 " ..X....... ",
463 " .. ",
464 " "]
465
466 # XbmIcons::::BOOK_CLOSED_XPM
467 BOOK_CLOSED_XPM = [
468 "16 16 6 1",
469 " c None s None",
470 ". c black",
471 "X c red",
472 "o c yellow",
473 "O c #808080",
474 "# c white",
475 " ",
476 " .. ",
477 " ..XX. ",
478 " ..XXXXX. ",
479 " ..XXXXXXXX. ",
480 ".ooXXXXXXXXX. ",
481 "..ooXXXXXXXXX. ",
482 ".X.ooXXXXXXXXX. ",
483 ".XX.ooXXXXXX.. ",
484 " .XX.ooXXX..#O ",
485 " .XX.oo..##OO. ",
486 " .XX..##OO.. ",
487 " .X.#OO.. ",
488 " ..O.. ",
489 " .. ",
490 " "
491 ]
492
493end
494
495
496
497
498
499
500# ============================================================== #
501# CanvasPack exists to give you loads of little
502# graphical objects to use in your application.
503# ============================================================== #
504# include CanvasPack
505# ============================================================== #
506module CanvasPack
507
508 WIDTH = 6
509 HEIGHT = 6
510
511 require 'gnomecanvas2'
512
513 # =================================================================== #
514 # CanvasPack::Glass.new
515 # =================================================================== #
516 class Glass < Gnome::CanvasGroup
517
518 def initialize(root,col_factor=2,row_factor=2)
519 super(root,
520 :x => 0,
521 :y => 0)
522 Gnome::CanvasEllipse.new(self,
523 :x1 => 0,
524 :y1 => 0,
525 :x2 => (col_factor + 2) * WIDTH,
526 :y2 => (row_factor + 2) * HEIGHT,
527 :outline_color => 'gray',
528 :fill_color => 'orange',
529 :width_units => 1.0
530 )
531 end
532 end
533
534 # =================================================================== #
535 # CanvasPack::RedBall.new
536 # =================================================================== #
537 class RedBall < Gnome::CanvasGroup
538
539 def initialize(root,col_factor=3,row_factor=3)
540 @col_factor = col_factor
541 @row_factor = row_factor
542 super(root,
543 :x => @col_factor * WIDTH,
544 :y => @row_factor * HEIGHT)
545 Gnome::CanvasEllipse.new(self,
546 :x1 => 2,
547 :y1 => 2,
548 :x2 => WIDTH*2,
549 :y2 => HEIGHT*2,
550 :outline_color => 'black',
551 :fill_color => 'red',
552 :width_units => 1.0
553 )
554 Gnome::CanvasEllipse.new(self,
555 :x1 => 4,
556 :y1 => 4,
557 :x2 => WIDTH,
558 :y2 => 2+WIDTH,
559 :outline_color => 'white',
560 :fill_color => 'white',
561 :width_units => 2.0
562 )
563 end
564 end
565end
566
567
568
569
570
571
572
573# =============================================================== #
574# include GTK2Colours
575# =============================================================== #
576module GTK2Colours
577
578 # ============================================================= #
579 # RED = Gdk::Color.new( 65535, 0, 0 )
580 # GREEN = Gdk::Color.new( 0, 65535, 0 )
581 # BLUE = Gdk::Color.new( 0, 0, 65535 )
582 # ============================================================= #
583
584 # ============================================================= #
585 # Da Gdk nicht immer verfügbar ist, müssen wir
586 # das ganze in begin/rescue einfangen.
587 # ============================================================= #
588 begin
589 # ============================================================= #
590 # HIER STARTET DIE ALPHABETISCHE REIHENFOLGE
591 # Zum verwenden das hier nit vergessen:
592 # include GTK2Colours
593 # ============================================================= #
594
595 ALICEBLUE = Gdk::Color.parse 'aliceblue'
596 AQUAMARINE = Gdk::Color.parse 'aquamarine'
597 AZURE = Gdk::Color.parse 'azure'
598 ANTIQUEWHITE = Gdk::Color.parse 'antiquewhite'
599 BISQUE = Gdk::Color.parse 'bisque'
600 BLACK = Gdk::Color.parse 'black'
601 BROWN = Gdk::Color.parse 'brown'
602 BLUE = Gdk::Color.parse 'blue'
603 BLANCHEDALMOND = Gdk::Color.parse 'blanchedalmond'
604 BEIGE = Gdk::Color.parse 'beige'
605 BLUEVIOLET = Gdk::Color.parse 'blueviolet'
606 BURLYWOOD = Gdk::Color.parse 'burlywood'
607 CORAL = Gdk::Color.parse 'coral'
608 CADETBLUE = Gdk::Color.parse 'cadetblue'
609 CHOCOLATE = Gdk::Color.parse 'chocolate'
610 CORNSILK = Gdk::Color.parse 'cornsilk'
611 CORNFLOWERBLUE = Gdk::Color.parse 'cornflowerblue'
612 CYAN = Gdk::Color.parse 'cyan'
613 CHARTREUSE = Gdk::Color.parse 'chartreuse'
614 # CRIMSON = Gdk::Color.parse 'crimson'
615 DARKSALMON = Gdk::Color.parse 'darksalmon'
616 DARKRED = Gdk::Color.parse 'darkred'
617 DARKGOLDENROD = Gdk::Color.parse 'darkgoldenrod'
618 DARKKHAKI = Gdk::Color.parse 'darkkhaki'
619 DARKOLIVEGREEN = Gdk::Color.parse 'darkolivegreen'
620 DARKSEAGREEN = Gdk::Color.parse 'darkseagreen'
621 DARKGREEN = Gdk::Color.parse 'darkgreen'
622 DARKTURQUOISE = Gdk::Color.parse 'darkturquoise'
623 DARKCYAN = Gdk::Color.parse 'darkcyan'
624 DEEPSKYBLUE = Gdk::Color.parse 'deepskyblue'
625 DARKBLUE = Gdk::Color.parse 'darkblue'
626 DARKGRAY = Gdk::Color.parse 'darkgray'
627 DARKMAGENTA = Gdk::Color.parse 'darkmagenta'
628 DARKORCHID = Gdk::Color.parse 'darkorchid'
629 DARKVIOLET = Gdk::Color.parse 'darkviolet'
630 DARKORANGE = Gdk::Color.parse 'darkorange'
631 DARKSLATEGRAY = Gdk::Color.parse 'darkslategray'
632 DEEPPINK = Gdk::Color.parse 'deeppink'
633 DIMGRAY = Gdk::Color.parse 'dimgray'
634 DODGERBLUE = Gdk::Color.parse 'dodgerblue'
635 DARKSLATEBLUE = Gdk::Color.parse 'darkslateblue'
636 FIREBRICK = Gdk::Color.parse 'firebrick'
637 FLORALWHITE = Gdk::Color.parse 'floralwhite'
638 FORESTGREEN = Gdk::Color.parse 'forestgreen'
639 GOLD = Gdk::Color.parse 'gold'
640 GOLDENROD = Gdk::Color.parse 'goldenrod'
641 GREEN = Gdk::Color.parse 'green'
642 GREENYELLOW = Gdk::Color.parse 'greenyellow'
643 GREY = Gdk::Color.parse 'grey'
644 GAINSBORO = Gdk::Color.parse 'gainsboro'
645 GHOSTWHITE = Gdk::Color.parse 'ghostwhite'
646 HOTPINK = Gdk::Color.parse 'hotpink'
647 HONEYDEW = Gdk::Color.parse 'honeydew'
648 IVORY = Gdk::Color.parse 'ivory'
649 INDIANRED = Gdk::Color.parse 'indianred'
650 #INDIGO= Gdk::Color.parse 'indigo'
651 KHAKI = Gdk::Color.parse 'khaki'
652 LAVENDERBLUSH = Gdk::Color.parse 'lavenderblush'
653 LAVENDER = Gdk::Color.parse 'lavender'
654 LIMEGREEN = Gdk::Color.parse 'limegreen'
655 LIGHTSALMON = Gdk::Color.parse 'lightsalmon'
656 LIGHTCORAL = Gdk::Color.parse 'lightcoral'
657 LIGHTGOLDENRODYELLOW= Gdk::Color.parse 'lightgoldenrodyellow'
658 LIGHTSTEELBLUE = Gdk::Color.parse 'lightsteelblue'
659 LIGHTPINK = Gdk::Color.parse 'lightpink'
660 LIGHTSLATEGRAY = Gdk::Color.parse 'lightslategray'
661 LIGHTGREY = Gdk::Color.parse 'lightgrey'
662 LIGHTCYAN = Gdk::Color.parse 'lightcyan'
663 LIGHTBLUE = Gdk::Color.parse 'lightblue'
664 LIGHTSKYBLUE = Gdk::Color.parse 'lightskyblue'
665 LIGHTSEAGREEN = Gdk::Color.parse 'lightseagreen'
666 LAWNGREEN = Gdk::Color.parse 'lawngreen'
667 #LIME= Gdk::Color.parse 'lime'
668 LIGHTGREEN = Gdk::Color.parse 'lightgreen'
669 LINEN = Gdk::Color.parse 'linen'
670 LIGHTYELLOW = Gdk::Color.parse 'lightyellow'
671 LEMONCHIFFON = Gdk::Color.parse 'lemonchiffon'
672 MOCCASIN = Gdk::Color.parse 'moccasin'
673 MAGENTA = Gdk::Color.parse 'magenta'
674 MEDIUMBLUE = Gdk::Color.parse 'mediumblue'
675 MEDIUMORCHID = Gdk::Color.parse 'mediumorchid'
676 MEDIUMPURPLE = Gdk::Color.parse 'mediumpurple'
677 MEDIUMAQUAMARINE = Gdk::Color.parse 'mediumaquamarine'
678 MEDIUMSPRINGGREEN = Gdk::Color.parse 'mediumspringgreen'
679 MEDIUMSEAGREEN = Gdk::Color.parse 'mediumseagreen'
680 MEDIUMTURQUOISE = Gdk::Color.parse 'mediumturquoise'
681 MEDIUMVIOLETRED = Gdk::Color.parse 'mediumvioletred'
682 MIDNIGHTBLUE = Gdk::Color.parse 'midnightblue'
683 MINTCREAM = Gdk::Color.parse 'mintcream'
684 MISTYROSE = Gdk::Color.parse 'mistyrose'
685 MEDIUMSLATEBLUE = Gdk::Color.parse 'mediumslateblue'
686 MAROON = Gdk::Color.parse 'maroon'
687 NAVAJOWHITE = Gdk::Color.parse 'navajowhite'
688 NAVY = Gdk::Color.parse 'navy'
689 OLDLACE = Gdk::Color.parse 'oldlace'
690 #OLIVE= Gdk::Color.parse 'olive'
691 OLIVEDRAB = Gdk::Color.parse 'olivedrab'
692 ORANGE = Gdk::Color.parse 'orange'
693 ORCHID = Gdk::Color.parse 'orchid'
694 ORANGERED = Gdk::Color.parse 'orangered'
695 PAPAYAWHIP = Gdk::Color.parse 'papayawhip'
696 PEACHPUFF = Gdk::Color.parse 'peachpuff'
697 PALEGREEN = Gdk::Color.parse 'palegreen'
698 PALEVIOLETRED = Gdk::Color.parse 'palevioletred'
699 PALETURQUOISE = Gdk::Color.parse 'paleturquoise'
700 PERU = Gdk::Color.parse 'peru'
701 PINK = Gdk::Color.parse 'pink'
702 PLUM = Gdk::Color.parse 'plum'
703 POWDERBLUE = Gdk::Color.parse 'powderblue'
704 PURPLE = Gdk::Color.parse 'purple'
705 PALEGOLDENROD = Gdk::Color.parse 'palegoldenrod'
706 RED = Gdk::Color.parse 'red'
707 ROYALBLUE = Gdk::Color.parse 'royalblue'
708 ROSYBROWN = Gdk::Color.parse 'rosybrown'
709 SANDYBROWN = Gdk::Color.parse 'sandybrown'
710 SALMON = Gdk::Color.parse 'salmon'
711 SEAGREEN = Gdk::Color.parse 'seagreen'
712 SEASHELL = Gdk::Color.parse 'seashell'
713 #SILVER = Gdk::Color.parse 'silver'
714 SKYBLUE = Gdk::Color.parse 'skyblue'
715 SADDLEBROWN = Gdk::Color.parse 'saddlebrown'
716 SIENNA = Gdk::Color.parse 'sienna'
717 STEELBLUE = Gdk::Color.parse 'steelblue'
718 SPRINGGREEN = Gdk::Color.parse 'springgreen'
719 SLATEBLUE = Gdk::Color.parse 'slateblue'
720 SNOW = Gdk::Color.parse 'snow'
721 SLATEGRAY = Gdk::Color.parse 'slategray'
722 TAN = Gdk::Color.parse 'tan'
723 #TEAL= Gdk::Color.parse 'teal'
724 THISTLE = Gdk::Color.parse 'thistle'
725 TOMATO = Gdk::Color.parse 'tomato'
726 TURQUOISE = Gdk::Color.parse 'turquoise'
727 VIOLET = Gdk::Color.parse 'violet'
728 WHITE = Gdk::Color.parse 'white'
729 WHITESMOKE = Gdk::Color.parse 'whitesmoke'
730 WHEAT = Gdk::Color.parse 'wheat'
731 YELLOW = Gdk::Color.parse 'yellow'
732 YELLOWGREEN = Gdk::Color.parse 'yellowgreen'
733 rescue Exception
734 puts 'Gdk not installed. Please install if possible.'
735 end
736end