Class: PFM::Choice_Helper

Inherits:
Object show all
Defined in:
docs/4_Systems_000_General_1_PFM.rb

Overview

Class that help to make choice inside Interfaces

Instance Method Summary collapse

Constructor Details

#initialize(klass, can_cancel = true, cancel_index = nil) ⇒ Choice_Helper

Create a new Choice_Helper

Parameters:

  • klass (Class)

    class used to display the choice

  • can_cancel (Boolean) (defaults to: true)

    if the user can cancel the choice

  • cancel_index (Integer, nil) (defaults to: nil)

    Index returned if the user cancel



196
197
# File 'docs/4_Systems_000_General_1_PFM.rb', line 196

def initialize(klass, can_cancel = true, cancel_index = nil)
end

Instance Method Details

#cancel

Cancel the choice from outside



203
204
# File 'docs/4_Systems_000_General_1_PFM.rb', line 203

def cancel
end

#display_choice(viewport, x, y, width, *args, on_update: nil, align_right: false) ⇒ Integer

Display the choice

Parameters:

  • viewport (Viewport)

    viewport in wich the choice is shown

  • x (Integer)

    x coordinate of the choice window

  • y (Integer)

    y coordinate of the choice window

  • width (Integer)

    width of the choice window

  • on_update (#call, nil) (defaults to: nil)

    handle to call during choice update

  • align_right (Boolean) (defaults to: false)

    tell if the x/y coordinate are the top right coordinate of the choice

  • args (Array)

    argument to send to the on_update handle

Returns:

  • (Integer)

    the choice made by the user



223
224
# File 'docs/4_Systems_000_General_1_PFM.rb', line 223

def display_choice(viewport, x, y, width, *args, on_update: nil, align_right: false)
end

#register_choice(text, *args, disable_detect: nil, on_validate: nil, color: nil) ⇒ self

Register a choice

Parameters:

  • text (String)
  • disable_detect (#call, nil) (defaults to: nil)

    handle to call to detect if the choice is disabled or not

  • on_validate (#call, nil) (defaults to: nil)

    handle to call when the choice validated on this choice

  • color (Integer, nil) (defaults to: nil)

    non default color to use on this choice

  • args (Array)

    arguments to send to the disable_detect and on_validate handler

Returns:

  • (self)


212
213
# File 'docs/4_Systems_000_General_1_PFM.rb', line 212

def register_choice(text, *args, disable_detect: nil, on_validate: nil, color: nil)
end

#sizeInteger

Return the number of choices (for calculation)

Returns:

  • (Integer)


200
201
# File 'docs/4_Systems_000_General_1_PFM.rb', line 200

def size
end