| 1 |
|
| 2 |
|
| 3 |
require 'mui/gtk_form_dsl' |
| 4 |
require 'mui/gtk_form_dsl_multi_select' |
| 5 |
require 'mui/gtk_form_dsl_select' |
| 6 |
|
| 7 |
module Plugin::ExtractGtk |
| 8 |
end |
| 9 |
|
| 10 |
class Plugin::ExtractGtk::OptionWidget < Gtk::Grid |
| 11 |
include Gtk::FormDSL |
| 12 |
|
| 13 |
def create_inner_setting |
| 14 |
self.class.new(@plugin, @extract) |
| 15 |
end |
| 16 |
|
| 17 |
def initialize(plugin, extract) |
| 18 |
@plugin = plugin |
| 19 |
@extract = extract |
| 20 |
|
| 21 |
super() |
| 22 |
self.row_spacing = self.column_spacing = self.margin = 12 |
| 23 |
end |
| 24 |
|
| 25 |
def [](key) |
| 26 |
case key |
| 27 |
when :icon, :sound |
| 28 |
@extract[key].to_s |
| 29 |
else |
| 30 |
@extract[key] |
| 31 |
end |
| 32 |
end |
| 33 |
|
| 34 |
def []=(key, value) |
| 35 |
@extract[key] = case key |
| 36 |
when :icon, :sound |
| 37 |
value.empty? ? nil : value |
| 38 |
else |
| 39 |
value |
| 40 |
end |
| 41 |
@extract.notify_update |
| 42 |
end |
| 43 |
|
| 44 |
def method_missing(method, *, &) |
| 45 |
@plugin.send(method, *, &) |
| 46 |
end |
| 47 |
|
| 48 |
def respond_to_missing?(method, include_private=false) |
| 49 |
@plugin.respond_to?(method, include_private) |
| 50 |
end |
| 51 |
end |