Class: Gtk::NotebookTabWithIcon
- Inherits:
-
BaseModuleBox
show all
- Defined in:
- lib/gtk_paradise/widgets/gtk3/notebook_tab_with_icon/notebook_tab_with_icon.rb
Overview
Constant Summary
collapse
- TITLE =
'Notebook-Tab with icon'
- WIDTH =
'4% or minimum 60px'
- HEIGHT =
'4% or minimum 35px'
- USE_THIS_FONT =
:dejavu_condensed_12
Constants included
from BaseModule
BaseModule::HASH_USE_THESE_PERCENTAGE_VALUES_FOR_THE_HEADERS, BaseModule::IMG_DIR
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from BaseModule
#abort_on_exception, #absolute_file_path, #add_a_horizontal_spacer, #add_css_rules, #add_horizontal_spacer, #add_notebook, #add_or_append, #add_table3, #all_buttons?, #all_check_buttons?, #all_entries?, #all_labels?, #all_toggle_buttons?, #allow_only_numbers, #always_scrolled_window, #app_chooser_button, #append_gtk_paradise_project_css_file, #append_onto_the_CSS_rules, #append_project_css_file, #append_the_default_css_rules, #apply_the_default_CSS_rules, #automatic_scrolled_window, #automatically_create_widgets_based_on_this_dataset, #automatically_created_widgets?, #button_hover_colour, #button_themed_icon, #cairo_context, #cell_renderer_progress, #centered_cell_renderer_text, #centered_text, #change_directory, #check_button_is_checked, #check_for_a_manifest_yaml_file, #cliner, #clipboard_text?, #coloured_quit_button, #configuration?, #connect_the_skeleton, #create_a_new_file_chooser_dialog, #create_and_add_gtk_accel_group, #create_bold_cell_renderer, #create_centered_entry, #create_clipboard, #create_combobox_text, #create_context_menu, #create_entry_with_text_and_max_length, #create_font_chooser_dialog, #create_paned_hbox_first_big, #create_paned_vbox, #create_paned_vbox_last_big, #create_skeleton_then_connect_skeleton, #create_skeleton_then_connect_skeleton_then_apply_the_CSS_rules, #create_sourceview, #crimson, #css_background1, #css_provider?, #css_rules_to_apply?, #current_event?, #current_font_in_use?, #dd_mm_yy, #debug?, #default_application, #default_entry, default_gtk_adjustment?, #default_gtk_settings?, #default_notebook, #default_renderer, #delayed_css_change, #destroy_then_quit, #directory_content_widget, #directory_to_the_images?, #display_the_CSS_rules, #div, #do_apply_the_CSS_rules, #do_enable_debug, #do_popup, #drag_start, #drag_stop, #draggable_from_the_left_to_the_right_side, #draggable_left_to_right_pane, #drop_down_find_box, #e, #efancy, #eight_strings, #emoji, #emoji_image, #enable_default_grid_settings_for, #enable_these_key_combinations, #entry_with_this_completion, #esystem, #event_left_mouse_button_click?, #event_middle_mouse_button_click?, #event_right_mouse_button_click?, #ewarn, #exit_program, extended, #five_strings, #font_chooser_dialog, #four_strings, #gdk_screen, #gdk_selection_clipboard, #generate_css_class, #group_maximal, #gtk_about_dialog, #gtk_accel_group, #gtk_adjustment, #gtk_alignment, #gtk_application_window, #gtk_base_module, #gtk_bold_button, #gtk_bold_check_button, #gtk_bold_entry, #gtk_bold_frame, #gtk_bold_label, #gtk_bold_text_left_aligned, #gtk_button, #gtk_button_accel, #gtk_button_box, #gtk_button_box_spread, #gtk_button_with_label, #gtk_button_with_this_image, #gtk_button_xorg_buffer, #gtk_cell_renderer_centered_text, #gtk_cell_renderer_combo, #gtk_cell_renderer_pixbuf, #gtk_cell_renderer_right_aligned, #gtk_cell_renderer_text, #gtk_centered_spin_button, #gtk_check_button, #gtk_colour_black, #gtk_colour_button, #gtk_colour_grey, #gtk_colour_selection_dialog, #gtk_coloured_bar, #gtk_coloured_button, #gtk_combo_box, #gtk_combo_box_entry, #gtk_combo_box_text, #gtk_dialog, #gtk_drawing_area, #gtk_dropdown, #gtk_entry, #gtk_entry_completion, #gtk_entry_with_icon_name, #gtk_entry_with_secondary_icon_name, #gtk_eventbox, #gtk_expanded_expander, #gtk_expander, #gtk_file_chooser_button, #gtk_file_chooser_dialog, #gtk_file_filter, #gtk_fixed, #gtk_frame, #gtk_grid, #gtk_hbox, #gtk_hbox_with_vertical_pane, #gtk_hbutton_box, #gtk_header_bar, #gtk_hpaned, #gtk_hscale, #gtk_hseparator, #gtk_image, #gtk_image_menu_item, #gtk_input_field, #gtk_label, #gtk_left_aligned_bold_label, #gtk_left_aligned_button, #gtk_list_store, #gtk_list_store_table2, #gtk_list_store_table3, #gtk_list_store_table4, #gtk_main_quit, #gtk_markified_text, #gtk_markup, #gtk_menu, #gtk_menu_bar, #gtk_menu_item, #gtk_message_dialog, #gtk_message_dialog_run_then_destroy, #gtk_notebook, #gtk_option_menu, #gtk_password, #gtk_pixbuf, #gtk_popover, #gtk_progress_bar, #gtk_radio_button, #gtk_radio_menu_item, #gtk_resize_grip, #gtk_right_aligned_label, #gtk_runner_module, #gtk_scrollbar, #gtk_scrolled_window, #gtk_search_bar, #gtk_search_entry, #gtk_separator_menu_item, #gtk_size_group, #gtk_source_buffer, #gtk_source_view, #gtk_spin_button, #gtk_spinner, #gtk_state_normal, #gtk_status_icon, #gtk_statusbar, #gtk_statusbar_with_handle, #gtk_switch, #gtk_table, #gtk_table2, #gtk_table3, #gtk_text, #gtk_text_buffer, #gtk_text_left_aligned, #gtk_text_view, #gtk_themed_icon, #gtk_toggle_button, #gtk_toolbar, #gtk_tooltip_set_tip, #gtk_tooltip_widget, #gtk_tree_store, #gtk_tree_view, #gtk_tree_view_column, #gtk_vbox, #gtk_vbutton_box, #gtk_vpaned, #gtk_vruler, #gtk_vscale, #gtk_vseparator, #gtk_window, #h1, #h2, #h3, #h4, #h5, #h6, #hbox_text, #hbutton_box, #hcentered_entry, #horizontal_spacer, #html_table2, #icon_theme?, #icon_theme_default, #image_accessories_text_editor, #image_accessories_text_editor_symbolic_symbolic, #image_application_exit, #image_applications_system, #image_applications_system_symbolic_symbolic, #image_audio_speakers, #image_audio_volume_high, #image_audio_volume_low, #image_audio_x_generic_symbolic, #image_avatar_default, #image_bookmark_new, #image_cellular_signal_excellent_symbolic_symbolic, #image_computer, #image_dialog_question, #image_document_open, #image_document_revert, #image_document_save_as_symbolic_symbolic, #image_emblem_urgent, #image_folder_visiting_symbolic, #image_from_file, #image_from_pixbuf, #image_go_down, #image_go_up, #image_information, #image_inode_directory, #image_input_mouse, #image_left_arrow, #image_list_remove, #image_media_optical, #image_network_cellular_connected_symbolic_symbolic, #image_network_wireless_signal_excellent_symbolic, #image_play_button, #image_quit_action, #image_software_update_urgent, #image_starred, #image_system_search, #image_trophy_gold, #image_view_refresh_symbolic_symbolic, #image_web_browser, #increase_font_size, #initialize_gtk3, #interactive_change_the_font, #is_it_an_enter_key?, #is_mouse_button_event?, #is_mouse_button_release_event?, #is_not_decorated, #is_on_roebe?, #is_on_windows?, #label_then_entry, #left_aligned_selectable_text, #left_arrow_emoji, #left_label, #lightblue, #load_rules_from_the_project_css_file, #load_this_yaml_file, #main_file?, #main_font?, #max_height?, #max_resolution?, #max_width?, #mediumseagreen, #minimal_spacer, #missing_the_internal_hash?, #modify_bold_label, #modify_foreground, #modify_label, #more_css_then_apply_the_CSS_rules, #mouse_button_double_click?, #my_title?, #name_of_this_event?, #new_open_file_dialog, #no_file_exists_at, #options, #override_normal_background_color, #p, #padded_hbox, #padded_vbox, #paned_hbox, #paned_vbox, #pango_font_description, #parse_this_file_into_a_table, #percentage_widget, #percentage_widget_with_this_text, #pixbuf_from_file, #pixbuf_loader, #populate_the_internal_hash_with_the_default_values, #populate_this_list_store, #populate_this_list_store3, #populate_this_list_store4, #popup_over_this_widget, #popup_this_text_over_that_widget, #pre, #project_base_directory?, #project_yaml_directory?, #quit_button, #random_colour, #raw_cd, #read_in_from_this_css_theme, #register_sigint, #remove_all_pages, #remove_html, #replace_with_proper_tags, #report_current_dir, #reset_the_internal_variables, #reset_the_internal_variables_as_well_as_the_internal_hash, #resize_based_on_width_and_height_attributes, #response_type_ok?, #return_active_spinner, #return_combo_box_entry, #return_corresponding_gtk_stock_item, #return_current_time, #return_current_time_hh_mm_only, #return_debug_widget, #return_default_CSS_rules, #return_default_grid, #return_editable_cell_renderer_text, #return_emoji, #return_inactive_spinner, #return_p_tag, #return_pixbuf_based_on_the_default_icon_theme, #return_popover, #return_pwd, #return_scale_button, #return_scrollable_CSS_in_use_widget, #return_the_html_colours, #return_the_path_to_the_file_called_project_css, #return_the_title_from_the_config_file, #return_this_image_based_on_the_default_icon_theme, #return_top_bar, #rev, #right_arrow_emoji, #run_in_background, #run_in_background_if_is_on_roebe?, #run_main, #sbr, #scroll_down?, #scroll_up?, #sdir, #selectable_text, #set_background, #set_font, #set_font_in_use, #set_font_in_use_for_this_application, #set_this_widget, #set_width, #seven_strings, #sfancy, #sfile, #show_all, #show_debug_information, #simple_quit_button, #simplified_button_box, #six_strings, #smiley1, #smiley2, #smiley3, #smiley4, #smiley5, #spacer, #standard_file_chooser_dialog, #steelblue, #store_the_CSS_rules_into_a_local_file, #string_list_store, #swarn, #table2, #table3, #table4, #text_then_entry, #three_strings, #title?, #title_font, #title_height_width, #title_width_height, #title_width_height_font, #to_font_description, #to_utf, #tomato, #top_left, #try_to_require_the_open_gem, #try_to_set_the_xorg_buffer, #two_strings, #ungrab_application, #unicode_horizontal_spacer, #upon_delete_event_quit_the_application, #use_a_popular_reset_variant, #use_config_file?, #use_gtk?, #use_gtk_paradise_project_css_file, #use_lean_CSS_rules, #use_libui?, #use_these_css_classes, #uses_gtk2?, #uses_gtk3?, #uses_gtk4?, #vbutton_box, #vertical_spacer, #vte_terminal, #we_use_this_gtk_version?, #white_background, #width_height, #width_height_font, #width_title_height, #window_manager_name?, #window_or_vbox, #word_wrap, #write_what_into, #xid_value?
#clear_the_internal_hash, #commandline_arguments?, #first_argument?, #height?, #infer_the_namespace, #internal_hash?, #my_title?, #namespace?, #parent_widget?, #reset_the_internal_hash, #set_commandline_arguments, #set_height, #set_my_title, #set_parent_widget, #set_width, #width?
Methods inherited from Box
#add_space, #left_aligned_text, #text
Constructor Details
#initialize(location_of_the_image = :small_shield, label_title = '', text_colour = 'black', can_focus = false, run_already = true, &block) ⇒ NotebookTabWithIcon
#
initialize
Four input-arguments can be provided. Their meaning is:
(1) location_of_the_image # The location to the image that you wish to use.
(2) label_title # The title of the label, appearing next to the image
(3) text_colour # The colour of the label
(4) can_focus # whether the user can select (focus) on it
#
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
|
# File 'lib/gtk_paradise/widgets/gtk3/notebook_tab_with_icon/notebook_tab_with_icon.rb', line 58
def initialize(
location_of_the_image = :small_shield,
label_title = '',
text_colour = 'black',
can_focus = false,
run_already = true,
&block
)
super(:horizontal)
reset
set_label_title(label_title)
set_text_colour(text_colour)
set_location_of_the_image(
location_of_the_image
)
if block_given?
yielded = yield
if yielded.is_a? Hash
if yielded.has_key? :text_colour
set_text_colour(yielded[:text_colour])
end
if yielded.has_key? :use_close_image
use_close_image if yielded[:use_close_image]
end
if yielded.has_key? :placement
@placement = yielded.delete(:placement)
end
elsif yielded.is_a? Symbol
case yielded
when :right_side
set_placement(:right)
end
end
end
run if run_already
end
|
Class Method Details
.run(i = ARGV, &block) ⇒ Object
#
Gtk::NotebookTabWithIcon.run
#
467
468
469
470
471
472
473
474
475
476
477
478
|
# File 'lib/gtk_paradise/widgets/gtk3/notebook_tab_with_icon/notebook_tab_with_icon.rb', line 467
def self.run(
i = ARGV,
&block
)
require 'gtk_paradise/run'
_ = widget(i, :tabble, &block)
r = ::Gtk.run
r << _
r.automatic_size_then_automatic_title
r.enable_quick_exit
r.top_left_then_run
end
|
#
This method will return a new instance of Gtk::NotebookTabWithIcon.
#
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
|
# File 'lib/gtk_paradise/widgets/gtk3/notebook_tab_with_icon/notebook_tab_with_icon.rb', line 440
def self.widget(
use_this_title = '',
use_this_icon = :tabble,
&block
)
if use_this_title.is_a? Array
use_this_title = use_this_title.join(' ')
end
case use_this_title
when :default
use_this_title = 'Here is the original label.'
end
_ = ::Gtk::NotebookTabWithIcon.new(
use_this_icon,
use_this_title,
&block
)
_.make_bold
return _
end
|
Instance Method Details
#border_size? ⇒ Boolean
243
244
245
|
# File 'lib/gtk_paradise/widgets/gtk3/notebook_tab_with_icon/notebook_tab_with_icon.rb', line 243
def border_size?
2
end
|
#change_location_of_the_image(this_location = @location_of_the_image) ⇒ Object
#
change_location_of_the_image
With this you can manipulate @location_of_the_image
#
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
|
# File 'lib/gtk_paradise/widgets/gtk3/notebook_tab_with_icon/notebook_tab_with_icon.rb', line 276
def change_location_of_the_image(
this_location = @location_of_the_image
)
img = '/home/x/data/images/'
case this_location.to_s
when 'rand','r'
img_base = ENV['RUBY_GTK'].to_s+'/games/MINESWEEPER/images/symbols/'
case rand(7)
when 0 then set_location_of_the_image(img_base+'bang.png')
when 1 then set_location_of_the_image(img_base+'flag.png')
when 2 then set_location_of_the_image(img_base+'flag-question.png')
when 3 then set_location_of_the_image(img_base+'mine.png')
when 4 then set_location_of_the_image(
'/home/x/programming/ruby/src/cyberweb/lib/cyberweb/images/standard_images/TELEFON.png'
)
when 5 then change_location_of_the_image('bopen')
when 6 then change_location_of_the_image('bclose')
end
when 'shield',
's'
set_location_of_the_image(project_base_directory?+'images/misc/small_shield.png')
when /^-?-?close(_|-)?image$/,
/^-?-?close(_|-)?picture$/
set_location_of_the_image(project_base_directory?+'images/icons/close_image.png')
when 'alert',
'ausrufungszeichen'
set_location_of_the_image(img+'/STD/AUSRUFUNGSZEICHEN.png')
when /book_open/,
/bopen/
set_location_of_the_image(img+'/STD/BOOK_OPENED.png')
when /book_close/,
/bclose/
set_location_of_the_image(img+'/STD/BOOK_CLOSED.png')
end
end
|
#change_location_of_the_image_and_icon(i = @location_of_the_image) ⇒ Object
#
change_location_of_the_image_and_icon
#
183
184
185
186
187
188
|
# File 'lib/gtk_paradise/widgets/gtk3/notebook_tab_with_icon/notebook_tab_with_icon.rb', line 183
def change_location_of_the_image_and_icon(
i = @location_of_the_image
)
change_location_of_the_image(i)
change_icon(i)
end
|
#connect_skeleton ⇒ Object
#
connect_skeleton (connect tag)
#
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
|
# File 'lib/gtk_paradise/widgets/gtk3/notebook_tab_with_icon/notebook_tab_with_icon.rb', line 335
def connect_skeleton
abort_on_exception
case placement?
when :left
@grid.left(return_the_event_box)
@grid.right(modify_label(@label_title, @text_colour))
when :right
@grid.left(modify_label(@label_title, @text_colour))
@grid.right(return_the_event_box)
else
e 'Unknown placement.'
end
minimal(@grid)
end
|
#create_skeleton ⇒ Object
#
create_skeleton (create tag, skeleton tag)
#
419
420
421
422
|
# File 'lib/gtk_paradise/widgets/gtk3/notebook_tab_with_icon/notebook_tab_with_icon.rb', line 419
def create_skeleton
create_the_image
create_the_grid
end
|
#create_the_grid ⇒ Object
257
258
259
260
261
262
|
# File 'lib/gtk_paradise/widgets/gtk3/notebook_tab_with_icon/notebook_tab_with_icon.rb', line 257
def create_the_grid
@grid = default_grid
end
|
#create_the_image ⇒ Object
#
create_the_image
This will assign to the variable called @image.
#
175
176
177
178
|
# File 'lib/gtk_paradise/widgets/gtk3/notebook_tab_with_icon/notebook_tab_with_icon.rb', line 175
def create_the_image
@image = create_image
@image.set_padding(3, 1)
end
|
408
409
410
411
412
413
414
|
# File 'lib/gtk_paradise/widgets/gtk3/notebook_tab_with_icon/notebook_tab_with_icon.rb', line 408
def do_perform_either_the_destroy_the_widget_action_or_call_a_parent_method
if parent_widget?
parent_widget?.do_action_associated_with_the_icon_pressed(self)
else
destroy end
end
|
#index? ⇒ Boolean
371
372
373
|
# File 'lib/gtk_paradise/widgets/gtk3/notebook_tab_with_icon/notebook_tab_with_icon.rb', line 371
def index?
@index
end
|
#label_title? ⇒ Boolean
Also known as:
label_text?
152
153
154
|
# File 'lib/gtk_paradise/widgets/gtk3/notebook_tab_with_icon/notebook_tab_with_icon.rb', line 152
def label_title?
@label_title
end
|
#padding? ⇒ Boolean
236
237
238
|
# File 'lib/gtk_paradise/widgets/gtk3/notebook_tab_with_icon/notebook_tab_with_icon.rb', line 236
def padding?
4
end
|
#placement? ⇒ Boolean
166
167
168
|
# File 'lib/gtk_paradise/widgets/gtk3/notebook_tab_with_icon/notebook_tab_with_icon.rb', line 166
def placement?
@placement
end
|
#return_the_event_box ⇒ Object
#
return_the_event_box
When the user clicks on the event box containing our image (which may be a close button image, aka a ‘x’) then we will quit the part there.
#
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
|
# File 'lib/gtk_paradise/widgets/gtk3/notebook_tab_with_icon/notebook_tab_with_icon.rb', line 381
def return_the_event_box
hbox = create_hbox
hbox.css_class('BG_'+@background_colour.to_s)
hbox.minimal(@image, 1)
event_box = create_event_box(hbox)
event_box.signal_connect(:event) {|widget, event|
case event.to_s when /EventCrossing/
case event.name?
when 'GDK_ENTER_NOTIFY' hbox.remove_css_class('BG_'+@background_colour.to_s)
hbox.css_class('BG_lightskyblue')
when 'GDK_LEAVE_NOTIFY' hbox.remove_css_class('BG_lightskyblue')
hbox.css_class('BG_'+@background_colour.to_s)
end
end
}
event_box.on_clicked {
do_perform_either_the_destroy_the_widget_action_or_call_a_parent_method
}
return event_box
end
|
#run ⇒ Object
427
428
429
430
431
432
433
|
# File 'lib/gtk_paradise/widgets/gtk3/notebook_tab_with_icon/notebook_tab_with_icon.rb', line 427
def run
super()
change_location_of_the_image
update_icon
self.can_focus = false
show_all
end
|
#set_index(index = 0) ⇒ Object
364
365
366
|
# File 'lib/gtk_paradise/widgets/gtk3/notebook_tab_with_icon/notebook_tab_with_icon.rb', line 364
def set_index(index = 0)
@index = index
end
|
#set_label_title(i) ⇒ Object
145
146
147
|
# File 'lib/gtk_paradise/widgets/gtk3/notebook_tab_with_icon/notebook_tab_with_icon.rb', line 145
def set_label_title(i)
@label_title = i
end
|
#set_location_of_the_image(i = :default) ⇒ Object
#
set_location_of_the_image
#
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
|
# File 'lib/gtk_paradise/widgets/gtk3/notebook_tab_with_icon/notebook_tab_with_icon.rb', line 200
def set_location_of_the_image(i = :default)
case i
when :tabble,
:default
i = '/home/x/data/images/linux/TABBLE.png'
when :small_shield
i = project_base_directory?+
'images/misc/small_shield.png'
end
@location_of_the_image = i end
|
#set_placement(i = :right) ⇒ Object
159
160
161
|
# File 'lib/gtk_paradise/widgets/gtk3/notebook_tab_with_icon/notebook_tab_with_icon.rb', line 159
def set_placement(i = :right)
@placement = i.to_sym
end
|
#set_tab_pos(i) ⇒ Object
250
251
252
|
# File 'lib/gtk_paradise/widgets/gtk3/notebook_tab_with_icon/notebook_tab_with_icon.rb', line 250
def set_tab_pos(i)
super(i)
end
|
#set_text_colour(i) ⇒ Object
193
194
195
|
# File 'lib/gtk_paradise/widgets/gtk3/notebook_tab_with_icon/notebook_tab_with_icon.rb', line 193
def set_text_colour(i)
@text_colour = i
end
|
#update_icon(i = @location_of_the_image) ⇒ Object
#
update_icon
With this you can update the icon. It will always point to @location_of_the_image
#
223
224
225
226
227
228
229
230
231
|
# File 'lib/gtk_paradise/widgets/gtk3/notebook_tab_with_icon/notebook_tab_with_icon.rb', line 223
def update_icon(
i = @location_of_the_image
)
if File.exist? i
@image.set_file(i)
else
puts "No file exists at `#{i}`."
end
end
|
#use_close_image ⇒ Object
267
268
269
|
# File 'lib/gtk_paradise/widgets/gtk3/notebook_tab_with_icon/notebook_tab_with_icon.rb', line 267
def use_close_image
change_location_of_the_image(:close_image)
end
|