Class: PopupTable

Inherits:
Ruiby_gtk show all
Defined in:
lib/ruiby_gtk/editor.rb

Constant Summary

Constants included from Ruiby_dsl

Ruiby_dsl::GTK2ICONNAME

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Ruiby_gtk

#chrome, #on_destroy, #on_resize, #rposition, #ruiby_exit, #set_window_icon

Methods included from Ruiby_threader

#after, #anim, #init_threader, #on_idle, #threader

Methods included from Ruiby_dsl

#_, #_accept?, #_cbox, #_check_append, #_create_log_window, #_dyn_check_button, #_dyn_entry, #_dyn_fslider, #_dyn_ientry, #_dyn_islider, #_dyn_label, #_dyn_progress, #_dyn_toggle_button, #_exe_posix, #_exe_windows, #_label, #_make_prop_line, #_nocodeeeeeeeeeee, #_pack, #_paned, #_radio_buttons, #_set_accepter, #_sub_image, #aaa_generalities, #accordion, #aitem, #alabel, #append_to, #apply_options, #attribs, #autoslot, #background, #backgroundi, #bourrage, #box, #button, #button_expand, #button_icon_text, #button_left_icon_text, #buttoni, #calendar, #canvas, #canvasOld, #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, #css_name, #current_layout, cv_color_html, #def_style, #delete, #dialog, #dialog_async, #entry, #exe, #fentry, #field, #fields, #flow, #flow_paned, #flowi, #force_update, #frame, #framei, #fslider, #get_config, #get_current_container, #get_icon, #get_image, #get_image_from, #get_pixbuf, #get_pixmap, #get_stockicon_pixbuf, #grid, #haccordion, #hide_app, #hradio_buttons, html_color, #html_color, #htoolbar, #htoolbar_with_icon_text, #ientry, #image, #install_composant, #islider, #label, #label_clickable, #labeli, #left, #levelbar, #list, #log, #log_as_widget, #menu, #menu_bar, #menu_button, #menu_checkbutton, #menu_separator, #next_row, #notebook, #on_canvas_button_motion, #on_canvas_button_press, #on_canvas_button_release, #on_canvas_draw, #on_canvas_key_press, #on_canvas_resize, #on_delete, #page, #panel, #panel_async, #panel_progress, #pclickable, #pclickablie, #plot, #popup, #popup_clear_append, #pp_item, #pp_separator, #progress, #progress_bar, #properties, #propertys, #razslot, #regular, #right, #row, #script, #scrolled, #sentence, #sentenci, #separator, #show_all_children, #show_app, #show_methods, #show_source, #slider, #slot, #slot_append_after, #slot_append_before, #sloti, #snapshot, #source_editor, #space, #spacei, #spacing, #stack, #stack_paned, #stacki, #syst_add_button, #syst_add_check, #syst_add_sepratator, #syst_icon, #syst_quit_button, #systray, #systray_setup, #table, #text_area, #text_area_dyn, #toggle_button, #toolbar_button, #toolbar_separator, #tooltip, #trace, #tree_grid, #var_box, #var_boxi, #vbox_scrolled, #video, #vradio_buttons, #widget_properties, #window

Methods included from Ruiby_default_dialog

#_gooooooooooo, #_process_terminal_key, #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, #promptSync, #terminal, #trace

Constructor Details

#initialize(title, width = 350, height = 600, captions = [["oups"]], data = [["no data"]], options = {}, &bloc) ⇒ PopupTable

Returns a new instance of PopupTable.



54
55
56
57
58
59
60
61
# File 'lib/ruiby_gtk/editor.rb', line 54

def initialize(title,width=350,height=600,captions=[["oups"]],data=[["no data"]],options={},&bloc)
		@bloc=bloc
		@captions=captions
		@data=data
		@options=options
		@options["button-orrient"] ||= "r"
    super(title,width,height)
end

Instance Attribute Details

#mgridObject (readonly)

Returns the value of attribute mgrid.



53
54
55
# File 'lib/ruiby_gtk/editor.rb', line 53

def mgrid
  @mgrid
end

Instance Method Details

#_button_listObject



80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/ruiby_gtk/editor.rb', line 80

def _button_list()
	@options.each do |name,action| 
		next unless   action.respond_to?(:call)
		button(name) {
			next unless  @grid.index()
			begin
				noline=@grid.index().to_s.to_i
				action.call(@data[noline] ) 
			rescue 
				error($!) 
			end
		}
	end
end

#componentObject



66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/ruiby_gtk/editor.rb', line 66

def component()
  stack do
	flow {
		stacki { space;_button_list;space } if @options["button-orrient"] =~ /^l/i
		@grid=grid(@captions,100,150)
		stacki { space;_button_list;space } if @options["button-orrient"] =~ /^r/i
	}
	@mgrid=@grid
	@grid.set_data(@data)	
	flowi { button_list } if @options["button-orrient"] =~ /^h/i
	stacki { button_list } if @options["button-orrient"] =~ /^v/i
	sloti( button(" Exit ") { @bloc ? @bloc.call(@grid.get_data()) : destroy()} )
  end
end

#update(data) ⇒ Object



62
63
64
65
# File 'lib/ruiby_gtk/editor.rb', line 62

def update(data)
	@data=data
	@grid.set_data(@data)	
end