Class: CWM::PushButtonTabPager

Inherits:
Pager show all
Defined in:
library/cwm/src/lib/cwm/tabs.rb

Overview

A Pager for ncurses, using PushButtons to simulate the tabs. Do not instantiate directly, use Tabs.

Instance Attribute Summary

Attributes inherited from Pager

#current_page

Attributes inherited from AbstractWidget

#handle_all_events, #widget_id

Instance Method Summary collapse

Methods inherited from Pager

#handle, #init, #initial_page, #initialize, #page_for_id, #page_order, #replace_point, #store_page, #switch_page

Methods inherited from CustomWidget

#cwm_contents, #cwm_definition, #find_ids, #ids_in_contents

Methods inherited from AbstractWidget

#cleanup, #cwm_definition, #disable, #displayed?, #enable, #enabled?, #focus, #fun_ref, #handle, #help, #init, #label, #my_event?, #opt, #refresh_help, #store, #validate, widget_type=

Constructor Details

This class inherits a constructor from CWM::Pager

Instance Method Details

#contentsObject



62
63
64
65
66
67
68
# File 'library/cwm/src/lib/cwm/tabs.rb', line 62

def contents
  tabbar = page_order.each_with_object(HBox()) do |page, res|
    page = page_for_id(page)
    res << PushButton(Id(page.widget_id), page.label)
  end
  VBox(Left(tabbar), Frame("", replace_point))
end

#mark_page(page) ⇒ Object

visually mark currently active tab

Parameters:



47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'library/cwm/src/lib/cwm/tabs.rb', line 47

def mark_page(page)
  if @current_page
    Yast::UI.ChangeWidget(
      Id(@current_page.widget_id),
      :Label,
      @current_page.label
    )
  end
  Yast::UI.ChangeWidget(
    Id(page.widget_id),
    :Label,
    "#{Yast::UI.Glyph(:BulletArrowRight)}  #{page.label}"
  )
end