Module: LibuiParadise::Extensions

Included in:
FontExample, Base, GUI::LibUI::EntryRespondsToCommentAsSynonymousToTheEnterKeyPressedExample, GUI::LibUI::NotificationFunctionalityExample, GUI::LibUI::ProgressbarExample, GUI::LibUI::Prototype, GUI::LibUI::TableExample
Defined in:
lib/libui_paradise/libui_classes/box.rb,
lib/libui_paradise/libui_classes/grid.rb,
lib/libui_paradise/extensions/extensions.rb,
lib/libui_paradise/libui_classes/libui_classes.rb

Overview

LibuiParadise::Extensions

Constant Summary collapse

WIDTH =
#

WIDTH

#
1024

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.area(i = :use_new_area_handler) ⇒ Object

#

LibuiParadise::Extensions.area

AreaHandler defines the functionality needed for handling events from an Area.

Upstream documentation, at the least for Go, can be found here:

https://github.com/andlabs/ui/blob/master/areahandler.go
#


1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 1278

def self.area(
    i = :use_new_area_handler
  )
  case i
  # ======================================================================= #
  # === :use_new_area_handler
  # ======================================================================= #
  when :use_new_area_handler,
       :default
    # ===================================================================== #
    # malloc a new area-handled next:
    # ===================================================================== #
    i = ::LibUI::FFI::AreaHandler.malloc
    i.to_ptr.free = Fiddle::RUBY_FREE # This one is done in upstream LibUI as well.
  end
  _ = ::LibUI.new_area(i) # Our new area, with the given handler.
  add_to_the_registered_widgets(_, __method__)
  return _
end

.button(text) ⇒ Object

#

LibuiParadise::Extensions.button (button tag)

The upstream API for buttons, in C, can be found here:

https://raw.githubusercontent.com/andlabs/libui/master/unix/button.c
#


797
798
799
800
801
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 797

def self.button(text)
  _ = ::LibUI.new_button(text)
  ::LibuiParadise::Extensions.register_this_fiddle_pointer_widget(_, __method__)
  return _
end

.checkbox(i = '') ⇒ Object

#

LibuiParadise::Extensions.checkbox (checkbox tag)

#


766
767
768
769
770
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 766

def self.checkbox(i = '')
  _ = ::LibUI.new_checkbox(i)
  add_to_the_registered_widgets(_, __method__)
  return _
end

.colour_buttonObject

#

LibuiParadise::Extensions.new_colour_button

The upstream API for a colour-button (in C) can be found here:

https://github.com/andlabs/libui/blob/master/unix/colorbutton.c
#


961
962
963
964
965
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 961

def self.colour_button
  _ = ::LibUI.new_color_button
  ::LibuiParadise::Extensions.register_this_fiddle_pointer_widget(_, __method__)
  return _
end

.combobox(optional_array = nil, &block) ⇒ Object

#

LibuiParadise::Extensions.combobox

#


1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 1135

def self.combobox(
    optional_array = nil, &block
  )
  combobox = ::LibUI.new_combobox
  # ======================================================================= #
  # Register it at once:
  # ======================================================================= #
  add_to_the_registered_widgets(combobox, __method__)
  if block_given?
    optional_array = yield
  end
  if optional_array and optional_array.is_a?(Array)
    # append_this_array_to_that_combobox(optional_array, combobox)
    combobox.append_this_array(optional_array)
  end
  return combobox
end

.current_widget_pointer?Boolean

#

LibuiParadise::Extensions.current_widget_pointer?

#

Returns:

  • (Boolean)


202
203
204
# File 'lib/libui_paradise/extensions/extensions.rb', line 202

def self.current_widget_pointer?
  LibuiParadise::Extensions.hash_fiddle_pointer_widgets?.values.last.first
end

.draw_rectangle(width = :default, height = :default, colour = :orange) ⇒ Object

#

LibuiParadise::Extensions.draw_rectangle

This method can be used to draw a rectangle.

The third argument should be a HTML colour.

#


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
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
# File 'lib/libui_paradise/extensions/extensions.rb', line 672

def self.draw_rectangle(
    width  = :default,
    height = :default,
    colour = :orange
  )
  unless ::LibuiParadise.respond_to?(:padded_vbox)
    require 'libui_paradise/libui_classes/vbox.rb'
  end
  unless Object.const_defined? :Colours
    begin
      require 'colours'
    rescue LoadError; end
  end
  case width
  # ======================================================================= #
  # === :default
  # ======================================================================= #
  when :default
    width = 25
  end
  case height
  # ======================================================================= #
  # === :default
  # ======================================================================= #
  when :default
    height = 25
  end
  handler = LibUI::FFI::AreaHandler.malloc
  handler.to_ptr.free = Fiddle::RUBY_FREE
  area    = LibUI.new_area(handler)
  brush   = LibUI::FFI::DrawBrush.malloc
  brush.to_ptr.free = Fiddle::RUBY_FREE

  handler_draw_event = Fiddle::Closure::BlockCaller.new(0, [1, 1, 1]) { |_, _, area_draw_params|
    path = LibUI.draw_new_path(0)
    LibUI.draw_path_add_rectangle(path, 0, 0, width, height)
    LibUI.draw_path_end(path)
    brush.Type = 0
    # ===================================================================== #
    # Need to find out the true RGB values. For now we divide by 255.
    #
    # See here:
    #
    #   https://stackoverflow.com/questions/10848990/rgb-values-to-0-to-1-scale
    #
    # ===================================================================== #
    array = Colours.colour_to_rgb(colour)
    brush.R = array[0] / 255.0 # 0.4
    brush.G = array[1] / 255.0 # 0.4
    brush.B = array[2] / 255.0 # 0.8
    brush.A = 1.0
    area_draw_params = LibUI::FFI::AreaDrawParams.new(area_draw_params)
    LibUI.draw_fill(area_draw_params.Context, path, brush.to_ptr)
    LibUI.draw_free_path(path)
  }

  do_nothing = Fiddle::Closure::BlockCaller.new(0, [0]) {}
  key_event  = Fiddle::Closure::BlockCaller.new(1, [0]) { 0 }

  handler.Draw         = handler_draw_event
  handler.MouseEvent   = do_nothing
  handler.MouseCrossed = do_nothing
  handler.DragBroken   = do_nothing
  handler.KeyEvent     = key_event

  box = ::LibuiParadise.padded_vbox
  box.maximal(area)
  return box
end

.editable_combobox(optional_array = nil, &block) ⇒ Object

#

LibuiParadise::Extensions.editable_combobox

This is a combo-box that the user can modify.

#


1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 1117

def self.editable_combobox(
    optional_array = nil, &block
  )
  _ = ::LibUI.new_editable_combobox
  if block_given?
    optional_array = yield
  end
  if optional_array and optional_array.is_a?(Array)
    append_this_array_to_that_combobox(optional_array, _)
  end
  add_to_the_registered_widgets(_, __method__)
  return _
end

.entry(optional_text = '') ⇒ Object

#

LibuiParadise::Extensions.entry (entry tag)

The upstream C API for libui-entry can be found here:

https://github.com/andlabs/libui/blob/master/unix/entry.c

This method is tapping into LibUI.new_entry.

Usage example:

entry1 = LibUI.entry('ATG')
#


495
496
497
498
499
500
501
502
503
504
505
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 495

def self.entry(
    optional_text = ''
  )
  optional_text = optional_text.to_s
  entry = ::LibUI.new_entry
  unless optional_text.empty?
    ::LibUI.entry_set_text(entry, optional_text)
  end
  add_to_the_registered_widgets(entry, __method__)
  return entry
end

.extended(i) ⇒ Object

#

LibuiParadise::Extensions.extended

This method taps into the extended-hook - see the code in the method shown above this method.

The purpose of this hook is to automatically call .init. This saves us one line of code.

In regular LibUI code this is equal to:

UI.init
#


275
276
277
278
279
280
281
# File 'lib/libui_paradise/extensions/extensions.rb', line 275

def self.extended(i)
  if i.respond_to? :init
    i.init
  else
    ::LibUI.init
  end
end

.font(&block) ⇒ Object

#

LibuiParadise::Extensions.font (font tag, fonts tag)

#


561
562
563
564
565
566
567
568
569
570
571
572
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
601
602
603
604
605
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 561

def self.font(&block)
  use_this_font = ::LibUI::FFI::FontDescriptor.malloc
  if block_given?
    yielded = yield
    if yielded.is_a? Hash
      # =================================================================== #
      # === :font_size
      # =================================================================== #
      if yielded.has_key? :font_size
        use_this_font.Size = yielded.delete(:font_size)
      end
      # =================================================================== #
      # === :font_family
      # =================================================================== #
      if yielded.has_key? :font_family
        use_this_font.Family = yielded.delete(:font_family)
      end
      # =================================================================== #
      # === :stretch
      # =================================================================== #
      if yielded.has_key? :stretch
        use_this_font.Stretch = yielded.delete(:stretch)
      end
      # =================================================================== #
      # === :weight
      # =================================================================== #
      if yielded.has_key? :weight
        use_this_font.Weight = yielded.delete(:weight)
      end
      # =================================================================== #
      # === :italic
      # =================================================================== #
      if yielded.has_key? :italic
        _ = yielded.delete(:italic_family)
        if _ == true
          _ = 1
        elsif _ == false
          _ = 0
        end
        use_this_font.Italic = _
      end
    end
  end
  return use_this_font
end

.font_buttonObject

#

LibuiParadise::Extensions.font_button

Create a new font button via this method.

#


874
875
876
877
878
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 874

def self.font_button
  _ = ::LibUI.new_font_button
  add_to_the_registered_widgets(_, __method__)
  return _
end

.gridObject

#

LibuiParadise::Extensions.grid (grid tag)

To insert into a grid, try to use this API:

uiGridInsertAt(
  uiGrid *g,
  uiControl *c,
  uiControl *existing,
  uiAt at,
  int xspan,
  int yspan,
  int hexpand,
  uiAlign halign, int vexpand, uiAlign valign
)

Example to add a new entry onto the grid:

UI.grid_append(grid, text('Yo2'), 1, 0, 1, 1, 0, 0, 1, 0)
#


32
33
34
35
36
# File 'lib/libui_paradise/libui_classes/grid.rb', line 32

def self.grid
  _ = ::LibUI.new_grid
  add_to_the_registered_widgets(_, __method__)
  return _
end

.hash_fiddle_pointer_widgets?Boolean

#

LibuiParadise::Extensions.hash_fiddle_pointer_widgets?

#

Returns:

  • (Boolean)


83
84
85
# File 'lib/libui_paradise/extensions/extensions.rb', line 83

def self.hash_fiddle_pointer_widgets?
  @hash_fiddle_pointer_widgets
end

.hbox(*optional_widgets) ⇒ Object

#

LibuiParadise::Extensions.hbox (hbox tag)

This method will create a horizontal box.

#


42
43
44
45
46
47
48
49
50
51
# File 'lib/libui_paradise/libui_classes/box.rb', line 42

def self.hbox(*optional_widgets)
  _ = ::LibUI.new_horizontal_box
  add_to_the_registered_widgets(_, __method__)
  if optional_widgets and !optional_widgets.flatten.empty?
    optional_widgets.flatten.each {|this_widget|
      _.add(this_widget)
    }
  end
  return _
end

.hello_worldObject

#

LibuiParadise::Extensions.hello_world

This is merely an ad-hoc test.

#


230
231
232
# File 'lib/libui_paradise/extensions/extensions.rb', line 230

def self.hello_world
  e 'Hello world!'
end

.horizontal_separatorObject

#

LibuiParadise::Extensions.horizontal_separator

This method will add a new horizontal separator. The name “hsep” is a shorter alias to this.

#


445
446
447
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 445

def self.horizontal_separator
  ::LibUI.new_horizontal_separator
end

.image(this_file, width = :try_to_infer_automatically, height = :infer_automatically) ⇒ Object

#

Libuiparadise::Extensions.image

This is currently limited to .png files only, due to ChunkyPng.

At some later point in the future this limitation may be lifted. For now it has to remain in place.

#


839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 839

def self.image(
    this_file,
    width  = :try_to_infer_automatically,
    height = :infer_automatically
  )
  if (width  == :infer_automatically) or
     (height == :infer_automatically)
    unless Object.const_defined? :ChunkyPNG
      begin
        require 'chunky_png'
      rescue LoadError; end
    end
    canvas = ChunkyPNG::Canvas.from_file(this_file)
    data   = canvas.to_rgba_stream
    width  = canvas.width
    height = canvas.height
    _ = ::LibUI.new_image(width, height) # Create the image here.
    add_to_the_registered_widgets(_, __method__)
    ::LibUI.image_append(
      _,
      data,
      width,
      height,
      width
    )
    return _
  end
  nil
end

.initializerObject

#

LibuiParadise::Extensions.initializer

#


255
256
257
258
259
# File 'lib/libui_paradise/extensions/extensions.rb', line 255

def self.initializer
  LibuiParadise::Extensions.register_sigint
  Object.const_set('UI', LibUI) # This is equal to: UI = LibUI
  ::LibUI.extend(LibuiParadise::Extensions) # This call will also trigger the extended-hook.
end

.label(i = '') ⇒ Object

#

LibuiParadise::Extensions.label (text tag, label tag)

Add text to the widget at hand. This is actually called a “label”.

#


1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 1195

def self.label(
    i = ''
  )
  if i.include? '</'
    # ===================================================================== #
    # For now we must remove "HTML tags" from the given input. Perhaps
    # at some later point in time we can retain them.
    # ===================================================================== #
    i = i.dup if i.frozen?
    i.gsub!(%r{<[^>]+>}, '')
  end
  _ = ::LibUI.new_label(i.to_s)
  add_to_the_registered_widgets(_, __method__)
  return _
end

.main_window?Boolean

#

LibuiParadise::Extensions.main_window?

#

Returns:

  • (Boolean)


283
284
285
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 283

def self.main_window?
  @main_window
end
#

LibuiParadise::Extensions.menu (menu tag)

#


626
627
628
629
630
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 626

def self.menu(title = '')
  _ = ::LibUI.new_menu(title)
  add_to_the_registered_widgets(_, __method__)
  return _
end

.message_box_error(main_window = LibuiParadise.main_window?, title_to_use = '', whatever = '') ⇒ Object

#

LibuiParadise::Extensions.message_box_error

#


156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 156

def self.message_box_error(
    main_window  = LibuiParadise.main_window?,
    title_to_use = '',
    whatever     = ''
  )
  case main_window
  # ======================================================================= #
  # === :default
  # ======================================================================= #
  when :default
    main_window = LibuiParadise.main_window?
  end
  _ = ::LibUI.msg_box_error(
    main_window,
    title_to_use,
    whatever
  )
  add_to_the_registered_widgets(_, __method__)
  return _
end

.msg_box(main_window = :default_window, title_to_use = '', description_to_use = '') ⇒ Object

#

LibuiParadise::Extensions.msg_box

Official API documentation for dialogs in libui can be found here:

https://github.com/andlabs/libui/blob/master/unix/stddialogs.c

For libui-ng it can be found here:

https://github.com/libui-ng/libui-ng/blob/master/unix/stddialogs.c

The API signature for msgbox in Libui is as follows:

GtkWindow *parent
const char *title
const char *description
GtkMessageType type
GtkButtonsType buttons

So the first string is the title and the second string is the description that will be shown to the user.

The following method is a convenience-wrapper over UI.msg_box().

A Hash can also be passed into this method, to allow for more flexibility. The following line of code will demonstrate how this can then be used, via a Hash:

message_box(
   text: 'Hello world!'
)

Or more verbose:

LibuiParadise::Extensions.message_box(text: 'Hello world!')
#


103
104
105
106
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
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 103

def self.msg_box(
    main_window        = :default_window,
    title_to_use       = '',
    description_to_use = ''
  )
  # ======================================================================= #
  # === Handle Hashes first
  # ======================================================================= #
  if main_window.is_a? Hash
    # ===================================================================== #
    # === :text
    # ===================================================================== #
    if main_window.has_key? :text
      description_to_use = main_window.delete(:text)
    end
    # ===================================================================== #
    # === :title_to_use
    # ===================================================================== #
    if main_window.has_key? :title_to_use
      title_to_use = main_window.delete(:title_to_use)
    end
    if main_window and main_window.empty? # Handle empty Hashes as well here.
      main_window = :default_window
    end
  end
  case main_window
  # ======================================================================= #
  # === :default_window
  #
  # Note that LibuiParadise.main_window? may be nil.
  # ======================================================================= #
  when :default_window,
       :default
    main_window = ::LibuiParadise.main_window?
  end
  if description_to_use.is_a? Array
    description_to_use = description_to_use.join(' ').strip
  end
  _ = ::LibUI.msg_box(
    main_window,
    title_to_use,
    description_to_use
  )
  add_to_the_registered_widgets(_, __method__)
  return _
end

.multiline_entry(optional_content = nil) ⇒ Object

#

LibuiParadise::Extensions.multiline_entry (multiline_entry tag)

The upstream code for the linux-variant for a multiline-entry can be found here:

https://raw.githubusercontent.com/andlabs/libui/master/unix/multilineentry.c

A multiline-entry, also known more traditionally as a “textview”, is a widget that allows the user to input text and modify that text as well.

#


815
816
817
818
819
820
821
822
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 815

def self.multiline_entry(optional_content = nil)
  _ = ::LibUI.new_multiline_entry
  add_to_the_registered_widgets(_, __method__)
  if optional_content and optional_content.is_a?(String) and !optional_content.empty?
    _.set_text(optional_content)
  end
  return _
end

.non_wrapping_multiline_entryObject

#

LibuiParadise::Extensions.non_wrapping_multiline_entry

The upstream C API for the non-wrapping multiline edit can be found here:

https://raw.githubusercontent.com/andlabs/libui/master/unix/multilineentry.c
#


552
553
554
555
556
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 552

def self.non_wrapping_multiline_entry
  _ = ::LibUI.new_non_wrapping_multiline_entry
  add_to_the_registered_widgets(_, __method__)
  return _
end

.notification(text = 'Backup complete!', title_to_use = '') ⇒ Object

#

LibuiParadise::Extensions.notification

This method can be used to show a quick message box to the end user.

#


102
103
104
105
106
107
108
109
110
# File 'lib/libui_paradise/extensions/extensions.rb', line 102

def self.notification(
    text         = 'Backup complete!',
    title_to_use = ''
  )
  ::LibuiParadise::Extensions.message_box(
    text:         text,
    title_to_use: title_to_use
  )
end

.open_file(main_window = ::LibuiParadise::Extensions.main_window?) ⇒ Object

#

LibuiParadise::Extensions.open_file

This method can be used to open a local file, via a button, the “open-file” button. Furthermore a begin/rescue clause is used to avoid “NULL pointer given” errors. At a later time we may have to fine-tune this, but for now this shall suffice.

#


260
261
262
263
264
265
266
267
268
269
270
271
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 260

def self.open_file(
    main_window = ::LibuiParadise::Extensions.main_window?
  )
  begin
    _ = ::LibUI.open_file(main_window)
    add_to_the_registered_widgets(_, __method__)
    return _
  rescue ArgumentError => _error # Rescue #<ArgumentError: NULL pointer given> here.
    # pp _error
    return nil
  end
end

.password_entryObject

#

LibuiParadise::Extensions.password_entry

This method will create and returns a new password entry widget. This means that input will be “disguised” via the ‘*’ character.

Usage example:

entry = LibuiParadise::Extensions.password_entry
#


709
710
711
712
713
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 709

def self.password_entry
  entry = ::LibUI.new_password_entry
  add_to_the_registered_widgets(entry, __method__)
  return entry
end

.radio_buttons(optional_array = []) ⇒ Object

#

LibuiParadise::Extensions.radio_buttons

This method will create some radio buttons.

You can pass an Array into this method, which should be an Array of Strings. This is optional. If such an Array is given, though, then these entries will become radio-buttons, with the associated label (the text they display) becoming the label right next to the radio button element (that round circle that the user can select via the mouse cursor).

#


933
934
935
936
937
938
939
940
941
942
943
944
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 933

def self.radio_buttons(
    optional_array = []
  )
  _ = ::LibUI.new_radio_buttons
  if optional_array and optional_array.is_a?(Array) and !optional_array.empty?
    optional_array.each {|this_element|
      ::LibUI.radio_buttons_append(_, this_element)
    }
  end
  add_to_the_registered_widgets(_, __method__)
  return _
end

.register_sigintObject

#

LibuiParadise::Extensions.register_sigint

#


248
249
250
# File 'lib/libui_paradise/extensions/extensions.rb', line 248

def self.register_sigint
  Signal.trap('SIGINT') { exit }
end

.register_this_fiddle_pointer_widget(the_fiddle_pointer_widget, the_type_of_the_widget = nil) ⇒ Object

#

LibuiParadise::Extensions.register_this_fiddle_pointer_widget

This method registers the particular widget in use.

Every new_* method available via LibUI.new* that creates a new widget has to be registered via this method here, by calling it.

That way we have a main Hash that contains lots of Fiddle::Pointers and we can, at a later time, modify these Fiddle::Pointer or call toplevel methods with these registered pointers. This will only work if we have registered these pointers, though, which is why each method that creates a new libui-widget has to make use of this method here.

Since as of November 2022, the main window is also handled by this.

Perhaps it should also use the method here, but I found it simpler to just refer to it via @main_window or main_window?. (Note that in future releases of the libui_paradise gem, @main_window will probably be removed and integrated just like any other libui-widget. But this has not been done yet, so it is retained as-is right now.)

The mandatory entries given to this method must be of the following format:

object_id -> [:the_fiddle_pointer_widget, :the_type]

In other words, a key (as an Integer), and an Array as its primary value.

The object_id will be determined automatically, so it can be omitted. It is the value that is simply returned by calling the .object_id method, so we do not have to do anything else here.

The very last argument of the two-member Array should be a symbol, such as :grid. This is automatically ensured via a call to __method__ which returns a Symbol. That way we can then call the correct method internally, once we know we have a :grid or any other widget.

#


181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# File 'lib/libui_paradise/extensions/extensions.rb', line 181

def self.register_this_fiddle_pointer_widget(
    the_fiddle_pointer_widget,
    the_type_of_the_widget = nil
  )
  # ======================================================================= #
  # Determine the object-id automatically next:
  # ======================================================================= #
  object_id_to_use = the_fiddle_pointer_widget.object_id
  # ======================================================================= #
  # Then, store it on the main Hash.
  # ======================================================================= #
  @hash_fiddle_pointer_widgets[object_id_to_use] =
    [
      the_fiddle_pointer_widget,
      the_type_of_the_widget
    ]
end

.scrolling_area(widget, width = 400, height = 400) ⇒ Object

#

LibuiParadise::Extensions.scrolling_area

It seems as if scrolling is not yet easily available in libui.

The upstream API is like this:

uiArea *area = uiNewScrollingArea(&handler, 400, 400);

The two numbers are width and height, as integers, respectively. In total three arguments are required. The first argument is a so-called “AreaHandler”.

The code may be found here:

https://github.com/andlabs/libui/blob/master/windows/areascroll.cpp
#


995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 995

def self.scrolling_area(
    widget,
    width           = 400,
    height          = 400
  )
  case width
  when :default, nil
    width = 400
  end
  case height
  when :default, nil
    height = 400
  end
  _ = ::LibUI.new_scrolling_area(widget, width, height)
  # ======================================================================= #
  # The next part does not yet work - is it even possible to add widgets
  # to a scrolling area in libui?
  # if optional_widget
  #   _.add(optional_widget)
  # end
  # ======================================================================= #
  add_to_the_registered_widgets(_, __method__)
  return _
end

.search_entryObject

#

LibuiParadise::Extensions.search_entry

#


468
469
470
471
472
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 468

def self.search_entry
  _ = ::LibUI.new_search_entry
  add_to_the_registered_widgets(_, __method__)
  return _
end

.set_main_window(i) ⇒ Object

#

LibuiParadise::Extensions.set_main_window

#


297
298
299
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 297

def self.set_main_window(i)
  @main_window = i
end

.set_title(this_title, main_window = main_window? ) ⇒ Object

#

LibuiParadise::Extensions.set_title

Simpler window-set-title functionality.

#


396
397
398
399
400
401
# File 'lib/libui_paradise/extensions/extensions.rb', line 396

def self.set_title(
    this_title,
    main_window = main_window?
  )
  window_set_title(main_window, this_title)
end

.slider(start_value = 0, end_value = 100) ⇒ Object

#

LibuiParadise::Extensions.slider

#


417
418
419
420
421
422
423
424
425
426
427
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 417

def self.slider(
    start_value =   0,
    end_value   = 100
  )
  _ = ::LibUI.new_slider(start_value, end_value)
  # ======================================================================= #
  # Register it at once:
  # ======================================================================= #
  add_to_the_registered_widgets(_, __method__)
  return _
end

.spinbox(start_point = 0, end_point = 100) ⇒ Object

#

LibuiParadise::Extensions.spinbox

This method will return a spin-button, also called a spin-box.

The first argument is the start value; the second argument is the end value.

#


673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 673

def self.spinbox(
    start_point =   0,
    end_point   = 100
  )
  if start_point.is_a? Hash
    # ===================================================================== #
    # === :end
    # ===================================================================== #
    if start_point.has_key? :end
      end_point = start_point[:end]
    end
    # ===================================================================== #
    # === :start
    # ===================================================================== #
    if start_point.has_key? :start
      start_point = start_point[:start]
    end
  end
  _ = ::LibUI.new_spinbox(start_point.to_i, end_point.to_i)
  add_to_the_registered_widgets(_, __method__)
  return _
end

.tabObject

#

LibuiParadise::Extensions.tab

This could be also called “notebook_tab” - see the alias on the bottom.

#


43
44
45
46
47
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 43

def self.tab
  _ = ::LibUI.new_tab # Create a new notebook-tab here.
  add_to_the_registered_widgets(_, __method__)
  return _
end

.table(i) ⇒ Object

#

LibuiParadise::Extensions.table

The argument to this method should be of type table_params.

Example for this:

table_params = LibUI::FFI::TableParams.malloc
table_params.Model = model
table_params.RowBackgroundColorModelColumn = -1
#


1050
1051
1052
1053
1054
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 1050

def self.table(i)
  _ = ::LibUI.new_table(i)
  LibuiParadise::Extensions.register_this_fiddle_pointer_widget(_, __method__)
  return _
end

.text_layout(i = '') ⇒ Object

#

LibuiParadise::Extensions.text_layout

#


730
731
732
733
734
735
736
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 730

def self.text_layout(
    i = ''
  )
  _ = ::LibUI.draw_new_text_layout(i.to_s)
  add_to_the_registered_widgets(_, __method__)
  return _
end

.vbox(*optional_widgets) ⇒ Object

#

LibuiParadise::Extensions.vbox (vbox tag)

This method will create a vertical box.

#


16
17
18
19
20
21
22
23
# File 'lib/libui_paradise/libui_classes/box.rb', line 16

def self.vbox(*optional_widgets)
  _ = ::LibUI.new_vertical_box
  add_to_the_registered_widgets(_, __method__)
  if optional_widgets and !optional_widgets.empty?
    optional_widgets.flatten.each {|this_widget| _ << this_widget }
  end
  return _
end

.vertical_separatorObject

#

LibuiParadise::Extensions.vertical_separator

This method will add a new vertical separator.

#


646
647
648
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 646

def self.vertical_separator
  ::LibUI.new_vertical_separator
end

.window(the_title = '', width = 500, height = 300, has_menubar = 1, &block) ⇒ Object

#

LibuiParadise::Extensions.window (window tag)

This method will create a new main-window.

It will also call UI.simple_exit(). This is done mostly so that we can omit that line whenever we use e. g. ui_main_window().

#


309
310
311
312
313
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
355
356
357
358
359
360
361
362
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 309

def self.window(
    the_title   = '',  # Pick a title for the window here.
    width       = 500, # width  in n pixels.
    height      = 300, # height in n pixels.
    has_menubar =   1, # hasMenubar or has not.
    &block
  )
  case the_title
  # ======================================================================= #
  # === :filename
  # ======================================================================= #
  when :filename,
       :file_name
    # ===================================================================== #
    # __FILE__ contains the desired name. We only need the raw name, though.
    # Well, in 2022 it was realized that the real filename is stored in
    # $PROGRAM_NAME, so ...
    # ===================================================================== #
    the_title = File.basename($PROGRAM_NAME) # (__FILE__)
  end
  raw_has_menubar = 0
  if has_menubar.is_a? Numeric
    raw_has_menubar = has_menubar
  end
  # ======================================================================= #
  # Instantiate a new main-window next:
  # ======================================================================= #
  main_window = LibUI.new_window(
    the_title,
    width,
    height,
    raw_has_menubar
  )
  set_main_window(main_window) # Keep a reference stored here.
  # ======================================================================= #
  # Since as of 30.08.2021 we will also register the main-window.
  #
  # In the long run we may obsolete and deprecate @main_window, since
  # it is no longer needed - but for now we will retain that variable.
  # ======================================================================= #
  add_to_the_registered_widgets(main_window, __method__)
  if has_menubar and has_menubar.is_a?(Hash)
    if has_menubar.has_key? :margin
      if has_menubar[:margin] == true
        main_window.has_margin
      end
    end
  end
  ::LibUI.simple_exit(main_window)
  if block_given?
    yield
  end
  return main_window # Always return it here.
end

.wrapper_new_progress_barObject

#

LibuiParadise::Extensions.wrapper_new_progress_bar

The name of this method contains “wrapper_” because there already exists a method called LibUI.new_progress_bar().

The upstream C API for the libui-progressbar can be found here:

https://github.com/andlabs/libui/blob/master/unix/progressbar.c
#


239
240
241
242
243
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 239

def self.wrapper_new_progress_bar
  _ = ::LibUI.new_progress_bar
  add_to_the_registered_widgets(_, :new_progress_bar)
  return _
end

Instance Method Details

#abort_on_exceptionObject

#

abort_on_exception

#


661
662
663
# File 'lib/libui_paradise/extensions/extensions.rb', line 661

def abort_on_exception
  Thread.abort_on_exception
end

#append_this_array_to_that_combobox(this_array, that_combobox) ⇒ Object

#

append_this_array_to_that_combobox

#


559
560
561
562
563
564
565
566
# File 'lib/libui_paradise/extensions/extensions.rb', line 559

def append_this_array_to_that_combobox(
    this_array,
    that_combobox
  )
  this_array.each {|this_entry|
    UI.combobox_append(that_combobox, this_entry)
  }
end

#area(i = :use_new_area_handler) ⇒ Object Also known as: area_handler

#

area

AreaHandler defines the functionality needed for handling events from an Area.

Upstream documentation, at the least for Go, can be found here:

https://github.com/andlabs/ui/blob/master/areahandler.go
#


1309
1310
1311
1312
1313
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 1309

def area(
    i = :use_new_area_handler
  )
  return ::LibuiParadise::Extensions.area(i)
end

#assumed_height?Boolean Also known as: assumed_max_height?

#

assumed_height?

#

Returns:

  • (Boolean)


331
332
333
# File 'lib/libui_paradise/extensions/extensions.rb', line 331

def assumed_height?
  return_the_resolution_using_xrandr.split('x').last.to_i
end

#assumed_width?Boolean Also known as: assumed_max_width?

#

assumed_width?

#

Returns:

  • (Boolean)


349
350
351
# File 'lib/libui_paradise/extensions/extensions.rb', line 349

def assumed_width?
  return_the_resolution_using_xrandr.split('x').first.to_i
end

#bold_button(i) ⇒ Object

#

bold_button

This currently does not work. We have to wait until upstream libui supports bold font text.

#


1062
1063
1064
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 1062

def bold_button(i)
  button(i)
end

#bold_label(i = '') ⇒ Object

#

bold_label

This currently does not work properly. We may have to re-examine this eventually at a later point.

#


1235
1236
1237
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 1235

def bold_label(i = '')
  return label(i)
end

#bold_text(i = '') ⇒ Object

#

bold_text

This currently does NOT make the text bold - the method exists solely as a placeholder, until upstream libui supports bold text as such.

#


1245
1246
1247
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 1245

def bold_text(i = '')
  return label(i)
end

#bold_text_left_aligned(i = '') ⇒ Object Also known as: left_aligned_bold_label

#

bold_text_left_aligned

#


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

def bold_text_left_aligned(i = '')
  return label(i)
end

#button(text = '') ⇒ Object

#

button (button tag)

This method will create a libui-button.

#


26
27
28
29
30
31
32
33
34
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 26

def button(
    text = ''
  )
  text = text.to_s.dup
  if text.start_with? '_'
    text[0,1] = '' # Right now we do not support accelerators.
  end
  return ::LibuiParadise::Extensions.button(text)
end

#chdir(i) ⇒ Object Also known as: cd

#

chdir (cd tag, chdir tag)

#


745
746
747
748
749
# File 'lib/libui_paradise/extensions/extensions.rb', line 745

def chdir(i)
  if i and File.directory?(i)
    Dir.chdir(i)
  end
end

#checkbox(i = '') ⇒ Object Also known as: ui_checkbox, ui_check_button

#

checkbox

#


775
776
777
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 775

def checkbox(i = '')
  ::LibuiParadise::Extensions.checkbox(i)
end

#checked_checkbox(i = '') ⇒ Object

#

checked_checkbox

#


783
784
785
786
787
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 783

def checked_checkbox(i = '')
  _ = checkbox(i)
  _.is_active
  return _
end

#close_properly(main_window = LibuiParadise::Extensions.main_window?) ⇒ Object Also known as: simple_exit

#

close_properly

#


237
238
239
240
241
242
243
# File 'lib/libui_paradise/extensions/extensions.rb', line 237

def close_properly(
    main_window = LibuiParadise::Extensions.main_window?
  )
  LibUI.window_on_closing(main_window) {
    LibUI.exit_from(main_window)
  }
end

#colour_buttonObject Also known as: color_button, ui_colour_button

#

colour_button

#


972
973
974
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 972

def colour_button
  ::LibuiParadise::Extensions.new_colour_button
end

#colour_to_rgb(colour = :steelblue) ⇒ Object

#

colour_to_rgb

#


323
324
325
326
# File 'lib/libui_paradise/extensions/extensions.rb', line 323

def colour_to_rgb(colour = :steelblue)
  array = Colours.colour_to_rgb(colour)
  return array
end

#combobox(optional_array = nil, &block) ⇒ Object Also known as: combo_box, ui_combo_box, ui_combobox, combo_box_entry, libui_combo_box

#

combobox

The first argument can be an Array.

#


1170
1171
1172
1173
1174
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 1170

def combobox(
    optional_array = nil, &block
  )
  return ::LibuiParadise::Extensions.combobox(optional_array, &block)
end

#commandline_arguments?Boolean

#

commandline_arguments?

#

Returns:

  • (Boolean)


836
837
838
# File 'lib/libui_paradise/extensions/extensions.rb', line 836

def commandline_arguments?
  @commandline_arguments
end

#connect_skeletonObject

#

connect_skeleton

This is a stub method, because we want to allow the user to modify it.

#


764
765
# File 'lib/libui_paradise/extensions/extensions.rb', line 764

def connect_skeleton
end

#copy(from, to) ⇒ Object

#

copy

#


607
608
609
610
# File 'lib/libui_paradise/extensions/extensions.rb', line 607

def copy(from, to)
  require 'fileutils'
  FileUtils.cp(from, to)
end

#copy_file(from, to) ⇒ Object Also known as: cp_file

#

copy_file

#


809
810
811
# File 'lib/libui_paradise/extensions/extensions.rb', line 809

def copy_file(from, to)
  FileUtils.cp(from, to)
end

#create_buttonObject

#

button (button tag)

This method will create a libui-button.

#

create_button



35
36
37
38
39
40
41
42
43
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 35

def button(
    text = ''
  )
  text = text.to_s.dup
  if text.start_with? '_'
    text[0,1] = '' # Right now we do not support accelerators.
  end
  return ::LibuiParadise::Extensions.button(text)
end

#create_default_gridObject

#

grid

This method can be used to create (and return) a new grid.

#

create_default_grid



46
47
48
# File 'lib/libui_paradise/libui_classes/grid.rb', line 46

def grid
  ::LibuiParadise::Extensions.grid
end

#create_directory(i) ⇒ Object Also known as: mkdir

#

create_directory

#


816
817
818
# File 'lib/libui_paradise/extensions/extensions.rb', line 816

def create_directory(i)
  FileUtils.mkdir_p(i)
end

#create_skeleton_then_connect_skeletonObject

#

create_skeleton_then_connect_skeleton

#


754
755
756
757
# File 'lib/libui_paradise/extensions/extensions.rb', line 754

def create_skeleton_then_connect_skeleton
  create_skeleton
  connect_skeleton
end

#current_widget_pointer_type?Boolean

#

current_widget_pointer_type?

#

Returns:

  • (Boolean)


221
222
223
# File 'lib/libui_paradise/extensions/extensions.rb', line 221

def current_widget_pointer_type?
  LibuiParadise::Extensions.hash_fiddle_pointer_widgets?.values.last.last
end

#delete_file(i) ⇒ Object

#

delete_file

This method can be used if you want to quickly delete a (local) file.

#


312
313
314
315
316
317
318
# File 'lib/libui_paradise/extensions/extensions.rb', line 312

def delete_file(i)
  if File.file?(i)
    File.delete(i)
  else
    puts "Not a file: #{i}"
  end
end

#do_quitObject

#

do_quit

#


600
601
602
# File 'lib/libui_paradise/extensions/extensions.rb', line 600

def do_quit
  ::LibUI.quit
end

#editable_combobox(optional_array = nil, &block) ⇒ Object Also known as: editable_combo_box, ui_editable_combo_box

#

editable_combobox

#


1183
1184
1185
1186
1187
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 1183

def editable_combobox(
    optional_array = nil, &block
  )
  return ::LibuiParadise::Extensions(optional_array, &block)
end

#entry(optional_text = '') ⇒ Object Also known as: ui_entry, hcentered_entry, create_entry

#

entry (entry tag)

This method is tapping into LibUI.new_entry.

An alias exists to this method, called hcentered_entry. This currently does not work for libui, and is thus only added for compatibility reasons.

Usage example:

entry1 = ui_entry('ATG')
#


521
522
523
524
525
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 521

def entry(
    optional_text = ''
  )
  ::LibuiParadise::Extensions.entry(optional_text)
end

#error_msg(text) ⇒ Object

#

error_msg

#


202
203
204
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 202

def error_msg(text)
  message_box_error(:default, text)
end

#esystem(i) ⇒ Object

#

esystem

This method can be used to run system(), with output. Thread.new is used because that seems to work better in a GUI setup.

#


302
303
304
305
# File 'lib/libui_paradise/extensions/extensions.rb', line 302

def esystem(i)
  puts i
  Thread.new { system i }
end

#exit_from(main_window = ::LibuiParadise::Extensions.main_window?) ⇒ Object

#

exit_from

This method essentially combines UI.control_destroy() and UI.quit( into one method.

#


581
582
583
584
585
586
587
# File 'lib/libui_paradise/extensions/extensions.rb', line 581

def exit_from(
    main_window = ::LibuiParadise::Extensions.main_window?
  )
  LibUI.control_destroy(main_window)
  LibUI.quit
  0
end

#fancy_text(i = '') ⇒ Object Also known as: attributed_string

#

fancy_text

This text variant can be styled.

#


1261
1262
1263
1264
1265
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 1261

def fancy_text(i = '')
  _ = LibUI.new_attributed_string(i.to_s)
  add_to_the_registered_widgets(_, __method__)
  return _
end

#font(&block) ⇒ Object Also known as: font_descriptor, ui_font

#

font

#


611
612
613
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 611

def font(&block)
  LibuiParadise::Extensions.font(&block)
end

#font_buttonObject Also known as: ui_font_button

#

font_button

Create a new font button via this method.

#


885
886
887
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 885

def font_button
  return ::LibuiParadise::Extensions.font_button
end

#gridObject

#

grid

#


43
44
45
# File 'lib/libui_paradise/libui_classes/grid.rb', line 43

def grid
  ::LibuiParadise::Extensions.grid
end

#gtk3?Boolean Also known as: is_on_gtk?

#

gtk3?

#

Returns:

  • (Boolean)


637
638
639
# File 'lib/libui_paradise/extensions/extensions.rb', line 637

def gtk3?
  false
end

#hbox(*optional_widgets) ⇒ Object Also known as: ui_hbox, create_hbox, libui_hbox

#

ui_hbox (hbox tag)

#


57
58
59
# File 'lib/libui_paradise/libui_classes/box.rb', line 57

def hbox(*optional_widgets)
  ::LibuiParadise::Extensions.hbox(optional_widgets)
end

#height?Boolean

#

height?

#

Returns:

  • (Boolean)


420
421
422
# File 'lib/libui_paradise/extensions/extensions.rb', line 420

def height?
  @height
end

#horizontal_separatorObject Also known as: ui_hseparator, ui_hsep, hspacer, horizontal_spacer, hsep, libui_hsep

#

horizontal_separator

#


456
457
458
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 456

def horizontal_separator
  ::LibuiParadise::Extensions.horizontal_separator
end

#image(this_file, width = :try_to_infer_automatically, height = :infer_automatically) ⇒ Object Also known as: ui_image

#

image

This is currently limited to .png files only, due to ChunkyPng.

At some later point in the future this limitation may be lifted. For now it has to remain in place.

#


897
898
899
900
901
902
903
904
905
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 897

def image(
    this_file,
    width  = :try_to_infer_automatically,
    height = :infer_automatically
  )
  Libuiparadise::Extensions.image(
    this_file, width, height
  )
end

#is_on_roebe?Boolean

#

is_on_roebe?

#

Returns:

  • (Boolean)


380
381
382
# File 'lib/libui_paradise/extensions/extensions.rb', line 380

def is_on_roebe?
  ENV['IS_ROEBE'].to_s == '1'
end

#is_on_windows?Boolean

#

is_on_windows?

#

Returns:

  • (Boolean)


1318
1319
1320
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 1318

def is_on_windows?
  Gem.win_platform?
end

#label(i = '') ⇒ Object Also known as: text, ui_text, ui_label, left_aligned_label, left_aligned_text

#

label

The last two aliases, left_aligned_label, should be different, but right now I don’t know how to do this in libui.

#


1219
1220
1221
1222
1223
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 1219

def label(
    i = ''
  )
  ::LibuiParadise::Extensions.label(i)
end

#last_pointer?Boolean Also known as: current_pointer?, current_widget_pointer?

#

last_pointer?

This used to return the “current” widget pointer, but past September 2021 this is rarely in use anymore. Use current_widget_pointer? instead, based on the main Hash that keeps all widgets registered.

#

Returns:

  • (Boolean)


213
214
215
# File 'lib/libui_paradise/extensions/extensions.rb', line 213

def last_pointer?
  LibuiParadise::Extensions.current_widget_pointer?
end

#left_arrow?Boolean

#

left_arrow?

#

Returns:

  • (Boolean)


552
553
554
# File 'lib/libui_paradise/extensions/extensions.rb', line 552

def left_arrow?
  ui_text('')
end

#main_hash?Boolean Also known as: toplevel_hash?

#

main_hash?

Access the main hash defined above.

#

Returns:

  • (Boolean)


92
93
94
# File 'lib/libui_paradise/extensions/extensions.rb', line 92

def main_hash?
  ::LibuiParadise::Extensions.hash_fiddle_pointer_widgets?
end

#main_then_quitObject

#

main_then_quit

#


592
593
594
595
# File 'lib/libui_paradise/extensions/extensions.rb', line 592

def main_then_quit
  ::LibUI.main
  do_quit
end

#main_window?Boolean

#

main_window?

#

Returns:

  • (Boolean)


290
291
292
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 290

def main_window?
  ::LibuiParadise::Extensions.main_window?
end
#

menu (menu tag)

#


635
636
637
638
639
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 635

def menu(
    title = ''
  )
  return ::LibuiParadise::Extensions.menu(title)
end

#message_box_error(main_window = LibuiParadise.main_window?, title_to_use = '', whatever = '') ⇒ Object Also known as: ui_msg_box_error, ui_error_message, ui_error_msg, error_message_to_the_user

#

message_box_error

#


184
185
186
187
188
189
190
191
192
193
194
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 184

def message_box_error(
    main_window  = LibuiParadise.main_window?,
    title_to_use = '',
    whatever     = ''
  )
  return ::LibuiParadise::Extensions.message_box_error(
    main_window,
    title_to_use,
    whatever
  )
end

#multiline_entry(optional_content = nil) ⇒ Object Also known as: ui_multiline_entry, textview, text_view, ui_text_view, ui_textview, ui_text_buffer, input_field, input

#

multiline_entry

#


910
911
912
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 910

def multiline_entry(optional_content = nil)
  ::LibuiParadise::Extensions.multiline_entry(optional_content)
end

#new_brushObject

#

new_brush

#


571
572
573
# File 'lib/libui_paradise/extensions/extensions.rb', line 571

def new_brush
  UI::FFI::DrawBrush.malloc
end

#non_wrapping_multiline_entryObject

#

LibuiParadise::Extensions.non_wrapping_multiline_entry

#


619
620
621
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 619

def non_wrapping_multiline_entry
  return ::LibuiParadise::Extensions.non_wrapping_multiline_entry
end

#password_entryObject Also known as: ui_password_entry

#

password_entry

Usage example:

entry = ui_password_entry
#


723
724
725
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 723

def password_entry
  ::LibuiParadise::Extensions.password_entry
end

#quit_button(optional_arguments = {}) ⇒ Object Also known as: ui_quit_button

#

quit_button (quit tag)

This method can be used to, by default, implement a quit button that, upon a click-event, will cause the application to exit and close/quit.

#


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

def quit_button(
    optional_arguments = {}
  )
  use_this_text = 'Quit'
  if optional_arguments and optional_arguments.is_a?(Hash)
    # ===================================================================== #
    # === :text
    # ===================================================================== #
    if optional_arguments.has_key? :text
      use_this_text = optional_arguments.delete(:text)
    end
  end
  if block_given?
    yielded = yield
    case yielded
    # ===================================================================== #
    # === :with_emoji
    # ===================================================================== #
    when :with_emoji,
         :with_icon
      use_this_text = use_this_text.to_s.dup
      use_this_text << ' 🛑'
    end
  end
  quit_button = button(use_this_text)
  quit_button.on_clicked {
    ::LibUI.quit
    0
  }
  return quit_button
end

#radio_buttons(optional_array = []) ⇒ Object Also known as: ui_radio_buttons

#

radio_buttons

#


949
950
951
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 949

def radio_buttons(optional_array = [])
  return ::LibuiParadise::Extensions.radio_buttons(optional_array)
end

#register_this_fiddle_pointer_widget(the_fiddle_pointer_widget, the_type_of_the_widget = nil) ⇒ Object Also known as: add_to_the_registered_widgets

#

register_this_fiddle_pointer_widget

#


286
287
288
289
290
291
292
293
294
# File 'lib/libui_paradise/extensions/extensions.rb', line 286

def register_this_fiddle_pointer_widget(
    the_fiddle_pointer_widget,
    the_type_of_the_widget = nil
  )
  ::LibuiParadise::Extensions.register_this_fiddle_pointer_widget(
    the_fiddle_pointer_widget,
    the_type_of_the_widget
  )
end

#return_button_for_opening_a_local_file(connect_this_button_with_that_widget = nil) ⇒ Object Also known as: return_the_default_open_file_button

#

return_button_for_opening_a_local_file

It is recommended to passs a libui-widget into this method, so that the “open-file” functionality can have a callback. Usually that callback should be a libui-entry, so that we can fill it with the file path that we chose.

#


34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/libui_paradise/extensions/extensions.rb', line 34

def return_button_for_opening_a_local_file(
    connect_this_button_with_that_widget = nil
  )
  button_open_file = ui_button('Open file')
  button_open_file.on_clicked {
    begin
      # filename = ui_open_file(window).to_s
      filename = LibUI.open_file(main_window).to_s
      # e "The filename was: #{filename}" # This line is for debugging.
      if connect_this_button_with_that_widget # This widget is usually an entry.
        filename = File.absolute_path(filename) # We need the full path here.
        connect_this_button_with_that_widget.set_text(filename) if connect_this_button_with_that_widget.respond_to?(:set_text)
      end
    rescue ArgumentError => error # Rescue from "NULL pointer given"
      pp error
    end
  }
  return button_open_file # Always return that button here.
end

#return_pwdObject

#

return_pwd

#


644
645
646
# File 'lib/libui_paradise/extensions/extensions.rb', line 644

def return_pwd
  "#{Dir.pwd}/".squeeze('/')
end

#return_the_resolution_using_xrandrObject

#

return_the_resolution_using_xrandr

This method will only work on e. g. Linux.

It will then return a String such as “1920x1080”.

#


431
432
433
434
435
436
437
438
439
440
441
# File 'lib/libui_paradise/extensions/extensions.rb', line 431

def return_the_resolution_using_xrandr
  _ = '800x600' # This is a generic failsafe value.
  begin
    xrandr_result = `xrandr`
    _ = xrandr_result.split("\n").select {|line|
      line.include? '*'
    }.first.strip.squeeze(' ').split(' ').first.to_s
  rescue Errno::ENOENT # Rescue for Windows systems.
  end
  return _ # This will yield e. g. "1920x1080"
end

#runObject

#

run

#


856
857
858
# File 'lib/libui_paradise/extensions/extensions.rb', line 856

def run
  create_skeleton_then_connect_skeleton
end

#run_mainObject

#

run_main

#


823
824
# File 'lib/libui_paradise/extensions/extensions.rb', line 823

def run_main
end

#scrolling_area(optional_widget = nil) ⇒ Object Also known as: ui_scrolling_area, ui_scrolled_window

#

scrolling_area

It seems as if scrolling is not yet easily available in libui.

The upstream API is like this:

uiArea *area = uiNewScrollingArea(&handler, 400, 400);
#


1031
1032
1033
1034
1035
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 1031

def scrolling_area(
    optional_widget = nil
  )
  LibuiParadise::Extensions.scrolling_area(optional_widget)
end

#search_entryObject Also known as: ui_search_entry

#

search_entry

#


477
478
479
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 477

def search_entry
  ::LibuiParadise::Extensions.search_entry
end

#selected?(pointer) ⇒ Boolean

#

selected?

Unsure whether this works. It appears to work, but I am not even certain as to why.

#

Returns:

  • (Boolean)


1161
1162
1163
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 1161

def selected?(pointer)
  ::LibUI.combobox_selected(pointer).to_s
end

#set_commandline_arguments(i = ARGV) ⇒ Object

#

set_commandline_arguments

#


829
830
831
# File 'lib/libui_paradise/extensions/extensions.rb', line 829

def set_commandline_arguments(i = ARGV)
  @commandline_arguments = [i].flatten.compact
end

#set_height(i = 800) ⇒ Object

#

set_height

#


785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
# File 'lib/libui_paradise/extensions/extensions.rb', line 785

def set_height(
    i = 800
  )
  case i
  # ======================================================================= #
  # === :max_width
  # ======================================================================= #
  when :max_height
    i = assumed_max_height?
  end
  if i.is_a?(String) and i.include?('%')
    # ===================================================================== #
    # In this case we have to modify this a bit.
    # ===================================================================== #
    max_height = assumed_max_height?
    i = (max_height.to_f * i.to_i) / 100.0
  end
  i = i.to_i
  @height = i
end

#set_title(i) ⇒ Object

#

set_title

#


387
388
389
# File 'lib/libui_paradise/extensions/extensions.rb', line 387

def set_title(i)
  @title = i
end

#set_width(i = 1024) ⇒ Object

#

set_width

#


356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
# File 'lib/libui_paradise/extensions/extensions.rb', line 356

def set_width(
    i = 1024
  )
  case i
  # ======================================================================= #
  # === :max_width
  # ======================================================================= #
  when :max_width
    i = assumed_max_width?
  end
  if i.is_a?(String) and i.include?('%')
    # ===================================================================== #
    # In this case we have to modify this a bit.
    # ===================================================================== #
    max_width = assumed_max_width?
    i = (max_width.to_f * i.to_i) / 100.0
  end
  i = i.to_i
  @width = i
end

#sfancy(i = '') ⇒ Object

#

sfancy

#


64
65
66
# File 'lib/libui_paradise/extensions/extensions.rb', line 64

def sfancy(i = '')
  ::Colours.sfancy(i)
end

#sfile(i = '') ⇒ Object

#

sfile

#


57
58
59
# File 'lib/libui_paradise/extensions/extensions.rb', line 57

def sfile(i = '')
  ::Colours.sfile(i)
end

#slider(start_value = 0, end_value = 100) ⇒ Object Also known as: ui_slider

#

slider

#


432
433
434
435
436
437
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 432

def slider(
    start_value =   0,
    end_value   = 100
  )
  return ::LibuiParadise::Extensions.slider(start_value, end_value)
end

#spinbox(start_point = 0, end_point = 100) ⇒ Object Also known as: ui_spinbox, ui_spinbutton, up_and_down_counter, spinbutton, centered_spin_button

#

spinbox

This method will return a spin-button, also called a spin-box.

#


752
753
754
755
756
757
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 752

def spinbox(
    start_point =   0,
    end_point   = 100
  )
  ::LibuiParadise::Extensions.spinbox(start_point, end_point)
end

#tabObject Also known as: ui_tab, ui_tabs, notebook, ui_notebook, notebook_tab

#

tab

This could be also called “notebook_tab”.

#


58
59
60
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 58

def tab
  ::LibuiParadise::Extensions.tab
end

#table(i) ⇒ Object Also known as: ui_table

#

table

#


1108
1109
1110
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 1108

def table(i)
  ::LibuiParadise::Extensions.table(i)
end

#text?(from_this_pointer) ⇒ Boolean

#

text?

This method will guarantee a String to be returned.

This is a bit weird, though. We may have to remove this method one day. I forgot why I added it to entry.rb specifically. After all other widgets also should respond to .text?.

#

Returns:

  • (Boolean)


538
539
540
541
542
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 538

def text?(from_this_pointer)
  _ = ::LibUI.entry_text(from_this_pointer).to_s
  add_to_the_registered_widgets(_, __method__)
  return _
end

#text_layout(i = '') ⇒ Object

#

text_layout

#


741
742
743
744
745
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 741

def text_layout(
    i = ''
  )
  ::LibuiParadise::Extensions.text_layout(i)
end

#title?Boolean

#

title?

#

Returns:

  • (Boolean)


406
407
408
# File 'lib/libui_paradise/extensions/extensions.rb', line 406

def title?
  @title
end

#title_width_height(title, width = WIDTH, height = 800) ⇒ Object Also known as: set_title_width_height

#

title_width_height

#


843
844
845
846
847
848
849
850
851
# File 'lib/libui_paradise/extensions/extensions.rb', line 843

def title_width_height(
    title,
    width  = WIDTH,
    height =  800
  )
  set_title(title)
  set_width(width)
  set_height(height)
end

#title_width_height_font(title = '', width = WIDTH, height = 800, font = :currently_not_handled) ⇒ Object

#

title_width_height_font

The font-argument is presently not handled. Perhaps one day in the future.

#


773
774
775
776
777
778
779
780
# File 'lib/libui_paradise/extensions/extensions.rb', line 773

def title_width_height_font(
    title  = '',
    width  = WIDTH,
    height =  800,
    font   = :currently_not_handled
  )
  title_width_height(title, width, height)
end

#try_to_parse_this_config_file(i) ⇒ Object Also known as: parse_this_config_file

#

try_to_parse_this_config_file

This method can be used to parse a .config file for data it stores.

The .config file must have “width:”, “height:” and “title:” settings.

#


523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
# File 'lib/libui_paradise/extensions/extensions.rb', line 523

def try_to_parse_this_config_file(i)
  if File.exist? i
    dataset = File.readlines(i)
    # ===================================================================== #
    # Next check for width, height and title:
    # ===================================================================== #
    width  = dataset.select {|line| line.include? 'width:' }.first.
             split(':').last.strip.to_i
    height = dataset.select {|line| line.include? 'height:' }.first.
             split(':').last.strip.to_i
    title  = dataset.select {|line| line.include? 'title:' }.first.
             split(':').last.strip
    window = LibuiParadise.window(title, width, height)
    return window
  else
    e 'No file exists at `'+i+'`.'
  end
end

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

#

try_to_use_this_font

This is currently not in use - once libui supports setting a font then this can be enabled.

#


654
# File 'lib/libui_paradise/extensions/extensions.rb', line 654

def try_to_use_this_font(i = nil); end

#two_elements_hbox(widget1, widget2, options = { layout_to_use: :maximal # This is the default. }) ⇒ Object

#

two_elements_hbox

This method will return a horizontal box (hbox) that is accepting two arguments (two widgets) that will be embedded onto that hbox. Then the result is returned.

#


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
112
113
114
115
116
117
# File 'lib/libui_paradise/libui_classes/box.rb', line 83

def two_elements_hbox(
    widget1,
    widget2,
    options = {
      layout_to_use: :maximal # This is the default.
    }
  )
  _ = ui_padded_hbox
  # ======================================================================= #
  # === Handle :layout_to_use
  #
  # This is mostly done to distinguish between maximal() and minimal()
  # for widgets.
  # ======================================================================= #
  if options.is_a?(Hash) and options.has_key?(:layout_to_use)
    case options[:layout_to_use]
    # ===================================================================== #
    # === :maximal
    # ===================================================================== #
    when :maximal
      _.maximal(widget1)
      _.maximal(widget2)
    # ===================================================================== #
    # === :minimal
    # ===================================================================== #
    when :minimal
      _.minimal(widget1)
      _.minimal(widget2)
    end
  else
    _.minimal(widget1)
    _.minimal(widget2)
  end
  return _
end

#ui_buttonObject

#

button (button tag)

This method will create a libui-button.

#

ui_button



34
35
36
37
38
39
40
41
42
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 34

def button(
    text = ''
  )
  text = text.to_s.dup
  if text.start_with? '_'
    text[0,1] = '' # Right now we do not support accelerators.
  end
  return ::LibuiParadise::Extensions.button(text)
end

#ui_draw_text_layout_paramsObject

#

ui_draw_text_layout_params

#


545
546
547
# File 'lib/libui_paradise/extensions/extensions.rb', line 545

def ui_draw_text_layout_params
  return ::LibUI::FFI::DrawTextLayoutParams.malloc
end

#ui_font_descriptor(use_this_font_family = 'Hack', use_this_size = 25, use_this_weight = 500, is_in_italic_font_variant = :no, stretch_factor = 4) ⇒ Object

#

ui_font_descriptor

This method will return a new font-descriptor pointer.

Usage example:

ui_font_descriptor('Hack')
#


470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
# File 'lib/libui_paradise/extensions/extensions.rb', line 470

def ui_font_descriptor(
    use_this_font_family      = 'Hack',
    use_this_size             = 25,
    use_this_weight           = 500,
    is_in_italic_font_variant = :no,
    stretch_factor            = 4
  )
  case is_in_italic_font_variant
  when :yes
    is_in_italic_font_variant = 1 # true
  when :no
    is_in_italic_font_variant = 0 # false
  end
  font_descriptor = UI::FFI::FontDescriptor.malloc
  font_descriptor.to_ptr.free = Fiddle::RUBY_FREE
  font_descriptor.Family = use_this_font_family
  font_descriptor.Size = use_this_size
  font_descriptor.Weight = use_this_weight
  font_descriptor.Italic = is_in_italic_font_variant
  font_descriptor.Stretch = stretch_factor
  return font_descriptor
end

#ui_gridObject

#

grid

This method can be used to create (and return) a new grid.

#

ui_grid



45
46
47
# File 'lib/libui_paradise/libui_classes/grid.rb', line 45

def grid
  ::LibuiParadise::Extensions.grid
end

#ui_margined_main_window(the_title = '', width = 500, height = 300, has_menubar = 1) ⇒ Object Also known as: ui_margined_window, ui_padded_main_window, margined_window, padded_window, ui_padded_window, padded_main_window, ui_main_window, ui_window, window_or_vbox

#

ui_margined_main_window

This variant is like ui_main_window() but it will automatically put a margin on the window, via .is_margined().

Note that the variant name “ui_padded_main_window” is a misnomer, since it is a margin rather than padding - but I found that it is easier to not care about this, so for the time being (September 2021) this is how it is. It may be subject to change in the future, though.

#


394
395
396
397
398
399
400
401
402
403
404
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 394

def ui_margined_main_window(
    the_title   = '',  # Pick a title for the window here.
    width       = 500, # width  in n pixels.
    height      = 300, # height in n pixels.
    has_menubar =   1  # hasMenubar or has not.
  )
  _ = LibuiParadise.window(the_title, width, height, has_menubar)
  _.is_margined
  #_.intelligent_exit # This does not work right now.
  return _
end

#ui_msg_box(main_window = :default_window, title_to_use = '', whatever = '') ⇒ Object Also known as: message_to_the_user, message_box, popup_over_this_widget, popup_message

#

ui_msg_box

This method is a convenience-wrapper over UI.msg_box().

#


211
212
213
214
215
216
217
218
219
220
221
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 211

def ui_msg_box(
    main_window  = :default_window,
    title_to_use = '',
    whatever     = ''
  )
  ::LibuiParadise::Extensions.msg_box(
    main_window,
    title_to_use,
    whatever
  )
end

#ui_open_file(main_window = ::LibuiParadise::Extensions.main_window?) ⇒ Object

#

ui_open_file

This method can be used as a wrapper towards an “open local file” functionality.

#


1328
1329
1330
1331
1332
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 1328

def ui_open_file(
    main_window = ::LibuiParadise::Extensions.main_window?
  )
  return ::LibuiParadise::Extensions.open_file(main_window)
end

#ui_padded_gridObject Also known as: padded_grid, default_grid

#

ui_padded_grid

#


51
52
53
54
55
# File 'lib/libui_paradise/libui_classes/grid.rb', line 51

def ui_padded_grid
  _ = ui_grid # This is defined in the method above ^^^ this method.
  _.is_padded
  return _
end

#ui_padded_hbox(*optional_widgets) ⇒ Object Also known as: padded_hbox, libui_padded_hbox

#

ui_padded_hbox

If you want to add optional widgets then simply pass them as argument to this method.

#


69
70
71
72
73
# File 'lib/libui_paradise/libui_classes/box.rb', line 69

def ui_padded_hbox(*optional_widgets)
  _ = ui_hbox(optional_widgets)
  _.is_padded
  return _
end

#ui_padded_vbox(*optional_widgets) ⇒ Object Also known as: padded_vbox

#

ui_padded_vbox

This method will call .is_padded on the vbox after it has been initialized.

#


31
32
33
34
35
# File 'lib/libui_paradise/libui_classes/box.rb', line 31

def ui_padded_vbox(*optional_widgets)
  _ = ui_vbox(optional_widgets)
  _.is_padded
  return _
end

#ui_sync_connect(widget1, widget2, optional_array = nil) ⇒ Object Also known as: sync_connect

#

ui_sync_connect

This method can connect two widgets: the first one should be a combo-box, and the second one a ui-entry.

#


118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/libui_paradise/extensions/extensions.rb', line 118

def ui_sync_connect(
    widget1,
    widget2,
    optional_array = nil
  )
  combobox_selected_callback = proc { |pointer|
    selected_value = selected?(pointer)
    if optional_array and optional_array.is_a?(Array)
      selected_value = optional_array[selected_value.to_i]
    end
    widget2.set_text(
      selected_value
    )
  }
  ::LibUI.combobox_on_selected(
    widget1, combobox_selected_callback, nil
  )
end

#ui_table_params_malloc(optional_model = nil) ⇒ Object

#

ui_table_params_malloc

This will basically wrap over LibUI::FFI::TableParams.malloc().

#


448
449
450
451
452
453
454
455
456
457
458
# File 'lib/libui_paradise/extensions/extensions.rb', line 448

def ui_table_params_malloc(
    optional_model = nil
  )
  _ = ::LibUI::FFI::TableParams.malloc
  if optional_model
    _.to_ptr.free = Fiddle::RUBY_FREE
    _.Model = optional_model
    _.RowBackgroundColorModelColumn = -1
  end
  return _
end

#ui_text_then_entry(text = '', hash = { padding: 0 }) ⇒ Object Also known as: text_then_entry

#

ui_text_then_entry

This method must return an Array containing three elements.

Note that :padding specifies whether we will use padding or not in libui. In ruby-gtk3 we can pass the pixels here; I am not sure whether this is possible via libui as such.

#


502
503
504
505
506
507
508
509
510
511
512
513
514
# File 'lib/libui_paradise/extensions/extensions.rb', line 502

def ui_text_then_entry(
    text = '',
    hash = {
      padding: 0
    }
  )
  text = ui_text(text)
  entry = ui_entry
  hbox = padded_hbox
  hbox.minimal(text,  hash[:padding])
  hbox.minimal(entry, hash[:padding])
  return [hbox, text, entry]
end

#use_gtk3?Boolean

#

use_gtk3?

#

Returns:

  • (Boolean)


615
616
617
# File 'lib/libui_paradise/extensions/extensions.rb', line 615

def use_gtk3?
  Object.const_defined?(:Gtk)
end

#use_gtk?Boolean Also known as: uses_gtk3?, uses_gtk4?

#

use_gtk?

#

Returns:

  • (Boolean)


622
623
624
# File 'lib/libui_paradise/extensions/extensions.rb', line 622

def use_gtk?
  false
end

#use_libui?Boolean

#

use_libui?

#

Returns:

  • (Boolean)


630
631
632
# File 'lib/libui_paradise/extensions/extensions.rb', line 630

def use_libui?
  true
end

#vbox(*optional_widgets) ⇒ Object Also known as: ui_vbox, gtk_box, create_vbox

#

vbox

#


122
123
124
# File 'lib/libui_paradise/libui_classes/box.rb', line 122

def vbox(*optional_widgets)
  ::LibuiParadise::Extensions.vbox(optional_widgets)
end

#vertical_separatorObject Also known as: ui_vseparator, ui_vsep, vertical_spacer, vspacer, vsep

#

vertical_separator

#


657
658
659
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 657

def vertical_separator
  ::LibuiParadise::Extensions.vertical_separator
end

#width?Boolean

#

width?

#

Returns:

  • (Boolean)


413
414
415
# File 'lib/libui_paradise/extensions/extensions.rb', line 413

def width?
  @width
end

#window(the_title = '', width = 500, height = 300, has_menubar = 1) ⇒ Object Also known as: main_window

#

window

#


371
372
373
374
375
376
377
378
379
380
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 371

def window(
    the_title   = '',  # Pick a title for the window here.
    width       = 500, # width  in n pixels.
    height      = 300, # height in n pixels.
    has_menubar =   1  # hasMenubar or has not.
  )
  LibuiParadise::Extensions.window(
    the_title, width, height, has_menubar
  )
end

#without_trailing_comment(i) ⇒ Object

#

without_trailing_comment

#


338
339
340
341
342
343
344
# File 'lib/libui_paradise/extensions/extensions.rb', line 338

def without_trailing_comment(i)
  i = i.dup
  if i and i.end_with?('#')
    i = i[0 .. -2]
  end
  return i
end

#wrapper_new_progress_barObject Also known as: progress_bar

#

wrapper_new_progress_bar

#


248
249
250
# File 'lib/libui_paradise/libui_classes/libui_classes.rb', line 248

def wrapper_new_progress_bar
  return ::LibuiParadise::Extensions.wrapper_new_progress_bar
end