File: pane.rb

package info (click to toggle)
mikutter 5.1.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 9,780 kB
  • sloc: ruby: 22,912; sh: 186; makefile: 21
file content (42 lines) | stat: -rw-r--r-- 970 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# -*- coding: utf-8 -*-
# ペインインターフェイスを提供するクラス

require_relative 'cuscadable'
require_relative 'hierarchy_parent'
require_relative 'hierarchy_child'
require_relative 'window'
require_relative 'widget'

class Plugin::GUI::Pane

  include Plugin::GUI::Cuscadable
  include Plugin::GUI::HierarchyChild
  include Plugin::GUI::HierarchyParent
  include Plugin::GUI::Widget

  role :pane

  set_parent_event :gui_pane_join_window

  # instanceから呼ばれる。勝手に作成しないこと
  def initialize(*args)
    super
    @@default ||= self
    Plugin.call(:pane_created, self)
  end

  def active!(just_this=true, by_toolkit=false)
    @@default = self
    super end

  def self.active
    @@default ||= instance(:default, "デフォルト")
  end

  def add_child(child, index=children.size)
    result = super(child, index)
    if children[index+1] == @active_child
      Delayer.new{ child.active! } end
    result end

end