| 1 |
|
| 2 |
|
| 3 |
module Plugin::GUI::TabLike |
| 4 |
|
| 5 |
attr_reader :icon |
| 6 |
attr_accessor :deletable |
| 7 |
|
| 8 |
def initialize(*args) |
| 9 |
@expand = true |
| 10 |
super |
| 11 |
end |
| 12 |
|
| 13 |
け小さく表示する |
| 14 |
|
| 15 |
|
| 16 |
def shrink |
| 17 |
@expand = false |
| 18 |
self end |
| 19 |
|
| 20 |
け大きく表示する |
| 21 |
|
| 22 |
|
| 23 |
def expand(new = true) |
| 24 |
@expand = new |
| 25 |
self end |
| 26 |
|
| 27 |
def expand? |
| 28 |
@expand end |
| 29 |
|
| 30 |
def pack_rule |
| 31 |
@pack_rule ||= [] end |
| 32 |
|
| 33 |
def add_child(child, *args) |
| 34 |
result = super(child, *args) |
| 35 |
pack_rule[children.index(child)] = expand? |
| 36 |
result end |
| 37 |
alias << add_child |
| 38 |
|
| 39 |
を作成してこの中に入れる |
| 40 |
|
| 41 |
ラインスラッグ |
| 42 |
処理 |
| 43 |
|
| 44 |
成したタイムライン |
| 45 |
def timeline(slug, &proc) |
| 46 |
timeline = Plugin::GUI::Timeline.instance(slug) |
| 47 |
self << timeline |
| 48 |
timeline.instance_eval(&proc) if proc |
| 49 |
timeline end |
| 50 |
|
| 51 |
を作成してこの中に入れる |
| 52 |
|
| 53 |
ィールスラッグ |
| 54 |
処理 |
| 55 |
|
| 56 |
成したプロフィール |
| 57 |
def cluster(slug, &proc) |
| 58 |
cluster = Plugin::GUI::Cluster.instance(slug) |
| 59 |
self << cluster |
| 60 |
pack_rule.push(expand?) |
| 61 |
cluster.instance_eval(&proc) if proc |
| 62 |
cluster end |
| 63 |
|
| 64 |
ィジェット(Gtk等)をタブに入れる |
| 65 |
|
| 66 |
ジェット |
| 67 |
|
| 68 |
|
| 69 |
def nativewidget(widget) |
| 70 |
i_container = Plugin::GUI::TabChildWidget.instance |
| 71 |
self << i_container |
| 72 |
Plugin.call("gui_nativewidget_join_#{self.class.role}".to_sym, self, i_container, widget) |
| 73 |
pack_rule.push(expand?) |
| 74 |
self end |
| 75 |
|
| 76 |
def set_icon(icon) |
| 77 |
icon_model = case icon |
| 78 |
when Diva::Model |
| 79 |
icon |
| 80 |
when String, URI, Addressable::URI, Diva::URI |
| 81 |
Plugin.collect(:photo_filter, icon, Pluggaloid::COLLECT).first || Skin[:notfound] |
| 82 |
else |
| 83 |
raise RuntimeError, "Unexpected class `#{icon.class}'." |
| 84 |
end |
| 85 |
if @icon != icon_model |
| 86 |
@icon = icon_model |
| 87 |
Plugin.call(:gui_tab_change_icon, self) end |
| 88 |
self end |
| 89 |
|
| 90 |
def set_deletable(new) |
| 91 |
@deletable = new |
| 92 |
self end |
| 93 |
|
| 94 |
def name=(new_name) |
| 95 |
result = super new_name |
| 96 |
Plugin.call(:gui_tab_change_icon, self) |
| 97 |
result end |
| 98 |
|
| 99 |
end |