Module: RadioWidget

Included in:
FX::RadioLabel
Defined in:
lib/libGUIb16.rb,
lib/libGUIb14.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#groupObject

Returns the value of attribute group.



1374
1375
1376
# File 'lib/libGUIb16.rb', line 1374

def group
  @group
end

#lmbdownObject

Returns the value of attribute lmbdown.



1374
1375
1376
# File 'lib/libGUIb16.rb', line 1374

def lmbdown
  @lmbdown
end

#radioSelectColorObject

Returns the value of attribute radioSelectColor.



1365
1366
1367
# File 'lib/libGUIb16.rb', line 1365

def radioSelectColor
  @radioSelectColor
end

#stateObject

Returns the value of attribute state.



1374
1375
1376
# File 'lib/libGUIb16.rb', line 1374

def state
  @state
end

Instance Method Details

#change_radio_selectionObject



1371
1372
1373
# File 'lib/libGUIb16.rb', line 1371

def change_radio_selection
  self.backColor = @state ? @radioSelectColor.to_FXColor : @radioBackColor.to_FXColor
end

#lmb_press(*args) ⇒ Object



1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
# File 'lib/libGUIb16.rb', line 1375

def lmb_press(*args)
  if @group&.respond_to?(:radio_command)
    set_radio_state true
    @group.radio_command(self)
  else
    set_radio_state(!@state)
  end
  @lmbdown = true
  0
end

#radio_initialize(col = FX::Color.new(255, 255, 255)) ⇒ Object



1358
1359
1360
1361
1362
1363
1364
# File 'lib/libGUIb16.rb', line 1358

def radio_initialize col = FX::Color.new(255, 255, 255)
  @radio_initialized = true
  @radioBackColor = FX::Color.new.from_FXColor(backColor)
  @radioSelectColor ||= col
  @state = false
  connect(SEL_LEFTBUTTONPRESS, method(:lmb_press))
end

#set_radio_state(state) ⇒ Object



1366
1367
1368
1369
# File 'lib/libGUIb16.rb', line 1366

def set_radio_state state
  @state = state
  change_radio_selection
end