This is a multi-part message in MIME format.

--Multipart_Mon__10_Sep_2001_01:46:19_+0900_0828e058
Content-Type: text/plain; charset=ISO-2022-JP
Content-Transfer-Encoding: 7bit

むとうです。

Ruby/GTKで、Gtk::Toolbar#{append,prepend,insert}_element()
を実装しました。

Gtk::Toolbar#append_element(type, widget, text, tooltip_text, 
              tooltip_private_text, icon) { }
Gtk::Toolbar#prepend_element(type, widget, text, tooltip_text, 
              tooltip_private_text, icon) { }
Gtk::Toolbar#insert_element(type, widget, text, tooltip_text, 
              tooltip_private_text, icon, position) { }

です。戻り値はGtk::Widgetになり、typeで指定し生成されたオブジェクトになります。

typeには、

Gtk::Toolbar::CHILD_SPACE
Gtk::Toolbar::CHILD_BUTTON
Gtk::Toolbar::CHILD_TOGGLEBUTTON
Gtk::Toolbar::CHILD_RADIOBUTTON
Gtk::Toolbar::CHILD_WIDGET

が指定できます。

2つ目widgetは、typeによって指定するものが異なります。

Gtk::Toolbar::CHILD_SPACE
Gtk::Toolbar::CHILD_BUTTON
Gtk::Toolbar::CHILD_TOGGLEBUTTON
 上記の場合はnilを指定します。

Gtk::Toolbar::CHILD_RADIOBUTTON
 グループたいものに対し最房萋世靴拭奮謄瓮
ドの戻り値)  のGtk::RadioButtonを指定します。 Gtk::Toolbar::CHILD_WIDGET  Gtk::Widgetのサブクラスを指定します。たとえば、Gtk::Entryなど。 ------ [ruby-ext:01891]の件もあるのですが、やはりfunc(Procオブジェクト) を引数に持たせるのは他のWidgetから比べても特殊だと思いましたので、省きました。 なお、添付パッチは[ruby-ext:01891]のpatchをあてた後のものです。 では。 ---- ○● むとう まさお(MUTOH Masao) ●○ E-Mail:mutoh / highway.ne.jp --Multipart_Mon__10_Sep_2001_01:46:19_+0900_0828e058 Content-Type: application/octet-stream; namebgtktoolbar.c.patch" Content-Disposition: attachment; filenamebgtktoolbar.c.patch" Content-Transfer-Encoding: base64 LS0tIHNyYy9yYmd0a3Rvb2xiYXIuYy5vbGQJU3VuIFNlcCAgOSAyMjoyOT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