Class: Wads::InfoBox

Inherits:
Widget show all
Defined in:
lib/wads/widgets.rb

Instance Attribute Summary

Attributes inherited from Widget

#base_z, #children, #gui_theme, #height, #is_selected, #layout, #overlay_widget, #override_color, #text_input_fields, #visible, #width, #x, #y

Instance Method Summary collapse

Methods inherited from Widget

#add, #add_axis_lines, #add_button, #add_child, #add_delete_button, #add_document, #add_graph_display, #add_image, #add_multi_select_table, #add_overlay, #add_panel, #add_plot, #add_single_select_table, #add_table, #add_text, #border_color, #bottom_edge, #button_down, #button_up, #center_children, #center_x, #center_y, #clear_children, #contains_click, #debug, #disable_background, #disable_border, #draw, #draw_background, #draw_border, #enable_background, #enable_border, #error, #get_layout, #get_theme, #graphics_color, #handle_mouse_down, #handle_mouse_up, #handle_right_mouse, #handle_update, #info, #intercept_widget_event, #left_edge, #move_recursive_absolute, #move_recursive_delta, #overlaps_with, #relative_x, #relative_y, #relative_z_order, #remove_child, #remove_children, #remove_children_by_type, #render, #right_edge, #selection_color, #set_absolute_position, #set_dimensions, #set_layout, #set_selected, #set_theme, #text_color, #top_edge, #unset_selected, #update, #uses_layout, #warn, #widget_z, #x_pixel_to_screen, #y_pixel_to_screen, #z_order

Constructor Details

#initialize(x, y, width, height, title, content, args = {}) ⇒ InfoBox

Returns a new instance of InfoBox.



2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
# File 'lib/wads/widgets.rb', line 2008

def initialize(x, y, width, height, title, content, args = {}) 
    super(x, y) 
    set_dimensions(width, height)
    @base_z = 10
    if args[ARG_THEME]
        @gui_theme = args[ARG_THEME]
    end
    add_text(title, 5, 5)
    add_document(content, 5, 52, width, height - 52)
    ok_button = add_button("OK", (@width / 2) - 50, height - 26) do
        WidgetResult.new(true)
    end
    ok_button.width = 100
end

Instance Method Details

#handle_key_press(id, mouse_x, mouse_y) ⇒ Object



2023
2024
2025
2026
2027
# File 'lib/wads/widgets.rb', line 2023

def handle_key_press id, mouse_x, mouse_y
    if id == Gosu::KbEscape
        return WidgetResult.new(true) 
    end
end