Sha256: 410b632b7182f404c018f4fc20fffcfae3be56eac0f36a53749c47fd6921c78a

Contents?: true

Size: 1.37 KB

Versions: 16

Compression:

Stored size: 1.37 KB

Contents

require_relative 'helpers/example_window'

# Example for Button and ToggleButton
class ExampleState < Fidgit::GuiState
  HEIGHT = 225
  WIDTH = 140
  def initialize
    super

    vertical do
      horizontal do
        [
            [20, "All cheer the ascendancy of number "], # Should have both scrollers
            [20, "#"],                                   # Only has v-scroller.
            [4, "#"],                                    # No scrollers.
            [4, "All cheer the ascendancy of number "],  # Only has h-scroller
        ].each do |num_labels, text|
          vertical do
            scroll_window(width: WIDTH, height: HEIGHT, background_color: Gosu::Color.rgb(0, 100, 0)) do
              vertical do
                (1..num_labels).each do |i|
                  label "#{text}#{i}!"
                end
              end
            end
          end
        end
      end

      horizontal padding: 0 do
        vertical do
          scroll_window(width: 300, height: 150) do
            text_area(text: "Hello world! " * 19, width: 284)
          end
        end

        vertical do
          scroll_window(width: 300, height: 150) do
            %w[One Two Three Four Five Six].each do |name|
              toggle_button(name)
            end
          end
        end
      end
    end
  end
end

ExampleWindow.new.show

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
fidgit-0.2.4 examples/scroll_window_example.rb
fidgit-0.2.3 examples/scroll_window_example.rb
fidgit-0.2.2 examples/scroll_window_example.rb
fidgit-0.2.1 examples/scroll_window_example.rb
fidgit-0.2.0 examples/scroll_window_example.rb
fidgit-0.1.10 examples/scroll_window_example.rb
fidgit-0.1.9 examples/scroll_window_example.rb
fidgit-0.1.8 examples/scroll_window_example.rb
fidgit-0.1.7 examples/scroll_window_example.rb
fidgit-0.1.6 examples/scroll_window_example.rb
fidgit-0.1.5 examples/scroll_window_example.rb
fidgit-0.1.4 examples/scroll_window_example.rb
fidgit-0.1.3 examples/scroll_window_example.rb
fidgit-0.1.2 examples/scroll_window_example.rb
fidgit-0.1.1 examples/scroll_window_example.rb
fidgit-0.1.0 examples/scroll_window_example.rb