/* Copyright (C) 2005 The gtkmm Development Team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 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, see . */ _CONFIGINCLUDE(gtkmmconfig.h) _DEFS(gtkmm,gtk) _PINCLUDE(glibmm/private/object_p.h) #m4 _PUSH(SECTION_CC_PRE_INCLUDES) #undef GTK_DISABLE_DEPRECATED #define GDK_DISABLE_DEPRECATION_WARNINGS 1 #m4 _POP() #include //Deprecated: #include #include #include #include #include _IS_DEPRECATED // This whole file is deprecated. namespace Gtk { /** The "system tray" or notification area is normally used for transient icons that indicate some * special state. For example, a system tray icon might appear to tell the user that they have new * mail, or have an incoming instant message, or something along those lines. The basic idea is * that creating an icon in the notification area is less annoying than popping up a dialog. * * A StatusIcon object can be used to display an icon in a "system tray". The icon can have a * tooltip, and the user can interact with it by activating it or popping up a context menu. * Critical information should not solely be displayed in a StatusIcon, since it may not be * visible (e.g. when the user doesn't have a notification area on his panel). This can be checked * with is_embedded(). * * On X11, the implementation follows the freedesktop.org "System Tray" specification. * Implementations of the "tray" side of this specification can be found e.g. in the GNOME and KDE * panel applications. * * Note that a StatusIcon is not a widget, but just a Glib::Object. * Making it a widget would be impractical, since the system tray * on Win32 doesn’t allow to embed arbitrary widgets. * * @newin{2,10} * * @deprecated You should consider using notifications or more modern platform-specific APIs instead. */ class GTKMM_API StatusIcon : public Glib::Object { _CLASS_GOBJECT(StatusIcon, GtkStatusIcon, GTK_STATUS_ICON, Glib::Object, GObject, , , GTKMM_API) protected: _CTOR_DEFAULT _IGNORE(gtk_status_icon_new) _WRAP_CTOR(StatusIcon(const Glib::RefPtr& pixbuf), gtk_status_icon_new_from_pixbuf) // _WRAP_CTOR does not take a 'deprecated' parameter. // _WRAP_CTOR(StatusIcon(const StockID& stock), gtk_status_icon_new_from_stock) #ifndef GTKMM_DISABLE_DEPRECATED /** @deprecated Use the constructor with the @a icon_name parameter instead. */ explicit StatusIcon(const StockID& stock); #endif // GTKMM_DISABLE_DEPRECATED _WRAP_CTOR(StatusIcon(const Glib::ustring& icon_name), gtk_status_icon_new_from_icon_name) _WRAP_CTOR(StatusIcon(const Glib::RefPtr& icon), gtk_status_icon_new_from_gicon) public: /** Creates a new Gtk::StatusIcon object. * @return A Glib::RefPtr<> to a newly created Gtk::StatusIcon object. */ _WRAP_CREATE(const Glib::RefPtr& pixbuf) // _WRAP_CREATE does not take a 'deprecated' parameter. // _WRAP_CREATE(const StockID& stock_id) #ifndef GTKMM_DISABLE_DEPRECATED /** @deprecated Use create() with the @a icon_name parameter instead. */ static Glib::RefPtr create(const StockID& stock_id); #endif // GTKMM_DISABLE_DEPRECATED _WRAP_CREATE(const Glib::ustring& icon_name) /** Creates a status icon displaying the file @a filename. * The image will be scaled down to fit in the available * space in the notification area, if necessary. * * @param filename A filename. * @result A new StatusIcon * * @newin{2,10} */ static Glib::RefPtr create_from_file(const std::string& filename); _IGNORE(gtk_status_icon_new_from_file) _WRAP_METHOD(void set(const Glib::RefPtr& pixbuf), gtk_status_icon_set_from_pixbuf) _WRAP_METHOD(void set_from_file(const Glib::ustring& filename), gtk_status_icon_set_from_file) _WRAP_METHOD(void set(const StockID& stock_id), gtk_status_icon_set_from_stock, deprecated "Use the set() with the @a icon_name parameter instead.") _WRAP_METHOD(void set(const Glib::ustring& icon_name), gtk_status_icon_set_from_icon_name) _WRAP_METHOD(void set(const Glib::RefPtr& icon), gtk_status_icon_set_from_gicon) _WRAP_METHOD(ImageType get_storage_type() const, gtk_status_icon_get_storage_type) _WRAP_METHOD(Glib::RefPtr get_pixbuf(), gtk_status_icon_get_pixbuf) _WRAP_METHOD(Glib::RefPtr get_pixbuf() const, gtk_status_icon_get_pixbuf, constversion) _WRAP_METHOD(StockID get_stock() const, gtk_status_icon_get_stock, deprecated "Use the get_icon_name() instead.") _WRAP_METHOD(Glib::ustring get_icon_name() const, gtk_status_icon_get_icon_name) _WRAP_METHOD(Glib::RefPtr get_icon(), gtk_status_icon_get_gicon, refreturn) _WRAP_METHOD(Glib::RefPtr get_icon() const, gtk_status_icon_get_gicon, refreturn, constversion) _WRAP_METHOD(int get_size() const, gtk_status_icon_get_size) _WRAP_METHOD(void set_screen(const Glib::RefPtr& screen), gtk_status_icon_set_screen) _WRAP_METHOD(Glib::RefPtr get_screen(), gtk_status_icon_get_screen, refreturn) _WRAP_METHOD(Glib::RefPtr get_screen() const, gtk_status_icon_get_screen, refreturn, constversion) _WRAP_METHOD(void set_visible(bool visible = true), gtk_status_icon_set_visible) _WRAP_METHOD(bool get_visible() const, gtk_status_icon_get_visible) _WRAP_METHOD(bool is_embedded() const, gtk_status_icon_is_embedded) /** Displays a menu aligned to the status icon, and makes it available for selection. * Applications can use this function to display context-sensitive menus. * * This is equivalent to the gtk_status_icon_position_menu() helper callback in GTK+, * which can be provided to gtk_menu_popup(). * * See Gtk::Menu::popup() for more details. * * @param menu The menu to popup for the status icon. * @param button The mouse button which was pressed to initiate the event. * @param activate_time The time at which the activation event occurred. * * @newin{2,12} */ void popup_menu_at_position(Menu& menu, guint button, guint32 activate_time); _IGNORE(gtk_status_icon_position_menu) //Note that gtk_status_icon_position_menu() is meant to be used as a helpful callback when calling gtk_menu_popup(). //We make it easier by just providing a popup method that uses it. //In gtk_status_icon_get_geometry(), any of the parameters may be NULL, //but we don't need 6 different overloads, with different parameters. //But we can add some if there are common cases. /** Obtains information about the location of the status icon * on screen. This information can be used to e.g. position * popups like notification bubbles. * See popup_menu_at_position() for a more convenient * alternative for positioning menus. * * Note that some platforms do not allow GTK+ to provide * this information. * * @param screen: The screen. * @param area The area occupied by the status icon. * @param orientation The orientation of the panel in which the status icon is embedded. A panel * at the top or bottom of the screen is horizontal, a panel at the left or right is vertical. * @result true if the location information has been filled in. * * @newin{2,10} */ bool get_geometry(Glib::RefPtr& screen, Gdk::Rectangle& area, Orientation& orientation); _IGNORE(gtk_status_icon_get_geometry) _WRAP_METHOD(bool get_has_tooltip() const, gtk_status_icon_get_has_tooltip) _WRAP_METHOD(void set_has_tooltip(bool has_tooltip = true), gtk_status_icon_set_has_tooltip) _WRAP_METHOD(Glib::ustring get_tooltip_text() const, gtk_status_icon_get_tooltip_text) _WRAP_METHOD(void set_tooltip_text(const Glib::ustring& text), gtk_status_icon_set_tooltip_text) _WRAP_METHOD(Glib::ustring get_tooltip_markup() const, gtk_status_icon_get_tooltip_markup) _WRAP_METHOD(void set_tooltip_markup(const Glib::ustring& markup), gtk_status_icon_set_tooltip_markup) _WRAP_METHOD(void set_title(const Glib::ustring& title), gtk_status_icon_set_title) _WRAP_METHOD(Glib::ustring get_title() const, gtk_status_icon_get_title) _WRAP_METHOD(void set_name(const Glib::ustring& name), gtk_status_icon_set_name) _WRAP_METHOD(guint32 get_x11_window_id() const, gtk_status_icon_get_x11_window_id) _WRAP_PROPERTY("pixbuf", Glib::RefPtr) _WRAP_PROPERTY("file", std::string) _WRAP_PROPERTY("stock", StockID, deprecated "Use property_icon_name() instead.") _WRAP_PROPERTY("icon-name", Glib::ustring) _WRAP_PROPERTY("gicon", Glib::RefPtr) _WRAP_PROPERTY("storage-type", ImageType) _WRAP_PROPERTY("size", int) _WRAP_PROPERTY("screen", Glib::RefPtr) _WRAP_PROPERTY("visible", bool) _WRAP_PROPERTY("embedded", bool) _WRAP_PROPERTY("orientation", Orientation) _WRAP_PROPERTY("has-tooltip", bool) _WRAP_PROPERTY("tooltip-text", Glib::ustring) _WRAP_PROPERTY("tooltip-markup", Glib::ustring) _WRAP_PROPERTY("title", Glib::ustring) _WRAP_SIGNAL(bool size_changed(int size), size_changed) _WRAP_SIGNAL(void activate(), activate) _WRAP_SIGNAL(void popup_menu(guint button, guint32 activate_time), popup_menu) _WRAP_SIGNAL(bool button_press_event(GdkEventButton* event), button_press_event) _WRAP_SIGNAL(bool button_release_event(GdkEventButton* event), button_release_event) _WRAP_SIGNAL(bool scroll_event(GdkEventScroll* event), scroll_event) #m4 _CONVERSION(`GtkTooltip*',`const Glib::RefPtr&',`Glib::wrap($3, true)') _WRAP_SIGNAL(bool query_tooltip(int x, int y, bool keyboard_mode, const Glib::RefPtr& tooltip), query_tooltip) }; } // namespace Gtk