Class: Wads::Document
Overview
Displays multiple lines of text content at the specified coordinates
Instance Attribute Summary collapse
-
#lines ⇒ Object
Returns the value of attribute lines.
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
-
#initialize(x, y, width, height, content, args = {}) ⇒ Document
constructor
A new instance of Document.
- #render ⇒ Object
- #widget_z ⇒ Object
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_key_press, #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, #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, #x_pixel_to_screen, #y_pixel_to_screen, #z_order
Constructor Details
#initialize(x, y, width, height, content, args = {}) ⇒ Document
Returns a new instance of Document.
1984 1985 1986 1987 1988 1989 1990 1991 1992 |
# File 'lib/wads/widgets.rb', line 1984 def initialize(x, y, width, height, content, args = {}) super(x, y) set_dimensions(width, height) @lines = content.split("\n") disable_border if args[ARG_THEME] @gui_theme = args[ARG_THEME] end end |
Instance Attribute Details
#lines ⇒ Object
Returns the value of attribute lines.
1982 1983 1984 |
# File 'lib/wads/widgets.rb', line 1982 def lines @lines end |
Instance Method Details
#render ⇒ Object
1994 1995 1996 1997 1998 1999 2000 |
# File 'lib/wads/widgets.rb', line 1994 def render y = @y + 4 @lines.each do |line| @gui_theme.font.draw_text(line, @x + 5, y, z_order, 1, 1, text_color) y = y + 26 end end |
#widget_z ⇒ Object
2002 2003 2004 |
# File 'lib/wads/widgets.rb', line 2002 def Z_ORDER_TEXT end |