Class: TkFloatTitledFrame

Inherits:
TkBaseTitledFrame show all
Includes:
TkMovable, TkResizable
Defined in:
lib/a-tkcommons.rb

Constant Summary

Constants included from TkResizable

TkResizable::MIN_HEIGHT, TkResizable::MIN_WIDTH

Instance Attribute Summary

Attributes inherited from TkBaseTitledFrame

#frame, #top

Instance Method Summary collapse

Methods included from TkResizable

#resizing_do_move_obj, #resizing_do_press, #start_resizing, #stop_resizing

Methods included from TkMovable

#moving_do_move_obj, #moving_do_press, #start_moving, #stop_moving

Methods inherited from TkBaseTitledFrame

#add_fixed_button, #add_fixed_menu_button, #add_fixed_panel, #add_fixed_sep, #create_frame, #menu_button, #visible?

Constructor Details

#initialize(parent = nil, *args) ⇒ TkFloatTitledFrame

Returns a new instance of TkFloatTitledFrame.



1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
# File 'lib/a-tkcommons.rb', line 1405

def initialize(parent=nil, *args)
  super(parent)
  frame.place('height'=>-32)
  borderwidth  2
  relief  'groove'

  @right_label = TkLabel.new(@top, Arcadia.style('titlelabel')){
    anchor 'w'
  }.pack('fill'=>'x', 'side'=>'top')
  #.place('x'=>0, 'y'=>0,'relheight'=>1, 'relwidth'=>1 ,'width'=>-20)

  @resizing_label=TkLabel.new(self, Arcadia.style('label')){
    text '-'
    image Arcadia.image_res(EXPAND_LIGHT_GIF)
  }.pack('side'=> 'right','anchor'=> 's')
  start_moving(@right_label, self)
  start_moving(frame, self)
  start_resizing(@resizing_label, self)
  @grabbed = false
  #    frame.bind_append('KeyPress'){|e|
  #      p e.keysym
  #      case e.keysym
  #        when 'Escape'
  #          p "WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW"
  #          hide
  #      end
  #    }
  Arcadia.instance.register_key_binding(self,"KeyPress[Escape]","ActionEvent.new(self, 'action'=>hide_if_visible)")
end

Instance Method Details

#head_buttonsObject

def show_modal

  # not implemented
end


1481
1482
# File 'lib/a-tkcommons.rb', line 1481

def head_buttons
end

#hideObject



1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
# File 'lib/a-tkcommons.rb', line 1447

def hide
  @manager = TkWinfo.manager(self)
  if @manager == 'place'
    @x_place = TkPlace.info(self)['x']
    @y_place = TkPlace.info(self)['y']
    @width_place = TkPlace.info(self)['width']
    @height_place = TkPlace.info(self)['height']
    self.unplace
  end

  if @grabbed
    self.grab("release")
    @grabbed = false
  end
  self
end

#hide_if_visibleObject



1443
1444
1445
# File 'lib/a-tkcommons.rb', line 1443

def hide_if_visible
  hide if visible?
end

#on_close=(_proc) ⇒ Object



1439
1440
1441
# File 'lib/a-tkcommons.rb', line 1439

def on_close=(_proc)
  add_fixed_button('X', _proc, TAB_CLOSE_GIF)
end

#showObject



1464
1465
1466
1467
1468
1469
# File 'lib/a-tkcommons.rb', line 1464

def show
  if @manager == 'place'
    self.place('x'=>@x_place, 'y'=>@y_place, 'width'=>@width_place, 'height'=>@height_place)
  end
  self.raise
end

#show_grabbedObject



1471
1472
1473
1474
1475
# File 'lib/a-tkcommons.rb', line 1471

def show_grabbed
  show
  @grabbed = true
  self.grab("set")
end

#title(_text) ⇒ Object



1435
1436
1437
# File 'lib/a-tkcommons.rb', line 1435

def title(_text)
  @right_label.text(_text)
end