Class: MyRendererColorButton

Inherits:
Gtk::ColorButton
  • Object
show all
Includes:
Conf, ManqodCommon
Defined in:
lib/FormHolder/Form/InputHolder/ColorButton.rb

Overview

this file is part of manqod manqod is distributed under the CDDL licence the author of manqod is Dobai-Pataky Balint([email protected])

Constant Summary

Constants included from ManqodCommon

ManqodCommon::CRITICAL, ManqodCommon::DEBUG, ManqodCommon::ERROR, ManqodCommon::INFO, ManqodCommon::NORMAL, ManqodCommon::WARNING

Constants included from Eprint

Eprint::DOMAIN, Eprint::LEVEL

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Conf

#get_conf, #load_conf, #save_conf, #set_conf

Methods included from ManqodCommon

#add_where, #admin, #admin_cache, #admin_qrow, #admin_rows, #backtrace_to_debug, #cache, #changed_ids_of_base, #client, #client_fields, #client_image_of_id, #client_qrow, #client_query, #client_rows, #eeval, #escape_string, #getBinding, #guess_base, #guess_table, #image_of_id, #lzero, #manqod_db, #measure, #myexec, #nick, #nick_id, #number_format, #qrow, #query, #reconnect_manqod_db, #rows, #run_events, #send_message, #sendmail, #set_manqod_db_uri, #set_nick

Methods included from Eprint

#ecode, #edebug, #eerror, #einfo, #enormal, #eprint, #ewarn, #gtk_set_edebug, #set_edebug, #tell_exception

Constructor Details

#initialize(pc) ⇒ MyRendererColorButton

Returns a new instance of MyRendererColorButton.



8
9
10
11
12
13
14
15
16
# File 'lib/FormHolder/Form/InputHolder/ColorButton.rb', line 8

def initialize(pc)
@pc=pc
super()
set_use_alpha(false)
signal_connect('clicked'){|me|
	edebug("#{item['default']} clicked","gtk_button","debug")
	run_events(item['id'],'form_item-Action')
}
end

Instance Attribute Details

#pcObject

Returns the value of attribute pc.



17
18
19
# File 'lib/FormHolder/Form/InputHolder/ColorButton.rb', line 17

def pc
  @pc
end

Instance Method Details

#inspectObject



47
48
49
# File 'lib/FormHolder/Form/InputHolder/ColorButton.rb', line 47

def inspect
	"ColorButton(#{item['description']})"
end

#itemObject



44
45
46
# File 'lib/FormHolder/Form/InputHolder/ColorButton.rb', line 44

def item
pc.item
end

#parentMObject



37
38
39
# File 'lib/FormHolder/Form/InputHolder/ColorButton.rb', line 37

def parentM
pc.parentM
end

#targetObject



41
42
43
# File 'lib/FormHolder/Form/InputHolder/ColorButton.rb', line 41

def target
nil
end

#textObject



31
32
33
34
35
# File 'lib/FormHolder/Form/InputHolder/ColorButton.rb', line 31

def text
	t=""
color.to_a.each{|i| t="#{t}#{sprintf("%02x",i/255)}"}
t
end

#to_sObject



50
51
52
# File 'lib/FormHolder/Form/InputHolder/ColorButton.rb', line 50

def to_s
	inspect
end

#update(new_value = item['default']) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/FormHolder/Form/InputHolder/ColorButton.rb', line 19

def update(new_value=item['default'])
item['default']=new_value
run_events(item['id'],'form_item-BeforeUpdate')
begin
	set_color(Gdk::Color.parse("##{item['default']}"))
rescue => err
	ewarn("#{item['default'].inspect} not a valid color")
end
edebug(item['default'].to_s+" updated","gtk_button","info")
run_events(item['id'],'form_item-AfterUpdate')
end