如何在 GtkToolbar 的溢出菜单中显示 GtkToolItem?
我正在使用 gtk2hs 开发 Haskell 应用程序。该应用程序有一个工具栏,由多个 GtkToggleToolButton、GtkToolButton 和 GtkToolItem 元素组成。为了能够调整应用程序窗口的大小,我设置了 ShowArrow 属性设置为 True,这样元素就会位于窗口,列在溢出菜单中。
这对于 GtkToggleToolButton 和 GtkToolButton 元素效果很好,但 GtkToolItem 元素不会显示在菜单中。这不会是一个大问题,但如果这些元素不在窗口框架内,则菜单箭头不会仅为它们显示。这样您就不会发现工具栏实际上有更多元素。
GtkToolItem 包含一个 GtkTable,其中包含一个标签和两个 GtkToolButton 元素。我可以告诉 GTK 它应该在我的 GtkToolItem 元素的溢出菜单中显示一个标签吗?
先感谢您!
托比亚斯
I am working on a Haskell application using gtk2hs. This application has a toolbar which consists of several GtkToggleToolButton, GtkToolButton and GtkToolItem elements. For being able to resize the applications window, I set the ShowArrow attribute to True, so that elements, that would be outside the window, are listed in an overflow menu.
This works fine for GtkToggleToolButton and GtkToolButton elements, but GtkToolItem elements do not show up in the menu. This would not be such a big problem, but if those elements are not inside the window frame, the menu arrow does not show up only for them. So that you have no indication that the toolbar has actually more elements.
The GtkToolItem contains a GtkTable which contains a label and two GtkToolButton elements. Can I tell GTK that it should display a label in the overflow menu for my GtkToolItem elements?
Thank you in advance!
Tobias
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
GtkToolButton 本身是一个 GtkToolItem(您可以将该表添加到其中)!那为什么直接使用GtkToolItem呢?
我认为除了
set_label
之外,您还应该使用GtkToolButton.set_stock_id
(或set_icon_widget
),而不是创建表格......GtkToolButton itself is a GtkToolItem (and you can add that table to it)! Then why you are using GtkToolItem directly?
And I think you should use
GtkToolButton.set_stock_id
(orset_icon_widget
) aditional toset_label
, instead of createing a table...ToolItem 有一个方法 toolItemSetProxyMenuItem ,它允许您指定在溢出菜单中显示的菜单项:
http://hackage.haskell.org/packages/archive/gtk/0.11.0/doc /html/Graphics-UI-Gtk-MenuComboToolbar-ToolItem.html#v:toolItemSetProxyMenuItem
ToolItem has a method toolItemSetProxyMenuItem which allows you to specify the menu item that is displayed in the overflow menu:
http://hackage.haskell.org/packages/archive/gtk/0.11.0/doc/html/Graphics-UI-Gtk-MenuComboToolbar-ToolItem.html#v:toolItemSetProxyMenuItem