Created
December 31, 2013 12:11
-
-
Save penguin2716/8195851 to your computer and use it in GitHub Desktop.
フォーカスの有無によって投稿ボックスの背景色を変更するmikutterプラグイン
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#-*- coding: utf-8 -*- | |
require 'gtk2' | |
Plugin.create :colorize_textview_base do | |
UserConfig[:normal_basecolor] ||= [0xffff, 0xffff, 0xffff] | |
UserConfig[:focused_basecolor] ||= [0xffff, 0xffff, 0xbbbb] | |
settings "投稿ボックスの背景色" do | |
settings "色の設定" do | |
color "フォーカスなし", :normal_basecolor | |
color "フォーカスあり", :focused_basecolor | |
end | |
end | |
end | |
class Gtk::PostBox | |
def gen_widget_post | |
tv = Gtk::TextView.new | |
tv.signal_connect('focus-in-event') { |widget, event| | |
color = UserConfig[:focused_basecolor] | |
widget.modify_base(Gtk::STATE_NORMAL, Gdk::Color.new(color[0], color[1], color[2])) | |
false | |
} | |
tv.signal_connect('focus-out-event') { |widget, event| | |
color = UserConfig[:normal_basecolor] | |
widget.modify_base(Gtk::STATE_NORMAL, Gdk::Color.new(color[0], color[1], color[2])) | |
false | |
} | |
tv | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment