Class: Fiddle::Pointer

Inherits:
Object
  • Object
show all
Defined in:
lib/libui_paradise/fiddle/fiddle.rb

Overview

Fiddle::Pointer

Instance Method Summary collapse

Instance Method Details

#active?Boolean Also known as: is_active?

#

active?

#

Returns:

  • (Boolean)


747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 747

def active?
  current_widget = available_pointers?[self.object_id] # This will be an Array.
  pointer = current_widget.first
  type    = current_widget.last
  case type
  # ======================================================================= #
  # === :checkbox
  # ======================================================================= #
  when :checkbox
    checked = (::LibUI.checkbox_checked(pointer) == 1)
    return (checked == true)
  # ======================================================================= #
  # === :entry
  #
  # This is unhandled.
  # ======================================================================= #
  when :entry
    e 'An entry can not be "active". Check the code - there may '\
      'an erroneous assumption if the method .active? is called.'
  end
end

#add_hsepObject Also known as: add_horizontal_separator

#

add_hsep

This method adds a horizontal separator.

#


944
945
946
947
948
949
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 944

def add_hsep
  object_id = self.object_id
  hash = hash_fiddle_pointer_widgets?
  this_widget = hash[object_id].first
  this_widget.add(::LibuiParadise.horizontal_separator, 0)
end

#align_to_centerObject



1225
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1225

def align_to_center; end

#align_to_the_leftObject



1214
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1214

def align_to_the_left; end

#align_to_the_rightObject



1215
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1215

def align_to_the_right; end

#append(this_widget, padding_to_use = 1, *remaining_arguments) ⇒ Object Also known as: add, <<, pack_start

#

append (append tag, add tag)

This is simply a wrapper over LibUI.box_append().

#


361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 361

def append(
    this_widget,
    padding_to_use = 1,
    *remaining_arguments
  )
  if padding_to_use.is_a? Hash
    padding_to_use = 1 # Hardcoded exception.
  end
  if padding_to_use > 1
    padding_to_use = 1 # For now only a value of 1 seems to work.
  end
  current_widget = available_pointers?[self.object_id] # This will be an Array.
  _pointer = current_widget.first # Not used currently in this method.
  type     = current_widget.last
  left_position = LibuiParadise.counter_left?
  top_position  = LibuiParadise.counter_top?
  if remaining_arguments[1]
    top_position = remaining_arguments[1]
  end
  if remaining_arguments[0]
    left_position = remaining_arguments[0]
  else
    LibuiParadise.increment_counter_left
  end
  case type
  # ======================================================================= #
  # === :grid
  #
  # This entry-point is specifically for a ui-grid element.
  #
  # The positional arguments stand for:
  #
  #                     gtk-widget,  left, top, xspan, yspan, hexpand, halign, vexpand, valign
  #   grid_append(grid, entry1,      0, 0, 2, 1, 0, 0, 1, 0)
  #
  # ======================================================================= #
  when :grid
    LibUI.grid_append(
      self,
      this_widget.to_s,
      padding_to_use,
      left_position,
      top_position,
      remaining_arguments[2],
      remaining_arguments[3],
      remaining_arguments[4],
      remaining_arguments[5],
      remaining_arguments[6]
    )
  # ======================================================================= #
  # === :tab
  #
  # This is specifically for the notebook-tab. In this case the argument
  # names do not make a lot of sense. For instance, this_widget is
  # actually the text-title for the tab, and padding_to_use is the
  # actual widget that will be embedded. Because this is, however had,
  # the "minor use case", compared to the subsequent "else" clause, I
  # will keep the name as-is. The comment here should be kept, in order
  # to explain this peculiar oddity though.
  # ======================================================================= #
  when :tab
    LibUI.tab_append(self, this_widget.to_s, padding_to_use)
  # ======================================================================= #
  # === :window
  #
  # Add support for the toplevel window here, as of September 2021.
  # ======================================================================= #
  when :window
    LibUI.window_set_child(self, this_widget)
  else # This is the default.
    ::LibUI.box_append(
      self, this_widget, padding_to_use
    )
  end
end

#append_project_CSS_fileObject



1182
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1182

def append_project_CSS_file; end

#append_text_column(text, a, b = -1) ⇒ Object

#

append_text_column

This method is specifically used for libui-tables.

#


444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 444

def append_text_column(
    text,
    a,
    b = -1
  )
  object_id = self.object_id
  hash = hash_fiddle_pointer_widgets?
  type = hash[object_id].last # The last entry contains the type.
  case type
  # ======================================================================= #
  # === :table
  #
  # This is the primary entry point for this method.
  # ======================================================================= #
  when :table
    ::LibUI.table_append_text_column(self, text, a, b)
  else
    e 'Not registered type in .append_text_column(): '+type.to_s
  end
end

#append_this_array(array) ⇒ Object

#

append_this_array

This method only works for comboboxes.

#


608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 608

def append_this_array(array)
  object_id = self.object_id
  hash = hash_fiddle_pointer_widgets?
  _this_widget = hash[object_id].first # This variable is currently not in use.
  type        = hash[object_id].last
  case type
  # ======================================================================= #
  # === :combobox
  # ======================================================================= #
  when :combobox
    array.each {|this_entry|
      LibUI.combobox_append(self, this_entry)
    }
    LibUI.combobox_set_selected(self, 0) # The first one will be active too.    
  end
end

#append_this_string(i) ⇒ Object

#

append_this_string

This method can be used to append a String to an existing String.

#


1129
1130
1131
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1129

def append_this_string(i)
  ::LibUI.attributed_string_append_unattributed(self, i)
end

#autotitle(i = title? ) ⇒ Object

#

autotitle

#


931
932
933
934
935
936
937
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 931

def autotitle(
    i = title?
  )
  if i and respond_to?(:set_title)
    set_title(i)
  end
end

#available_pointers?Boolean Also known as: main_hash?, hash_fiddle_pointer_widgets?

#

available_pointers?

#

Returns:

  • (Boolean)


26
27
28
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 26

def available_pointers?
  ::LibuiParadise.hash_fiddle_pointer_widgets?
end

#bblack1Object

#

Skeleton methods

A “skeleton” method is one that doesn’t do anything right now. These were added to increase compatibility with the gtk_paradise gem in particular.

Some of these skeleton methods may become real methods one day, depending on how sophisticated the libui code will be - but until then we will simply use different options on different toolkits.

#


1159
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1159

def bblack1; end

#bblack2Object



1160
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1160

def bblack2; end

#bblack3Object



1161
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1161

def bblack3; end

#bblack4Object



1231
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1231

def bblack4; end

#border(i = '', *a) ⇒ Object



1239
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1239

def border(i = '', *a); end

#centerObject



1224
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1224

def center; end

#child(child_widget) ⇒ Object Also known as: children=, child=

#

child

This method should only be called on a LibUI-Window.

#


881
882
883
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 881

def child(child_widget)
  LibUI.window_set_child(self, child_widget)
end

#clear(current_widget = available_pointers?[self.object_id]) ⇒ Object

#

clear

#


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
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 34

def clear(
    current_widget = available_pointers?[self.object_id] # This will be an Array.
  )
  _pointer = current_widget.first # Not used currently in this method.
  type     = current_widget.last

  object_id = self.object_id
  hash = hash_fiddle_pointer_widgets?
  if type.nil?
    type = hash[object_id].last # This should be :grid. But it is not used here.
  end
  case type
  # ======================================================================= #
  # === :multiline_entry
  # ======================================================================= #
  when :multiline_entry
    ::LibUI.multiline_entry_set_text(self, '')
  # ======================================================================= #
  # === :combobox
  #
  # This currently does not work; it depends on libui-ng, which has not
  # yet been added completely.
  # ======================================================================= #
  when :combobox
  #   LibUI.multiline_entry_set_text(
  #     this_widget,
  #     display_this_text.to_s
  #   )
  else
    puts "Unhandled case in clear(): "\
         "#{type}"
  end
end

#clear_backgroundObject



1177
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1177

def clear_background; end

#clear_old_datapointsObject



1205
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1205

def clear_old_datapoints; end

#close_properlyObject Also known as: simple_exit, sane_exit, do_quit, should_quit

#

close_properly

This can be invoked via, for instance:

main_window.simple_exit
#


970
971
972
973
974
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 970

def close_properly
  LibUI.window_on_closing(self) {
    LibUI.exit_from(self)
  }
end

#css_class(i = '') ⇒ Object



1186
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1186

def css_class(i = ''); end

#default=(i = '') ⇒ Object



1196
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1196

def default=(i = ''); end

#default_styling(i = '') ⇒ Object



1267
1268
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1267

def default_styling(i = '')
end

#deselectObject



1259
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1259

def deselect; end

#disable(&block) ⇒ Object

#

disable (disable tag)

#


808
809
810
811
812
813
814
815
816
817
818
819
820
821
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 808

def disable(&block)
  object_id = self.object_id
  hash = hash_fiddle_pointer_widgets?
  type = hash[object_id].last # The last entry contains the type.
  case type
  # ======================================================================= #
  # === :button
  # ======================================================================= #
  when :button
    LibUI.control_disable(self)
  else
    e 'Not registered type in .disable(): '+type.to_s
  end
end

#disable_user_inputObject



1281
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1281

def disable_user_input; end

#do_centerObject



1198
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1198

def do_center; end

#do_focusObject



1237
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1237

def do_focus; end

#do_markifyObject



1195
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1195

def do_markify; end

#do_use_underlineObject



1192
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1192

def do_use_underline; end

#drag_via_left_to_right(a, b) ⇒ Object



1264
1265
1266
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1264

def drag_via_left_to_right(a, b)
  vbox(a, b)
end

#editable=(true_or_false = false) ⇒ Object



1180
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1180

def editable=(true_or_false = false); end

#empty?(type = nil) ⇒ Boolean

#

empty?

#

Returns:

  • (Boolean)


628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 628

def empty?(
    type = nil
  )
  object_id = self.object_id
  hash = hash_fiddle_pointer_widgets?
  if type.nil?
    # ===================================================================== #
    # In this case we must determine the type in use.
    # ===================================================================== #
    if hash.has_key? object_id
      type = hash[object_id].last # The last entry contains the type.
    end
  end
  case type
  # ======================================================================= #
  # === :entry
  # ======================================================================= #
  when :entry
    self.text?.empty?
  else
    return true
  end
end

#enable(&block) ⇒ Object

#

enable (enable tag)

#


826
827
828
829
830
831
832
833
834
835
836
837
838
839
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 826

def enable(&block)
  object_id = self.object_id
  hash = hash_fiddle_pointer_widgets?
  type = hash[object_id].last # The last entry contains the type.
  case type
  # ======================================================================= #
  # === :button
  # ======================================================================= #
  when :button
    LibUI.control_enable(self)
  else
    e 'Not registered type in .enable(): '+type.to_s
  end
end

#enable_all_eventsObject



1236
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1236

def enable_all_events; end

#enable_eventsObject



1235
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1235

def enable_events; end

#enable_free_form_cssObject



1212
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1212

def enable_free_form_css; end

#fancy_hint(i = '') ⇒ Object



1240
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1240

def fancy_hint(i = ''); end

#fancy_hint=(i = '') ⇒ Object



1242
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1242

def fancy_hint=(i = ''); end

#fancy_hints(i = '') ⇒ Object



1241
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1241

def fancy_hints(i = ''); end

#fancy_hints=(i = '') ⇒ Object



1243
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1243

def fancy_hints=(i = ''); end

#font=(i = '') ⇒ Object



1233
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1233

def font=(i = ''); end

#fraction=(i = '') ⇒ Object

#

fraction=

This method is mostly a wrapper to reach ruby-gtk3 compatibility.

#


984
985
986
987
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 984

def fraction=(i = '')
  i = i * 100
  set_value(i)
end

#group_maximal(*i) ⇒ Object

#

group_maximal

#


541
542
543
544
545
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 541

def group_maximal(*i)
  i.flatten.each {|entry|
    maximal(entry)
  }
end

#hash_grid(pass_this_widget, hash = {}) ⇒ Object Also known as: hash

#

hash_grid

Usage example:

hash_grid(text('Yo6'), { left: 0, top: 3, xspan: 1, yspan: 1, hexpand: 0, halign: 0, vexpand: 0, valign: 0 })
#


1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1052

def hash_grid(
    pass_this_widget,
    hash = {}
  )
  array_to_be_passed = []
  # ======================================================================= #
  # === :left
  # ======================================================================= #
  if hash.has_key? :left
    array_to_be_passed << hash[:left]
  else
    array_to_be_passed << 0
  end
  # ======================================================================= #
  # === :top
  # ======================================================================= #
  if hash.has_key? :top
    array_to_be_passed << hash[:top]
  else
    array_to_be_passed << 0
  end
  # ======================================================================= #
  # === :xspan
  # ======================================================================= #
  if hash.has_key? :xspan
    array_to_be_passed << hash[:xspan]
  else
    array_to_be_passed << 0
  end
  # ======================================================================= #
  # === :yspan
  # ======================================================================= #
  if hash.has_key? :yspan
    array_to_be_passed << hash[:yspan]
  else
    array_to_be_passed << 0
  end
  # ======================================================================= #
  # === :hexpand
  # ======================================================================= #
  if hash.has_key? :hexpand
    array_to_be_passed << hash[:hexpand]
  else
    array_to_be_passed << 0
  end
  # ======================================================================= #
  # === :halign
  # ======================================================================= #
  if hash.has_key? :halign
    array_to_be_passed << hash[:halign]
  else
    array_to_be_passed << 0
  end
  # ======================================================================= #
  # === :vexpand
  # ======================================================================= #
  if hash.has_key? :vexpand
    array_to_be_passed << hash[:vexpand]
  else
    array_to_be_passed << 0
  end
  # ======================================================================= #
  # === :valign
  # ======================================================================= #
  if hash.has_key? :valign
    array_to_be_passed << hash[:valign]
  else
    array_to_be_passed << 0
  end
  ui_grid_append(pass_this_widget, *array_to_be_passed)
end

#hint=(i = nil) ⇒ Object Also known as: popup_hint



1173
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1173

def hint=(i = nil); end

#horizontal_centerObject



1222
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1222

def horizontal_center; end

#hover(i = :hack_26) ⇒ Object

Currently not in use.



1251
1252
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1251

def hover(i = :hack_26) # Currently not in use.
end

#infer_the_size_automaticallyObject



1183
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1183

def infer_the_size_automatically; end

#is_margined(i = LibuiParadise.main_window?) ⇒ Object Also known as: uses_a_margin, has_margin

#

is_margined (margin tag, margined tag)

For now this only works on @main_window.

#


898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 898

def is_margined(
    i = LibuiParadise.main_window?
  )
  id = self.object_id
  hash = main_hash?
  if hash.has_key? id
    _ = hash[id]
    type = _.last
    case type
    # ===================================================================== #
    # === :window
    # ===================================================================== #
    when :window
      ::LibUI.window_set_margined(_.first, 1)
    else
      e 'The type '+type.to_s+' in is_margined() is currently not supported.'
    end
  else
    e
    e '-'*80
    e 'An unhandled situation has been created:'
    e
    e '  No available key in is_margined() for id: '+id.to_s
    e
    e '-'*80
    e
  end
end

#is_paddedObject

#

is_padded

#


844
845
846
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 844

def is_padded
  set_padded(1)
end

#is_read_only(current_widget = available_pointers?[self.object_id]) ⇒ Object Also known as: readonly

#

is_read_only

#


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
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 71

def is_read_only(
    current_widget = available_pointers?[self.object_id] # This will be an Array.
  )
  _pointer = current_widget.first # Not used currently in this method.
  type     = current_widget.last
  case type
  # ======================================================================= #
  # === :entry
  # ======================================================================= #
  when :entry
    ::LibUI.entry_set_read_only(self, 1)
  # ======================================================================= #
  # === :multiline_entry
  # ======================================================================= #
  when :multiline_entry
    ::LibUI.multiline_entry_set_read_only(self, 1)
  else
    pp 'The caller in is_read_only() will be shown next:'
    puts
    pp caller()
    puts
    puts "#{type} (class #{type.class}) is not yet implemented in .padded=."
    puts
  end
end

#left(widget, left = LibuiParadise.counter_left?, top = LibuiParadise.counter_top?, xspan = 1, yspan = 1) ⇒ Object Also known as: middle

#

left (left tag)

#


992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 992

def left(
    widget,
    left  = LibuiParadise.counter_left?,
    top   = LibuiParadise.counter_top?,
    xspan = 1,
    yspan = 1
  )
  object_id = self.object_id
  hash = hash_fiddle_pointer_widgets?
  type = hash[object_id].last # The last entry contains the type.
  case left
  # ======================================================================= #
  # === :default
  # ======================================================================= #
  when :default
    left = LibuiParadise.counter_left?
  end
  case top
  # ======================================================================= #
  # === :default
  # ======================================================================= #
  when :default
    top = LibuiParadise.counter_top?
  end
  case type
  # ======================================================================= #
  # === :vbox
  # ======================================================================= #
  when :vbox
    add(widget)
  # ======================================================================= #
  # === :grid
  # ======================================================================= #
  when :grid
    hash_grid(
      widget,
      {
        left:    left,
        top:     top,
        xspan:   xspan,
        yspan:   yspan,
        hexpand: 0,
        halign:  0,
        vexpand: 0,
        valign:  0
      }
    )
    LibuiParadise.counter_left += 1
  else
  end
end

#light_blue_backgroundObject



1250
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1250

def light_blue_background; end

#light_green_backgroundObject



1223
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1223

def light_green_background; end

#lightblueObject



1193
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1193

def lightblue; end

#lightgreenObject



1200
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1200

def lightgreen; end

#line_spacing=(i = 10) ⇒ Object



1208
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1208

def line_spacing=(i = 10); end

#main_then_quitObject

#

main_then_quit

We use ::LibUI just in case to avoid any possible name-collisions.

#


956
957
958
959
960
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 956

def main_then_quit
  ::LibUI.main
  ::LibUI.quit
  #::LibUI.uninit # Trying this since as of November 2023. Nope, does not work.
end

#make_boldObject



1190
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1190

def make_bold; end

#make_selectableObject



1226
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1226

def make_selectable; end

#maximal(this_widget, optional_padding = 1) ⇒ Object

#

maximal

#


550
551
552
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 550

def maximal(this_widget, optional_padding = 1)
  add(this_widget, optional_padding)
end

#maximizeObject

This should maximize the window. It does not yet work.



1255
1256
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1255

def maximize # This should maximize the window. It does not yet work.
end

#minimal(this_widget, optional_padding = 0) ⇒ Object

#

minimal

#


557
558
559
560
561
562
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 557

def minimal(
    this_widget,
    optional_padding = 0
  )
  add(this_widget, optional_padding)
end

#modify_background(a = :active, b = :coral) ⇒ Object



1175
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1175

def modify_background(a = :active,   b = :coral); end

#new_rowObject

#

new_row

#


100
101
102
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 100

def new_row
  ::LibuiParadise.new_row
end

#on_button_press_event(&block) ⇒ Object

#

on_button_press_event

#


1143
1144
1145
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1143

def on_button_press_event(&block)
  # e 'NOT YET IMPLEMENTED'
end

#on_changed(&block) ⇒ Object

#

on_changed

The idea for this method is to respond to on-changed events, in particular on a spinbox. Currently it is enabled for a few widgets, including :entry. This may be expanded at a later time to add on-changed support for more widgets.

For a combobox we may have to use this code:

LibUI.combobox_on_selected
  UI.spinbox_on_changed(self, spinbox_changed_callback, nil)
end

Be sure to pass the proc object into the method, in a block.

Usage examples:

text_entry.on_changed { text_changed_callback }
slider.on_changed { slider_changed_callback }
#


314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 314

def on_changed(&block)
  current_widget = available_pointers?[self.object_id] # This will be an Array.
  _pointer = current_widget.first # Not used currently in this method.
  type     = current_widget.last
  case type
  # ======================================================================= #
  # === :entry
  # ======================================================================= #
  when :entry
    ::LibUI.entry_on_changed(self, block.call, nil)
  # ======================================================================= #
  # === :multiline_entry
  # ======================================================================= #
  when :multiline_entry
    ::LibUI.multiline_entry_on_changed(self, block.call, nil)
  # ======================================================================= #
  # === :spinbox
  # ======================================================================= #
  when :spinbox
    ::LibUI.spinbox_on_changed(self, block.call, nil)
  # ======================================================================= #
  # === :slider
  #
  # This is for a slider bar.
  # ======================================================================= #
  when :slider
    ::LibUI.slider_on_changed(self, block.call, nil)
  # ======================================================================= #
  # === :colour_button
  # ======================================================================= #
  when :colour_button
    ::LibUI.color_button_on_changed(self, block.call, nil)
  # ======================================================================= #
  # === :combobox
  # ======================================================================= #
  when :combobox
    ::LibUI.combobox_on_selected(self, block.call, nil)
  else
    e 'Not registered type in .on_changed(): '+type.to_s
  end
end

#on_click_select_allObject



1197
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1197

def on_click_select_all; end

#on_clicked(&block) ⇒ Object Also known as: on_click_event

#

on_clicked

This method is in general called on a button-widget. It allows us to simulate the action associated with clicking on a button.

#


854
855
856
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 854

def on_clicked(&block)
  ::LibUI.button_on_clicked(self, &block)
end

#on_enterObject



1217
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1217

def on_enter; end

#on_enter_key(i = '') ⇒ Object



1245
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1245

def on_enter_key(i = ''); end

#on_hover(i = '') ⇒ Object



1199
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1199

def on_hover(i = ''); end

#on_hover_colour(i = '', &block) ⇒ Object



1258
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1258

def on_hover_colour(i = '', &block); end

#on_key_press_event(&block) ⇒ Object

#

on_key_press_event

#


1136
1137
1138
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1136

def on_key_press_event(&block)
  # e 'NOT YET IMPLEMENTED.'
end

#on_mouse_click_select_everythingObject



1232
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1232

def on_mouse_click_select_everything; end

#on_value_changedObject



1218
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1218

def on_value_changed; end

#pad10pxObject



1171
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1171

def pad10px; end

#pad1pxObject



1162
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1162

def pad1px;  end

#pad2pxObject



1163
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1163

def pad2px;  end

#pad3pxObject



1164
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1164

def pad3px;  end

#pad4pxObject



1165
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1165

def pad4px;  end

#pad5pxObject



1166
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1166

def pad5px;  end

#pad6pxObject



1167
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1167

def pad6px;  end

#pad7pxObject



1168
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1168

def pad7px;  end

#pad8pxObject



1169
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1169

def pad8px;  end

#pad9pxObject



1170
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1170

def pad9px;  end

#padded=(pad_n_px = 25, type = nil) ⇒ Object Also known as: set_padded, set_padding

#

padded=

Set a uniform padding via this method.

#


657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 657

def padded=(
    pad_n_px = 25, # How much to pad in n px. LibUI currently does not allow for that, though.
    type     = nil
  )
  object_id = self.object_id
  hash = hash_fiddle_pointer_widgets?
  if type.nil?
    # ===================================================================== #
    # In this case we must determine the type in use.
    # ===================================================================== #
    if hash.has_key? object_id
      type = hash[object_id].last # The last entry contains the type.
    end
  end
  case type
  # ======================================================================= #
  # === :window
  # ======================================================================= #
  when :window
    LibUI.window_set_margined(self, 1)
  # ======================================================================= #
  # === :grid
  # ======================================================================= #
  when :grid
    LibUI.grid_set_padded(self, pad_n_px) # This line should be changed at a later time.
  # ======================================================================= #
  # === :button
  #
  # This entry point probably does not work, so don't use it.
  # ======================================================================= #
  when :button
    LibUI.box_set_padded(self, pad_n_px)
  # ======================================================================= #
  # === :vbox
  # ======================================================================= #
  when :vbox,
       :hbox
    LibUI.box_set_padded(self, pad_n_px)
  # ======================================================================= #
  # === :entry
  # ======================================================================= #
  when :entry
    # ===================================================================== #
    # This method does not seem to exist. We'll leave this here for the
    # time being.
    # ===================================================================== #
    # LibUI.entry_set_padded(self, pad_n_px) # This line should be changed at a later time.
  else
    pp caller()
    puts "#{type} (class #{type.class}) is not yet implemented in .padded=."
  end
end

#padding=(i = 8) ⇒ Object

#

This is currently not in use.

#


1272
1273
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1272

def padding=(i = 8)
end

#populate(dataset) ⇒ Object

#

populate

This method will (try to) populate a combobox in LibUI.

#


863
864
865
866
867
868
869
870
871
872
873
874
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 863

def populate(dataset)
  object_id = self.object_id
  hash = hash_fiddle_pointer_widgets?
  type = hash[object_id].last
  case type
  # ======================================================================= #
  # === :combobox
  # ======================================================================= #
  when :combobox
    self.append_this_array(dataset)
  end
end

#position=(i = 10) ⇒ Object



1178
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1178

def position=(i = 10); end

#remove_backgroundObject



1229
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1229

def remove_background; end

#reset_the_internal_variablesObject



1179
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1179

def reset_the_internal_variables; end

#return_all_entriesObject

def fraction=(i = ”); end



1261
1262
1263
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1261

def return_all_entries
  []
end

#right(widget, left = LibuiParadise.counter_left?, top = LibuiParadise.counter_top?, xspan = 1, yspan = 1) ⇒ Object

#

right (right tag)

#


107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 107

def right(
    widget,
    left  = LibuiParadise.counter_left?,
    top   = LibuiParadise.counter_top?,
    xspan = 1,
    yspan = 1
  )
  object_id = self.object_id
  hash = hash_fiddle_pointer_widgets?
  type = hash[object_id].last # The last entry contains the type.
  case left
  # ======================================================================= #
  # === :default
  # ======================================================================= #
  when :default
    left = LibuiParadise.counter_left?
  end
  case top
  # ======================================================================= #
  # === :default
  # ======================================================================= #
  when :default
    top = LibuiParadise.counter_top?
  end
  case type
  # ======================================================================= #
  # === :vbox
  # ======================================================================= #
  when :vbox
    add(widget)
  # ======================================================================= #
  # === :grid
  # ======================================================================= #
  when :grid
    hash_grid(
      widget,
      {
        left:    left,
        top:     top,
        xspan:   xspan,
        yspan:   yspan,
        hexpand: 0,
        halign:  0,
        vexpand: 0,
        valign:  0
      }
    )
    # ===================================================================== #
    # And we must add a new row next:
    # ===================================================================== #
    LibuiParadise.new_row
  else
  end
end

#rounded_border(a = '', b = '', c = '') ⇒ Object



1230
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1230

def rounded_border(a = '', b = '', c = ''); end

#row_spacing=(i = 10) ⇒ Object



1207
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1207

def row_spacing=(i = 10); end

#set_activates_default(i = true) ⇒ Object



1234
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1234

def set_activates_default(i = true); end

#set_activeObject Also known as: is_active, is_now_active

#

set_active

#


772
773
774
775
776
777
778
779
780
781
782
783
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 772

def set_active
  current_widget = available_pointers?[self.object_id] # This will be an Array.
  pointer = current_widget.first
  type    = current_widget.last
  case type
  # ======================================================================= #
  # === :checkbox
  # ======================================================================= #
  when :checkbox
    ::LibUI.checkbox_set_checked(pointer, 1)
  end
end

#set_background_colour(i = '') ⇒ Object



1201
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1201

def set_background_colour(i = ''); end

#set_border_width(i = 2) ⇒ Object Also known as: set_border_size



1187
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1187

def set_border_width(i = 2); end

#set_colour(i = 'blue') ⇒ Object



1189
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1189

def set_colour(i = 'blue'); end

#set_column_spacing(i = 1) ⇒ Object



1184
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1184

def set_column_spacing(i = 1); end

#set_editable(i = true) ⇒ Object



1210
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1210

def set_editable(i = true); end

#set_focus(true_or_false = true) ⇒ Object



1176
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1176

def set_focus(true_or_false = true); end

#set_font(i = '') ⇒ Object



1194
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1194

def set_font(i = ''); end

#set_font_size(i = :hack_26) ⇒ Object

Currently not in use.



1253
1254
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1253

def set_font_size(i = :hack_26) # Currently not in use.
end

#set_homogeneous(i = true) ⇒ Object



1238
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1238

def set_homogeneous(i = true); end

#set_inactiveObject Also known as: is_inactive, is_now_inactive

#

set_inactive

This method currently only works for libui-checkboxes.

#


791
792
793
794
795
796
797
798
799
800
801
802
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 791

def set_inactive
  current_widget = available_pointers?[self.object_id] # This will be an Array.
  pointer = current_widget.first
  type    = current_widget.last
  case type
  # ======================================================================= #
  # === :checkbox
  # ======================================================================= #
  when :checkbox
    ::LibUI.checkbox_set_checked(pointer, 0)
  end
end

#set_max_length(n = 100) ⇒ Object



1181
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1181

def set_max_length(n = 100); end

#set_name(i = '') ⇒ Object



1191
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1191

def set_name(i = ''); end

#set_row_spacing(i = 1) ⇒ Object



1185
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1185

def set_row_spacing(i = 1); end

#set_size(a = 42, b = 42) ⇒ Object



1203
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1203

def set_size(a = 42, b = 42); end

#set_size_request(a = 42, b = 42) ⇒ Object



1202
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1202

def set_size_request(a = 42, b = 42); end

#set_text(display_this_text = '', type = nil) ⇒ Object Also known as: set_content

#

set_text

This method can be used to set the text of a particular libui-widget, in particular entries.

#


471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 471

def set_text(
    display_this_text = '', # This is the text that will be used.
    type              = nil
  )
  object_id = self.object_id
  hash = hash_fiddle_pointer_widgets?
  this_widget = hash[object_id].first
  if type.nil?
    type = hash[object_id].last # This should be :grid. But it is not used here.
  end
  case type
  # ======================================================================= #
  # === :new_progress_bar
  # ======================================================================= #
  when :new_progress_bar
    # This currently does nothing.
  # ======================================================================= #
  # === :multiline_entry
  #
  # This is a text-view widget actually.
  # ======================================================================= #
  when :multiline_entry
    LibUI.multiline_entry_set_text(
      this_widget,
      display_this_text.to_s
    )
  # ======================================================================= #
  # === :text
  # ======================================================================= #
  when :text,
       :label
    LibUI.label_set_text(
      this_widget,
      display_this_text.to_s
    )
  # ======================================================================= #
  # === :textview
  # ======================================================================= #
  when :textview
    LibUI.multiline_entry_set_text(
      this_widget,
      display_this_text.to_s
    )
  # ======================================================================= #
  # === :entry
  # ======================================================================= #
  when :entry
    LibUI.entry_set_text(
      this_widget,
      display_this_text.to_s
    )
  # ======================================================================= #
  # === :search_entry
  #
  # This is specifically for a search-entry.
  # ======================================================================= #
  when :search_entry
    LibUI.entry_set_text(
      this_widget,
      display_this_text.to_s
    )
  else
    puts 'Unhandled case in set_text(): '+
         type.to_s
  end
end

#set_value(new_value) ⇒ Object Also known as: value=, start_position=

#

set_value

This method has initially been created to assign a value to a spinbutton. That way the following API is made possible:

spinbutton.set_value(42)
#


573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 573

def set_value(
    new_value
  )
  object_id = self.object_id
  hash = hash_fiddle_pointer_widgets?
  this_widget = hash[object_id].first
  type = hash[object_id].last
  case type
  # ======================================================================= #
  # === :new_progress_bar
  #
  # This is actually a progress-bar.
  # ======================================================================= #
  when :new_progress_bar,
       :progress_bar
    ::LibUI.progress_bar_set_value(this_widget, new_value.to_i)
  # ======================================================================= #
  # === :spinbox
  # ======================================================================= #
  when :spinbox
    ::LibUI.spinbox_set_value(
      this_widget,
      new_value.to_i # Must be an Integer.
    )
  else
    e 'Not registered type: '+type.to_s
  end
end

#shadow_hint=(i = '') ⇒ Object



1244
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1244

def shadow_hint=(i = ''); end

#show_allObject

This one here may become a real method one day, but right now I don’t know how to enable that.



1213
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1213

def show_all; end

#show_the_controlsObject Also known as: control_show

#

show_the_controls

#


889
890
891
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 889

def show_the_controls
  ::LibUI.control_show(self)
end

#show_then_main_then_quit(optional_widget = nil) ⇒ Object Also known as: elegant_exit, complex_finalizer, intelligent_close_down, intelligent_quit, intelligent_exit

#

show_then_main_then_quit

This method ultimately combines three other method calls, or even four, since as of December 2023.

The argument that this method accepts is the main window.

#


222
223
224
225
226
227
228
229
230
231
232
233
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 222

def show_then_main_then_quit(
    optional_widget = nil
  )
  # ======================================================================= #
  # First handle non-nil arguments given.
  # ======================================================================= #
  if optional_widget
    self << optional_widget
  end
  ::LibUI.control_show(self)
  main_then_quit
end

#signal_connect(i = '') ⇒ Object



1246
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1246

def signal_connect(i = ''); end

#spacing1=(i = 2) ⇒ Object



1247
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1247

def spacing1=(i = 2); end

#spacing2=(i = 2) ⇒ Object



1248
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1248

def spacing2=(i = 2); end

#spacing=(i = 0) ⇒ Object



1249
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1249

def spacing=(i = 0); end

#text(i = '', padding_to_use = 0) ⇒ Object Also known as: add_text

#

text

This ad-hoc method can be used to write text onto a widget.

Usage example:

outer_vbox.text(
  'This widget can be used to modify the ID3 tags '\
  'of .mp3 files. The taglib-ruby gem is required for this functionality.'
)
#


724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 724

def text(
    i              = '',
    padding_to_use = 0
  )
  i = i.to_s # Let's ensure we have a String past this point.
  object_id = self.object_id
  hash = hash_fiddle_pointer_widgets?
  _this_widget = hash[object_id].first # This variable is currently not in use.
  type        = hash[object_id].last
  case type
  # ======================================================================= #
  # === :vbox
  # ======================================================================= #
  when :vbox,
       :hbox
    _ = ui_text(i)
    self.add(_, padding_to_use)
  end
end

#text?(type = nil) ⇒ Boolean Also known as: buffer?, value?, selected?

#

text?

This method queries the content of any widget that may contain text, in particular entries such as a gtk-entry.

#

Returns:

  • (Boolean)


245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 245

def text?(
    type = nil
  )
  object_id = self.object_id
  hash = hash_fiddle_pointer_widgets?
  if type.nil?
    # ===================================================================== #
    # In this case we must determine the type in use.
    # ===================================================================== #
    if hash.has_key? object_id
      type = hash[object_id].last # The last entry contains the type.
    end
  end
  case type
  # ======================================================================= #
  # === :label
  # ======================================================================= #
  when :label
    return LibUI.label_text(self).to_s
  # ======================================================================= #
  # === :new_progress_bar
  #
  # This is actually a progress-bar.
  # ======================================================================= #
  when :new_progress_bar,
       :progress_bar
    return LibUI.progress_bar_value(self).to_s
  # ======================================================================= #
  # === :multiline_entry
  #
  # This is, I believe, synonymous to :textview.
  # ======================================================================= #
  when :multiline_entry,
       :textview
    return LibUI.multiline_entry_text(self).to_s
  # ======================================================================= #
  # === :combobox
  # ======================================================================= #
  when :combobox
    return LibUI.combobox_selected(self).to_s
  else # This is the "historic" default. May have to be removed one day.
    return LibUI.entry_text(self).to_s
  end
end

#the_first_entry_is_activeObject



1204
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1204

def the_first_entry_is_active; end

#to_the_leftObject



1209
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1209

def to_the_left; end

#try_to_add_default_CSS_rulesObject



1211
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1211

def try_to_add_default_CSS_rules; end

#try_to_use_this_font(i = nil) ⇒ Object Also known as: use_this_font=, set_use_this_font



1219
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1219

def try_to_use_this_font(i = nil); end

#uniform_spacing(i = 8) ⇒ Object

#

uniform_spacing

#


1278
1279
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1278

def uniform_spacing(i = 8)
end

#use_gtk_paradise_project_css_fileObject



1257
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1257

def use_gtk_paradise_project_css_file; end

#very_light_yellow_backgroundObject



1227
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1227

def very_light_yellow_background; end

#very_light_yellowish_backgroundObject



1228
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1228

def very_light_yellowish_background; end

#width_height(a = 500, b = 500) ⇒ Object



1206
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1206

def width_height(a = 500, b = 500); end

#yellow_backgroundObject



1172
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1172

def yellow_background; end

#yellowish_backgroundObject



1216
# File 'lib/libui_paradise/fiddle/fiddle.rb', line 1216

def yellowish_background; end