diff options
Diffstat (limited to 'docs/libdbusmenu-gtk/reference/xml/menuitem.xml')
-rw-r--r-- | docs/libdbusmenu-gtk/reference/xml/menuitem.xml | 178 |
1 files changed, 178 insertions, 0 deletions
diff --git a/docs/libdbusmenu-gtk/reference/xml/menuitem.xml b/docs/libdbusmenu-gtk/reference/xml/menuitem.xml new file mode 100644 index 0000000..12f1325 --- /dev/null +++ b/docs/libdbusmenu-gtk/reference/xml/menuitem.xml @@ -0,0 +1,178 @@ +<?xml version="1.0"?> +<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" + "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" +[ + <!ENTITY % local.common.attrib "xmlns:xi CDATA #FIXED 'http://www.w3.org/2003/XInclude'"> +]> +<refentry id="libdbusmenu-gtk-menuitem"> +<refmeta> +<refentrytitle role="top_of_page" id="libdbusmenu-gtk-menuitem.top_of_page">menuitem</refentrytitle> +<manvolnum>3</manvolnum> +<refmiscinfo> + LIBDBUSMENU-GTK Library +</refmiscinfo> +</refmeta> +<refnamediv> +<refname>menuitem</refname> +<refpurpose>Helpers for <link linkend="DbusmenuMenuitem"><type>DbusmenuMenuitem</type></link> properties that require a GTK dependency</refpurpose> +</refnamediv> +<refsect1 id="libdbusmenu-gtk-menuitem.stability-level"> +<title>Stability Level</title> +Unstable, unless otherwise indicated +</refsect1> + +<refsynopsisdiv id="libdbusmenu-gtk-menuitem.synopsis" role="synopsis"> +<title role="synopsis.title">Synopsis</title> + +<synopsis> +#include <libdbusmenu-gtk/menuitem.h> + +<link linkend="gboolean"><returnvalue>gboolean</returnvalue></link> <link linkend="dbusmenu-menuitem-property-set-image">dbusmenu_menuitem_property_set_image</link> + (<parameter><link linkend="DbusmenuMenuitem"><type>DbusmenuMenuitem</type></link> *menuitem</parameter>, + <parameter>const <link linkend="gchar"><type>gchar</type></link> *property</parameter>, + <parameter>const <link linkend="GdkPixbuf"><type>GdkPixbuf</type></link> *data</parameter>); +<link linkend="GdkPixbuf"><returnvalue>GdkPixbuf</returnvalue></link> * <link linkend="dbusmenu-menuitem-property-get-image">dbusmenu_menuitem_property_get_image</link> + (<parameter><link linkend="DbusmenuMenuitem"><type>DbusmenuMenuitem</type></link> *menuitem</parameter>, + <parameter>const <link linkend="gchar"><type>gchar</type></link> *property</parameter>); +<link linkend="gboolean"><returnvalue>gboolean</returnvalue></link> <link linkend="dbusmenu-menuitem-property-set-shortcut">dbusmenu_menuitem_property_set_shortcut</link> + (<parameter><link linkend="DbusmenuMenuitem"><type>DbusmenuMenuitem</type></link> *menuitem</parameter>, + <parameter><link linkend="guint"><type>guint</type></link> key</parameter>, + <parameter><link linkend="GdkModifierType"><type>GdkModifierType</type></link> modifier</parameter>); +<link linkend="gboolean"><returnvalue>gboolean</returnvalue></link> <link linkend="dbusmenu-menuitem-property-set-shortcut-string">dbusmenu_menuitem_property_set_shortcut_string</link> + (<parameter><link linkend="DbusmenuMenuitem"><type>DbusmenuMenuitem</type></link> *menuitem</parameter>, + <parameter>const <link linkend="gchar"><type>gchar</type></link> *shortcut</parameter>); +<link linkend="gboolean"><returnvalue>gboolean</returnvalue></link> <link linkend="dbusmenu-menuitem-property-set-shortcut-menuitem">dbusmenu_menuitem_property_set_shortcut_menuitem</link> + (<parameter><link linkend="DbusmenuMenuitem"><type>DbusmenuMenuitem</type></link> *menuitem</parameter>, + <parameter>const <link linkend="GtkMenuItem"><type>GtkMenuItem</type></link> *gmi</parameter>); +<link linkend="void"><returnvalue>void</returnvalue></link> <link linkend="dbusmenu-menuitem-property-get-shortcut">dbusmenu_menuitem_property_get_shortcut</link> + (<parameter><link linkend="DbusmenuMenuitem"><type>DbusmenuMenuitem</type></link> *menuitem</parameter>, + <parameter><link linkend="guint"><type>guint</type></link> *key</parameter>, + <parameter><link linkend="GdkModifierType"><type>GdkModifierType</type></link> *modifier</parameter>); +</synopsis> +</refsynopsisdiv> + +<refsect1 id="libdbusmenu-gtk-menuitem.description" role="desc"> +<title role="desc.title">Description</title> +<para> +Some property helpers can't be done without picking up a GTK+ + dependency. So those sit in libdbusmenu-gtk but have very similar + prototypes to the code in libdbusmenu-glib so your code will + look consistent, just with the extra depedency. +</para> +</refsect1> +<refsect1 id="libdbusmenu-gtk-menuitem.details" role="details"> +<title role="details.title">Details</title> +<refsect2 id="dbusmenu-menuitem-property-set-image" role="function"> +<title>dbusmenu_menuitem_property_set_image ()</title> +<indexterm zone="dbusmenu-menuitem-property-set-image"><primary>dbusmenu_menuitem_property_set_image</primary></indexterm> +<programlisting><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link> dbusmenu_menuitem_property_set_image + (<parameter><link linkend="DbusmenuMenuitem"><type>DbusmenuMenuitem</type></link> *menuitem</parameter>, + <parameter>const <link linkend="gchar"><type>gchar</type></link> *property</parameter>, + <parameter>const <link linkend="GdkPixbuf"><type>GdkPixbuf</type></link> *data</parameter>);</programlisting> +<para> +This function takes the pixbuf that is stored in <parameter>data</parameter> and +turns it into a base64 encoded PNG so that it can be placed +onto a standard <link linkend="DbusmenuMenuitem"><type>DbusmenuMenuitem</type></link> property. +</para><variablelist role="params"> +<varlistentry><term><parameter>menuitem</parameter> :</term> +<listitem><simpara>The <link linkend="DbusmenuMenuitem"><type>DbusmenuMenuitem</type></link> to set the property on.</simpara></listitem></varlistentry> +<varlistentry><term><parameter>property</parameter> :</term> +<listitem><simpara>Name of the property to set.</simpara></listitem></varlistentry> +<varlistentry><term><parameter>data</parameter> :</term> +<listitem><simpara>The image to place on the property.</simpara></listitem></varlistentry> +<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara>Whether the function was able to set the property +or not.</simpara></listitem></varlistentry> +</variablelist></refsect2> +<refsect2 id="dbusmenu-menuitem-property-get-image" role="function"> +<title>dbusmenu_menuitem_property_get_image ()</title> +<indexterm zone="dbusmenu-menuitem-property-get-image"><primary>dbusmenu_menuitem_property_get_image</primary></indexterm> +<programlisting><link linkend="GdkPixbuf"><returnvalue>GdkPixbuf</returnvalue></link> * dbusmenu_menuitem_property_get_image + (<parameter><link linkend="DbusmenuMenuitem"><type>DbusmenuMenuitem</type></link> *menuitem</parameter>, + <parameter>const <link linkend="gchar"><type>gchar</type></link> *property</parameter>);</programlisting> +<para> +This function looks on the menu item for a property by the +name of <parameter>property</parameter>. If one exists it tries to turn it into +a <link linkend="GdkPixbuf"><type>GdkPixbuf</type></link>. It assumes that the property is a base64 encoded +PNG file like the one created by <link linkend="dbusmenu-menuite-property-set-image"><type>dbusmenu_menuite_property_set_image</type></link>. +</para><variablelist role="params"> +<varlistentry><term><parameter>menuitem</parameter> :</term> +<listitem><simpara>The <link linkend="DbusmenuMenuitem"><type>DbusmenuMenuitem</type></link> to look for the property on</simpara></listitem></varlistentry> +<varlistentry><term><parameter>property</parameter> :</term> +<listitem><simpara>The name of the property to look for.</simpara></listitem></varlistentry> +<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara>A pixbuf or <link linkend="NULL:CAPS"><type>NULL</type></link> to signal error. <emphasis role="annotation">[<acronym>transfer full</acronym>]</emphasis></simpara></listitem></varlistentry> +</variablelist></refsect2> +<refsect2 id="dbusmenu-menuitem-property-set-shortcut" role="function"> +<title>dbusmenu_menuitem_property_set_shortcut ()</title> +<indexterm zone="dbusmenu-menuitem-property-set-shortcut"><primary>dbusmenu_menuitem_property_set_shortcut</primary></indexterm> +<programlisting><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link> dbusmenu_menuitem_property_set_shortcut + (<parameter><link linkend="DbusmenuMenuitem"><type>DbusmenuMenuitem</type></link> *menuitem</parameter>, + <parameter><link linkend="guint"><type>guint</type></link> key</parameter>, + <parameter><link linkend="GdkModifierType"><type>GdkModifierType</type></link> modifier</parameter>);</programlisting> +<para> +Takes the modifer described by <parameter>key</parameter> and <parameter>modifier</parameter> and places that into +the format sending across Dbus for shortcuts. +</para><variablelist role="params"> +<varlistentry><term><parameter>menuitem</parameter> :</term> +<listitem><simpara>The <link linkend="DbusmenuMenuitem"><type>DbusmenuMenuitem</type></link> to set the shortcut on</simpara></listitem></varlistentry> +<varlistentry><term><parameter>key</parameter> :</term> +<listitem><simpara>The keycode of the key to send</simpara></listitem></varlistentry> +<varlistentry><term><parameter>modifier</parameter> :</term> +<listitem><simpara>A bitmask of modifiers used to activate the item</simpara></listitem></varlistentry> +<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara>Whether it was successful at setting the property.</simpara></listitem></varlistentry> +</variablelist></refsect2> +<refsect2 id="dbusmenu-menuitem-property-set-shortcut-string" role="function"> +<title>dbusmenu_menuitem_property_set_shortcut_string ()</title> +<indexterm zone="dbusmenu-menuitem-property-set-shortcut-string"><primary>dbusmenu_menuitem_property_set_shortcut_string</primary></indexterm> +<programlisting><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link> dbusmenu_menuitem_property_set_shortcut_string + (<parameter><link linkend="DbusmenuMenuitem"><type>DbusmenuMenuitem</type></link> *menuitem</parameter>, + <parameter>const <link linkend="gchar"><type>gchar</type></link> *shortcut</parameter>);</programlisting> +<para> +This function takes a GTK shortcut string as defined in +<link linkend="gtk-accelerator-parse"><type>gtk_accelerator_parse</type></link> and turns that into the information +required to send it over DBusmenu. +</para><variablelist role="params"> +<varlistentry><term><parameter>menuitem</parameter> :</term> +<listitem><simpara>The <link linkend="DbusmenuMenuitem"><type>DbusmenuMenuitem</type></link> to set the shortcut on</simpara></listitem></varlistentry> +<varlistentry><term><parameter>shortcut</parameter> :</term> +<listitem><simpara>String describing the shortcut</simpara></listitem></varlistentry> +<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara>Whether it was successful at setting the property.</simpara></listitem></varlistentry> +</variablelist></refsect2> +<refsect2 id="dbusmenu-menuitem-property-set-shortcut-menuitem" role="function"> +<title>dbusmenu_menuitem_property_set_shortcut_menuitem ()</title> +<indexterm zone="dbusmenu-menuitem-property-set-shortcut-menuitem"><primary>dbusmenu_menuitem_property_set_shortcut_menuitem</primary></indexterm> +<programlisting><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link> dbusmenu_menuitem_property_set_shortcut_menuitem + (<parameter><link linkend="DbusmenuMenuitem"><type>DbusmenuMenuitem</type></link> *menuitem</parameter>, + <parameter>const <link linkend="GtkMenuItem"><type>GtkMenuItem</type></link> *gmi</parameter>);</programlisting> +<para> +Takes the shortcut that is installed on a menu item and calls +<link linkend="dbusmenu-menuitem-property-set-shortcut"><type>dbusmenu_menuitem_property_set_shortcut</type></link> with it. It also sets +up listeners to watch it change. +</para><variablelist role="params"> +<varlistentry><term><parameter>menuitem</parameter> :</term> +<listitem><simpara>The <link linkend="DbusmenuMenuitem"><type>DbusmenuMenuitem</type></link> to set the shortcut on</simpara></listitem></varlistentry> +<varlistentry><term><parameter>gmi</parameter> :</term> +<listitem><simpara>A menu item to steal the shortcut off of</simpara></listitem></varlistentry> +<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara>Whether it was successful at setting the property.</simpara></listitem></varlistentry> +</variablelist></refsect2> +<refsect2 id="dbusmenu-menuitem-property-get-shortcut" role="function"> +<title>dbusmenu_menuitem_property_get_shortcut ()</title> +<indexterm zone="dbusmenu-menuitem-property-get-shortcut"><primary>dbusmenu_menuitem_property_get_shortcut</primary></indexterm> +<programlisting><link linkend="void"><returnvalue>void</returnvalue></link> dbusmenu_menuitem_property_get_shortcut + (<parameter><link linkend="DbusmenuMenuitem"><type>DbusmenuMenuitem</type></link> *menuitem</parameter>, + <parameter><link linkend="guint"><type>guint</type></link> *key</parameter>, + <parameter><link linkend="GdkModifierType"><type>GdkModifierType</type></link> *modifier</parameter>);</programlisting> +<para> +This function gets a GTK shortcut as a key and a mask +for use to set the accelerators. +</para><variablelist role="params"> +<varlistentry><term><parameter>menuitem</parameter> :</term> +<listitem><simpara>The <link linkend="DbusmenuMenuitem"><type>DbusmenuMenuitem</type></link> to get the shortcut off</simpara></listitem></varlistentry> +<varlistentry><term><parameter>key</parameter> :</term> +<listitem><simpara>Location to put the key value. <emphasis role="annotation">[<acronym>out</acronym>]</emphasis></simpara></listitem></varlistentry> +<varlistentry><term><parameter>modifier</parameter> :</term> +<listitem><simpara>Location to put the modifier mask. <emphasis role="annotation">[<acronym>out</acronym>]</emphasis></simpara></listitem></varlistentry> +</variablelist></refsect2> + +</refsect1> + +</refentry> |