]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkmenutoolbutton.c
Change FSF Address
[~andy/gtk] / gtk / gtkmenutoolbutton.c
index e63d795317b33271018c345b4ca86fb097de4f3e..3256d7dfd854d6c9f890fb26e37ec5a846a6524b 100644 (file)
@@ -14,9 +14,7 @@
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include "config.h"
@@ -25,8 +23,7 @@
 
 #include "gtktogglebutton.h"
 #include "gtkarrow.h"
-#include "gtkhbox.h"
-#include "gtkvbox.h"
+#include "gtkbox.h"
 #include "gtkmenu.h"
 #include "gtkmain.h"
 #include "gtksizerequest.h"
 #include "gtkintl.h"
 
 
+/**
+ * SECTION:gtkmenutoolbutton
+ * @Short_description: A GtkToolItem containing a button with an additional dropdown menu
+ * @Title: GtkMenuToolButton
+ * @See_also: #GtkToolbar, #GtkToolButton
+ *
+ * A #GtkMenuToolButton is a #GtkToolItem that contains a button and
+ * a small additional button with an arrow. When clicked, the arrow
+ * button pops up a dropdown menu.
+ *
+ * Use gtk_menu_tool_button_new() to create a new
+ * #GtkMenuToolButton. Use gtk_menu_tool_button_new_from_stock() to
+ * create a new #GtkMenuToolButton containing a stock item.
+ *
+ * <refsect2 id="GtkMenuToolButton-BUILDER-UI">
+ * <title>GtkMenuToolButton as GtkBuildable</title>
+ * <para>
+ * The GtkMenuToolButton implementation of the GtkBuildable interface
+ * supports adding a menu by specifying "menu" as the "type"
+ * attribute of a &lt;child&gt; element.
+ *
+ * <example>
+ * <title>A UI definition fragment with menus</title>
+ * <programlisting><![CDATA[
+ * <object class="GtkMenuToolButton">
+ *   <child type="menu">
+ *     <object class="GtkMenu"/>
+ *   </child>
+ * </object>
+ * ]]></programlisting>
+ * </example>
+ * </para>
+ * </refsect2>
+ */
+
+
 struct _GtkMenuToolButtonPrivate
 {
   GtkWidget *button;
@@ -292,7 +325,7 @@ menu_position_func (GtkMenu           *menu,
   monitor_num = gdk_screen_get_monitor_at_window (screen, window);
   if (monitor_num < 0)
     monitor_num = 0;
-  gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
+  gdk_screen_get_monitor_workarea (screen, monitor_num, &monitor);
 
   if (orientation == GTK_ORIENTATION_HORIZONTAL)
     {
@@ -382,7 +415,7 @@ arrow_button_button_press_event_cb (GtkWidget         *widget,
                                     GdkEventButton    *event,
                                     GtkMenuToolButton *button)
 {
-  if (event->button == 1)
+  if (event->button == GDK_BUTTON_PRIMARY)
     {
       popup_menu_under_arrow (button, event);
       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);