[ruby-gnome2-doc-cvs] [Ruby-GNOME2 Project Website] update - tut-gtk2-txtw-ttags

Back to archive index

ruby-****@sourc***** ruby-****@sourc*****
2012年 9月 16日 (日) 07:47:44 JST


-------------------------
REMOTE_ADDR = 184.145.80.187
REMOTE_HOST = 
        URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-txtw-ttags
-------------------------
@@ -228,12 +228,12 @@
       ...
  buff.apply_tag("bold", start_iter, end_iter)
 
-NOTE: in our example program we used a trick to obtain tag property names from button labels, where they are stored as Gtk::Stock items. If you need to store some new property such as a tag value in your widgets you could simply add it to the widget class as needed. For instance you could expand the Gtk::Button class to include a new property called ((*texttag.*))
+NOTE: in our example program we used a trick to obtain tag property names from button labels, where they are stored as Gtk::Stock items. If you need to store some new property such as a tag value in your widgets you could simply add it to the widget class as needed. For instance you could expand the Gtk::Button class to include a new property called ((*ttag_prop.*))
 
 
 Just as a picture is worth a thousand words so is perhaps a listing of an executable program. Let me repeat the above example program this time with code that modifies Gtk::Button class to include a new property to store a tag_name, used in Gtk::TextBuffer's tag table:
 
-((*texttags-button-texttag.rb*))
+((*texttags-button-ttag_prop.rb*))
 
  #!/usr/bin/env ruby
  require 'gtk2'
@@ -242,7 +242,7 @@
  # to the selection.
  def format(b, txtvu)
    s, e = txtvu.buffer.selection_bounds
-   txtvu.buffer.apply_tag(b.texttag, s, e)
+   txtvu.buffer.apply_tag(b.ttag_prop, s, e)
  end
  
  # Apply the selected text size property as the tag.
@@ -303,13 +303,13 @@
  # Our little addition to the Button class, in order to
  # save what usually is stored as label, however we use
  # stock item rather than a label.
- class Gtk::Button; attr_accessor :texttag; end
+ class Gtk::Button; attr_accessor :ttag_prop; end
 
  # Add the name of the text tag as a data parameter of the object.
- bold.texttag      = "bold"
- italic.texttag    = "italic"
- underline.texttag = "underline"
- strike.texttag    = "strikethrough"
+ bold.ttag_prop      = "bold"
+ italic.ttag_prop    = "italic"
+ underline.ttag_prop = "underline"
+ strike.ttag_prop    = "strikethrough"
 
  # Add choices to the GtkComboBox widget.
  ts.each do |e|
@@ -354,4 +354,4 @@
  # Our little addition to the Button class, in order to
  # save what usually is stored as label, however we use
  # stock item rather than a label.
- class Gtk::Button; attr_accessor :texttag; end
+ class Gtk::Button; attr_accessor :ttag_prop; end




ruby-gnome2-cvs メーリングリストの案内
Back to archive index