Class: Ruiby_gtk
- Inherits:
-
Gtk::Window
- Object
- Gtk::Window
- Ruiby_gtk
- Includes:
- Ruiby_dsl, Ruiby_threader
- Defined in:
- lib/ruiby_gtk/windows.rb
Overview
Creative Commons BY-SA : Regis d'Aubarede <regis.aubarede@gmail.com> LGPL
windows.rb : main ruiby windows
Direct Known Subclasses
Instance Method Summary (collapse)
-
- (Object) chrome(on = false)
show or supress the window system decoration.
- - (Object) component
-
- (Ruiby_gtk) initialize(title, w, h)
constructor
A new instance of Ruiby_gtk.
- - (Object) on_destroy(&blk)
-
- (Object) rposition(x, y)
change position of window in the desktop.
- - (Object) ruiby_exit
Methods included from Ruiby_threader
#after, #anim, #init_threader, #threader
Methods included from Ruiby_dsl
#_cbox, #_check_append, #_create_log_window, #_label, #_make_prop_line, #_nocodeeeeeeeeeee, #_pack, #_paned, #_radio_buttons, #_sub_image, #accordion, #aitem, #alabel, #append_to, #apply_options, #attribs, #autoslot, #box, #button, #button_expand, #buttoni, #calendar, #calendar_set_time, #canvas, #cell, #cell_bottom, #cell_hspan, #cell_hspan_left, #cell_hspan_right, #cell_hvspan, #cell_left, #cell_pass, #cell_right, #cell_span, #cell_top, #cell_vspan, #cell_vspan_bottom, #cell_vspan_top, #center, #check_button, #clear, #clear_append_to, #clickable, #close_dialog, #color_choice, #color_conversion, #combo, #def_style, #def_style3, #delete, #dialog, #dialog_async, #entry, #fentry, #field, #fields, #flow, #flow_paned, #flowi, #force_update, #frame, #framei, #get_config, #get_current_container, #get_icon, #get_image_from, #get_pixbuf, #get_stockicon_pixbuf, #grid, #haccordion, #hide_app, #hradio_buttons, #htoolbar, #ientry, #image, #islider, #label, #labeli, #list, #log, #menu, #menu_bar, #menu_button, #menu_checkbutton, #menu_separator, #notebook, #page, #pclickable, #popup, #pp_item, #pp_separator, #properties, #propertys, #razslot, #row, #scrolled, #separator, #show_all_children, #show_app, #show_methods, #slot, #slot_append_after, #slot_append_before, #sloti, #source_editor, #space, #stack, #stack_paned, #stacki, #syst_add_button, #syst_add_check, #syst_add_sepratator, #syst_icon, #syst_quit_button, #systray, #systray_setup, #table, #text_area, #toggle_button, #tree_grid, #var_box, #var_boxi, #vbox_scrolled, #video, #vradio_buttons, #widget_properties
Methods included from Ruiby_default_dialog
#alert, #ask, #ask_color, #ask_dir_to_read, #ask_dir_to_write, #ask_file_to_read, #ask_file_to_write, #dialog_chooser, #edit, #error, #message, #prompt, #trace
Constructor Details
- (Ruiby_gtk) initialize(title, w, h)
A new instance of Ruiby_gtk
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 |
# File 'lib/ruiby_gtk/windows.rb', line 10 def initialize(title,w,h) super() init_threader() #threader(10) # must be call by user window, if necessary set_title(title) set_default_size(w,h) signal_connect "destroy" do if @is_main_window @is_main_window=false Gtk.main_quit end end set_window_position Gtk::Window::Position::CENTER # default, can be modified by window_position(x,y) @lcur=[self] @ltable=[] @current_widget=nil @cur=nil begin component rescue error("COMPONENT() : "+$!.to_s + " :\n " + $!.backtrace[0..10].join("\n ")) exit! end begin show_all rescue puts "Error in show_all : illegal state of some widget? "+ $!.to_s end end |
Instance Method Details
- (Object) chrome(on = false)
show or supress the window system decoration
67 68 69 |
# File 'lib/ruiby_gtk/windows.rb', line 67 def chrome(on=false) set_decorated(on) end |
- (Object) component
45 46 47 |
# File 'lib/ruiby_gtk/windows.rb', line 45 def component raise("Abstract: 'def component()' must be overiden in a Ruiby class") end |
- (Object) on_destroy(&blk)
39 40 41 |
# File 'lib/ruiby_gtk/windows.rb', line 39 def on_destroy(&blk) signal_connect("destroy") { blk.call } end |
- (Object) rposition(x, y)
change position of window in the desktop. relative position works only in *nix system.
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/ruiby_gtk/windows.rb', line 51 def rposition(x,y) if x==0 && y==0 set_window_position Window::POS_CENTER return elsif x>=0 && y>=0 gravity= Gdk::Window::GRAVITY_NORTH_WEST elsif x<0 && y>=0 gravity= Gdk::Window::GRAVITY_NORTH_EAST elsif x>=0 && y<0 gravity= Gdk::Window::GRAVITY_SOUTH_WEST elsif x<0 && y<0 gravity= Gdk::Window::GRAVITY_SOUTH_EAST end move(x.abs,y.abs) end |
- (Object) ruiby_exit
42 43 44 |
# File 'lib/ruiby_gtk/windows.rb', line 42 def ruiby_exit() Gtk.main_quit end |