| 1 |
|
| 2 |
ターフェイスを提供するクラス |
| 3 |
|
| 4 |
require_relative 'cuscadable' |
| 5 |
require_relative 'hierarchy_parent' |
| 6 |
require_relative 'widget' |
| 7 |
|
| 8 |
class Plugin::GUI::Window |
| 9 |
|
| 10 |
include Plugin::GUI::Cuscadable |
| 11 |
include Plugin::GUI::HierarchyParent |
| 12 |
include Plugin::GUI::Widget |
| 13 |
|
| 14 |
role :window |
| 15 |
|
| 16 |
attr_reader :icon |
| 17 |
|
| 18 |
る。勝手に作成しないこと |
| 19 |
def initialize(*args) |
| 20 |
super |
| 21 |
@@active ||= self |
| 22 |
Plugin.call(:window_created, self) |
| 23 |
end |
| 24 |
|
| 25 |
ブになったことを報告する |
| 26 |
def active!(just_this=true, by_toolkit=false) |
| 27 |
@@active = self |
| 28 |
end |
| 29 |
|
| 30 |
def self.active |
| 31 |
@@active ||= instance(:default, _("デフォルト")) |
| 32 |
end |
| 33 |
|
| 34 |
def set_icon(icon) |
| 35 |
case icon |
| 36 |
when Diva::Model |
| 37 |
@icon = icon |
| 38 |
when String, URI, Addressable::URI, Diva::URI |
| 39 |
@icon = Plugin.collect(:photo_filter, icon, Pluggaloid::COLLECT).first || Skin[:notfound] |
| 40 |
else |
| 41 |
raise RuntimeError, "Unexpected class `#{icon.class}'." |
| 42 |
end |
| 43 |
Plugin.call(:gui_window_change_icon, self, icon) |
| 44 |
end |
| 45 |
|
| 46 |
end |