1 # Copyright (c) 2009 Paolo Capriotti <p.capriotti@gmail.com>
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
12 def square_tag(name, element, opts = {})
13 define_method(name) do
14 instance_variable_get("@#{name}")
17 define_method("#{name}=") do |val|
18 tag_pixmap = lambda { theme.board.send(element, unit) }
19 tag_reloader = lambda do |key, item|
20 item.pixmap = tag_pixmap[]
21 item.pos = to_real(val)
24 instance_variable_set("@#{name}", val)
26 options = { :pos => to_real(val),
28 :reloader => tag_reloader}.merge(opts)
29 item = square_tag_container.add_item(name, options)
32 square_tag_container.remove_item(name)
38 def self.included(klass)
39 klass.extend ClassMethods
44 def set_tag(name, value)
45 send("#{name}=", value)
48 def square_tag_container