1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module gtk.StatusIcon; 26 27 private import gdk.Event; 28 private import gdk.Screen; 29 private import gdkpixbuf.Pixbuf; 30 private import gio.Icon; 31 private import gio.IconIF; 32 private import glib.ConstructionException; 33 private import glib.Str; 34 private import gobject.ObjectG; 35 private import gobject.Signals; 36 private import gtk.Menu; 37 private import gtk.Tooltip; 38 public import gtkc.gdktypes; 39 private import gtkc.gtk; 40 public import gtkc.gtktypes; 41 42 43 /** 44 * The “system tray” or notification area is normally used for transient icons 45 * that indicate some special state. For example, a system tray icon might 46 * appear to tell the user that they have new mail, or have an incoming instant 47 * message, or something along those lines. The basic idea is that creating an 48 * icon in the notification area is less annoying than popping up a dialog. 49 * 50 * A #GtkStatusIcon object can be used to display an icon in a “system tray”. 51 * The icon can have a tooltip, and the user can interact with it by 52 * activating it or popping up a context menu. Critical information should 53 * not solely be displayed in a #GtkStatusIcon, since it may not be 54 * visible (e.g. when the user doesn’t have a notification area on his panel). 55 * This can be checked with gtk_status_icon_is_embedded(). 56 * 57 * On X11, the implementation follows the 58 * [FreeDesktop System Tray Specification](http://www.freedesktop.org/wiki/Specifications/systemtray-spec). 59 * Implementations of the “tray” side of this specification can 60 * be found e.g. in the GNOME 2 and KDE panel applications. 61 * 62 * Note that a GtkStatusIcon is not a widget, but just 63 * a #GObject. Making it a widget would be impractical, since the system tray 64 * on Win32 doesn’t allow to embed arbitrary widgets. 65 * 66 * GtkStatusIcon has been deprecated in 3.14. You should consider using 67 * notifications or more modern platform-specific APIs instead. 68 */ 69 public class StatusIcon : ObjectG 70 { 71 /** the main Gtk struct */ 72 protected GtkStatusIcon* gtkStatusIcon; 73 74 /** Get the main Gtk struct */ 75 public GtkStatusIcon* getStatusIconStruct() 76 { 77 return gtkStatusIcon; 78 } 79 80 /** the main Gtk struct as a void* */ 81 protected override void* getStruct() 82 { 83 return cast(void*)gtkStatusIcon; 84 } 85 86 protected override void setStruct(GObject* obj) 87 { 88 gtkStatusIcon = cast(GtkStatusIcon*)obj; 89 super.setStruct(obj); 90 } 91 92 /** 93 * Sets our main struct and passes it to the parent class. 94 */ 95 public this (GtkStatusIcon* gtkStatusIcon, bool ownedRef = false) 96 { 97 this.gtkStatusIcon = gtkStatusIcon; 98 super(cast(GObject*)gtkStatusIcon, ownedRef); 99 } 100 101 /** 102 * Creates a status icon displaying a stock icon. Sample stock icon 103 * names are StockID.OPEN, StockID.QUIT. You can register your 104 * own stock icon names, see gtk_icon_factory_add_default() and 105 * gtk_icon_factory_add(). 106 * Since 2.10 107 * Params: 108 * stock_id = a stock icon id 109 * Returns: 110 * a new GtkStatusIcon 111 * Throws: ConstructionException GTK+ fails to create the object. 112 */ 113 public this (StockID stockID) 114 { 115 auto p = gtk_status_icon_new_from_stock(Str.toStringz(stockID)); 116 if(p is null) 117 { 118 throw new ConstructionException("null returned by gtk_status_icon_new_from_stock"); 119 } 120 this(cast(GtkStatusIcon*)p); 121 } 122 123 /** 124 * Creates a status icon displaying an icon from the current icon theme. 125 * If the current icon theme is changed, the icon will be updated 126 * appropriately. 127 * Since 2.10 128 * Params: 129 * iconName = an icon name 130 * loadFromFile = treat iconName as a filename and load that image 131 * with gtk_status_icon_new_from_file. 132 * Throws: ConstructionException GTK+ fails to create the object. 133 */ 134 public this (string iconName, bool loadFromFile = false) 135 { 136 //TODO: look at a better way to do this. 137 GtkStatusIcon* p; 138 139 if(loadFromFile) 140 { 141 p = cast(GtkStatusIcon*)gtk_status_icon_new_from_file(Str.toStringz(iconName)); 142 } 143 else 144 { 145 p = cast(GtkStatusIcon*)gtk_status_icon_new_from_icon_name(Str.toStringz(iconName)); 146 } 147 148 if(p is null) 149 { 150 throw new ConstructionException("null returned by gtk_status_icon_new_from_"); 151 } 152 153 this(p); 154 } 155 156 /** 157 */ 158 159 public static GType getType() 160 { 161 return gtk_status_icon_get_type(); 162 } 163 164 /** 165 * Creates an empty status icon object. 166 * 167 * Deprecated: Use notifications 168 * 169 * Return: a new #GtkStatusIcon 170 * 171 * Since: 2.10 172 * 173 * Throws: ConstructionException GTK+ fails to create the object. 174 */ 175 public this() 176 { 177 auto p = gtk_status_icon_new(); 178 179 if(p is null) 180 { 181 throw new ConstructionException("null returned by new"); 182 } 183 184 this(cast(GtkStatusIcon*) p, true); 185 } 186 187 /** 188 * Creates a status icon displaying a #GIcon. If the icon is a 189 * themed icon, it will be updated when the theme changes. 190 * 191 * Deprecated: Use notifications 192 * 193 * Params: 194 * icon = a #GIcon 195 * 196 * Return: a new #GtkStatusIcon 197 * 198 * Since: 2.14 199 * 200 * Throws: ConstructionException GTK+ fails to create the object. 201 */ 202 public this(IconIF icon) 203 { 204 auto p = gtk_status_icon_new_from_gicon((icon is null) ? null : icon.getIconStruct()); 205 206 if(p is null) 207 { 208 throw new ConstructionException("null returned by new_from_gicon"); 209 } 210 211 this(cast(GtkStatusIcon*) p, true); 212 } 213 214 /** 215 * Creates a status icon displaying @pixbuf. 216 * 217 * The image will be scaled down to fit in the available 218 * space in the notification area, if necessary. 219 * 220 * Deprecated: Use notifications 221 * 222 * Params: 223 * pixbuf = a #GdkPixbuf 224 * 225 * Return: a new #GtkStatusIcon 226 * 227 * Since: 2.10 228 * 229 * Throws: ConstructionException GTK+ fails to create the object. 230 */ 231 public this(Pixbuf pixbuf) 232 { 233 auto p = gtk_status_icon_new_from_pixbuf((pixbuf is null) ? null : pixbuf.getPixbufStruct()); 234 235 if(p is null) 236 { 237 throw new ConstructionException("null returned by new_from_pixbuf"); 238 } 239 240 this(cast(GtkStatusIcon*) p, true); 241 } 242 243 /** 244 * Menu positioning function to use with gtk_menu_popup() 245 * to position @menu aligned to the status icon @user_data. 246 * 247 * Deprecated: Use notifications 248 * 249 * Params: 250 * menu = the #GtkMenu 251 * x = return location for the x position 252 * y = return location for the y position 253 * pushIn = whether the first menu item should be offset 254 * (pushed in) to be aligned with the menu popup position 255 * (only useful for GtkOptionMenu). 256 * userData = the status icon to position the menu on 257 * 258 * Since: 2.10 259 */ 260 public static void positionMenu(Menu menu, out int x, out int y, out bool pushIn, StatusIcon userData) 261 { 262 int outpushIn; 263 264 gtk_status_icon_position_menu((menu is null) ? null : menu.getMenuStruct(), &x, &y, &outpushIn, (userData is null) ? null : userData.getStatusIconStruct()); 265 266 pushIn = (outpushIn == 1); 267 } 268 269 /** 270 * Obtains information about the location of the status icon 271 * on screen. This information can be used to e.g. position 272 * popups like notification bubbles. 273 * 274 * See gtk_status_icon_position_menu() for a more convenient 275 * alternative for positioning menus. 276 * 277 * Note that some platforms do not allow GTK+ to provide 278 * this information, and even on platforms that do allow it, 279 * the information is not reliable unless the status icon 280 * is embedded in a notification area, see 281 * gtk_status_icon_is_embedded(). 282 * 283 * Deprecated: Use notifications 284 * 285 * Params: 286 * screen = return location for 287 * the screen, or %NULL if the information is not needed 288 * area = return location for the area occupied by 289 * the status icon, or %NULL 290 * orientation = return location for the 291 * orientation of the panel in which the status icon is embedded, 292 * or %NULL. A panel at the top or bottom of the screen is 293 * horizontal, a panel at the left or right is vertical. 294 * 295 * Return: %TRUE if the location information has 296 * been filled in 297 * 298 * Since: 2.10 299 */ 300 public bool getGeometry(out Screen screen, out GdkRectangle area, out GtkOrientation orientation) 301 { 302 GdkScreen* outscreen = null; 303 304 auto p = gtk_status_icon_get_geometry(gtkStatusIcon, &outscreen, &area, &orientation) != 0; 305 306 screen = ObjectG.getDObject!(Screen)(outscreen); 307 308 return p; 309 } 310 311 /** 312 * Retrieves the #GIcon being displayed by the #GtkStatusIcon. 313 * The storage type of the status icon must be %GTK_IMAGE_EMPTY or 314 * %GTK_IMAGE_GICON (see gtk_status_icon_get_storage_type()). 315 * The caller of this function does not own a reference to the 316 * returned #GIcon. 317 * 318 * If this function fails, @icon is left unchanged; 319 * 320 * Deprecated: Use notifications 321 * 322 * Return: the displayed icon, or %NULL if the image is empty 323 * 324 * Since: 2.14 325 */ 326 public IconIF getGicon() 327 { 328 auto p = gtk_status_icon_get_gicon(gtkStatusIcon); 329 330 if(p is null) 331 { 332 return null; 333 } 334 335 return ObjectG.getDObject!(Icon, IconIF)(cast(GIcon*) p); 336 } 337 338 /** 339 * Returns the current value of the has-tooltip property. 340 * See #GtkStatusIcon:has-tooltip for more information. 341 * 342 * Deprecated: Use notifications 343 * 344 * Return: current value of has-tooltip on @status_icon. 345 * 346 * Since: 2.16 347 */ 348 public bool getHasTooltip() 349 { 350 return gtk_status_icon_get_has_tooltip(gtkStatusIcon) != 0; 351 } 352 353 /** 354 * Gets the name of the icon being displayed by the #GtkStatusIcon. 355 * The storage type of the status icon must be %GTK_IMAGE_EMPTY or 356 * %GTK_IMAGE_ICON_NAME (see gtk_status_icon_get_storage_type()). 357 * The returned string is owned by the #GtkStatusIcon and should not 358 * be freed or modified. 359 * 360 * Deprecated: Use notifications 361 * 362 * Return: name of the displayed icon, or %NULL if the image is empty. 363 * 364 * Since: 2.10 365 */ 366 public string getIconName() 367 { 368 return Str.toString(gtk_status_icon_get_icon_name(gtkStatusIcon)); 369 } 370 371 /** 372 * Gets the #GdkPixbuf being displayed by the #GtkStatusIcon. 373 * The storage type of the status icon must be %GTK_IMAGE_EMPTY or 374 * %GTK_IMAGE_PIXBUF (see gtk_status_icon_get_storage_type()). 375 * The caller of this function does not own a reference to the 376 * returned pixbuf. 377 * 378 * Deprecated: Use notifications 379 * 380 * Return: the displayed pixbuf, 381 * or %NULL if the image is empty. 382 * 383 * Since: 2.10 384 */ 385 public Pixbuf getPixbuf() 386 { 387 auto p = gtk_status_icon_get_pixbuf(gtkStatusIcon); 388 389 if(p is null) 390 { 391 return null; 392 } 393 394 return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p); 395 } 396 397 /** 398 * Returns the #GdkScreen associated with @status_icon. 399 * 400 * Deprecated: Use notifications 401 * 402 * Return: a #GdkScreen. 403 * 404 * Since: 2.12 405 */ 406 public Screen getScreen() 407 { 408 auto p = gtk_status_icon_get_screen(gtkStatusIcon); 409 410 if(p is null) 411 { 412 return null; 413 } 414 415 return ObjectG.getDObject!(Screen)(cast(GdkScreen*) p); 416 } 417 418 /** 419 * Gets the size in pixels that is available for the image. 420 * Stock icons and named icons adapt their size automatically 421 * if the size of the notification area changes. For other 422 * storage types, the size-changed signal can be used to 423 * react to size changes. 424 * 425 * Note that the returned size is only meaningful while the 426 * status icon is embedded (see gtk_status_icon_is_embedded()). 427 * 428 * Deprecated: Use notifications 429 * 430 * Return: the size that is available for the image 431 * 432 * Since: 2.10 433 */ 434 public int getSize() 435 { 436 return gtk_status_icon_get_size(gtkStatusIcon); 437 } 438 439 /** 440 * Gets the id of the stock icon being displayed by the #GtkStatusIcon. 441 * The storage type of the status icon must be %GTK_IMAGE_EMPTY or 442 * %GTK_IMAGE_STOCK (see gtk_status_icon_get_storage_type()). 443 * The returned string is owned by the #GtkStatusIcon and should not 444 * be freed or modified. 445 * 446 * Deprecated: Use gtk_status_icon_get_icon_name() instead. 447 * 448 * Return: stock id of the displayed stock icon, 449 * or %NULL if the image is empty. 450 * 451 * Since: 2.10 452 */ 453 public string getStock() 454 { 455 return Str.toString(gtk_status_icon_get_stock(gtkStatusIcon)); 456 } 457 458 /** 459 * Gets the type of representation being used by the #GtkStatusIcon 460 * to store image data. If the #GtkStatusIcon has no image data, 461 * the return value will be %GTK_IMAGE_EMPTY. 462 * 463 * Deprecated: Use notifications 464 * 465 * Return: the image representation being used 466 * 467 * Since: 2.10 468 */ 469 public GtkImageType getStorageType() 470 { 471 return gtk_status_icon_get_storage_type(gtkStatusIcon); 472 } 473 474 /** 475 * Gets the title of this tray icon. See gtk_status_icon_set_title(). 476 * 477 * Deprecated: Use notifications 478 * 479 * Return: the title of the status icon 480 * 481 * Since: 2.18 482 */ 483 public string getTitle() 484 { 485 return Str.toString(gtk_status_icon_get_title(gtkStatusIcon)); 486 } 487 488 /** 489 * Gets the contents of the tooltip for @status_icon. 490 * 491 * Deprecated: Use notifications 492 * 493 * Return: the tooltip text, or %NULL. You should free the 494 * returned string with g_free() when done. 495 * 496 * Since: 2.16 497 */ 498 public string getTooltipMarkup() 499 { 500 return Str.toString(gtk_status_icon_get_tooltip_markup(gtkStatusIcon)); 501 } 502 503 /** 504 * Gets the contents of the tooltip for @status_icon. 505 * 506 * Deprecated: Use notifications 507 * 508 * Return: the tooltip text, or %NULL. You should free the 509 * returned string with g_free() when done. 510 * 511 * Since: 2.16 512 */ 513 public string getTooltipText() 514 { 515 return Str.toString(gtk_status_icon_get_tooltip_text(gtkStatusIcon)); 516 } 517 518 /** 519 * Returns whether the status icon is visible or not. 520 * Note that being visible does not guarantee that 521 * the user can actually see the icon, see also 522 * gtk_status_icon_is_embedded(). 523 * 524 * Deprecated: Use notifications 525 * 526 * Return: %TRUE if the status icon is visible 527 * 528 * Since: 2.10 529 */ 530 public bool getVisible() 531 { 532 return gtk_status_icon_get_visible(gtkStatusIcon) != 0; 533 } 534 535 /** 536 * This function is only useful on the X11/freedesktop.org platform. 537 * It returns a window ID for the widget in the underlying 538 * status icon implementation. This is useful for the Galago 539 * notification service, which can send a window ID in the protocol 540 * in order for the server to position notification windows 541 * pointing to a status icon reliably. 542 * 543 * This function is not intended for other use cases which are 544 * more likely to be met by one of the non-X11 specific methods, such 545 * as gtk_status_icon_position_menu(). 546 * 547 * Deprecated: Use notifications 548 * 549 * Return: An 32 bit unsigned integer identifier for the 550 * underlying X11 Window 551 * 552 * Since: 2.14 553 */ 554 public uint getX11WindowId() 555 { 556 return gtk_status_icon_get_x11_window_id(gtkStatusIcon); 557 } 558 559 /** 560 * Returns whether the status icon is embedded in a notification 561 * area. 562 * 563 * Deprecated: Use notifications 564 * 565 * Return: %TRUE if the status icon is embedded in 566 * a notification area. 567 * 568 * Since: 2.10 569 */ 570 public bool isEmbedded() 571 { 572 return gtk_status_icon_is_embedded(gtkStatusIcon) != 0; 573 } 574 575 /** 576 * Makes @status_icon display the file @filename. 577 * See gtk_status_icon_new_from_file() for details. 578 * 579 * Deprecated: Use notifications 580 * 581 * Params: 582 * filename = a filename 583 * 584 * Since: 2.10 585 */ 586 public void setFromFile(string filename) 587 { 588 gtk_status_icon_set_from_file(gtkStatusIcon, Str.toStringz(filename)); 589 } 590 591 /** 592 * Makes @status_icon display the #GIcon. 593 * See gtk_status_icon_new_from_gicon() for details. 594 * 595 * Deprecated: Use notifications 596 * 597 * Params: 598 * icon = a GIcon 599 * 600 * Since: 2.14 601 */ 602 public void setFromGicon(IconIF icon) 603 { 604 gtk_status_icon_set_from_gicon(gtkStatusIcon, (icon is null) ? null : icon.getIconStruct()); 605 } 606 607 /** 608 * Makes @status_icon display the icon named @icon_name from the 609 * current icon theme. 610 * See gtk_status_icon_new_from_icon_name() for details. 611 * 612 * Deprecated: Use notifications 613 * 614 * Params: 615 * iconName = an icon name 616 * 617 * Since: 2.10 618 */ 619 public void setFromIconName(string iconName) 620 { 621 gtk_status_icon_set_from_icon_name(gtkStatusIcon, Str.toStringz(iconName)); 622 } 623 624 /** 625 * Makes @status_icon display @pixbuf. 626 * See gtk_status_icon_new_from_pixbuf() for details. 627 * 628 * Deprecated: Use notifications 629 * 630 * Params: 631 * pixbuf = a #GdkPixbuf or %NULL 632 * 633 * Since: 2.10 634 */ 635 public void setFromPixbuf(Pixbuf pixbuf) 636 { 637 gtk_status_icon_set_from_pixbuf(gtkStatusIcon, (pixbuf is null) ? null : pixbuf.getPixbufStruct()); 638 } 639 640 /** 641 * Makes @status_icon display the stock icon with the id @stock_id. 642 * See gtk_status_icon_new_from_stock() for details. 643 * 644 * Deprecated: Use gtk_status_icon_set_from_icon_name() instead. 645 * 646 * Params: 647 * stockId = a stock icon id 648 * 649 * Since: 2.10 650 */ 651 public void setFromStock(string stockId) 652 { 653 gtk_status_icon_set_from_stock(gtkStatusIcon, Str.toStringz(stockId)); 654 } 655 656 /** 657 * Sets the has-tooltip property on @status_icon to @has_tooltip. 658 * See #GtkStatusIcon:has-tooltip for more information. 659 * 660 * Deprecated: Use notifications 661 * 662 * Params: 663 * hasTooltip = whether or not @status_icon has a tooltip 664 * 665 * Since: 2.16 666 */ 667 public void setHasTooltip(bool hasTooltip) 668 { 669 gtk_status_icon_set_has_tooltip(gtkStatusIcon, hasTooltip); 670 } 671 672 /** 673 * Sets the name of this tray icon. 674 * This should be a string identifying this icon. It is may be 675 * used for sorting the icons in the tray and will not be shown to 676 * the user. 677 * 678 * Deprecated: Use notifications 679 * 680 * Params: 681 * name = the name 682 * 683 * Since: 2.20 684 */ 685 public void setName(string name) 686 { 687 gtk_status_icon_set_name(gtkStatusIcon, Str.toStringz(name)); 688 } 689 690 /** 691 * Sets the #GdkScreen where @status_icon is displayed; if 692 * the icon is already mapped, it will be unmapped, and 693 * then remapped on the new screen. 694 * 695 * Deprecated: Use notifications 696 * 697 * Params: 698 * screen = a #GdkScreen 699 * 700 * Since: 2.12 701 */ 702 public void setScreen(Screen screen) 703 { 704 gtk_status_icon_set_screen(gtkStatusIcon, (screen is null) ? null : screen.getScreenStruct()); 705 } 706 707 /** 708 * Sets the title of this tray icon. 709 * This should be a short, human-readable, localized string 710 * describing the tray icon. It may be used by tools like screen 711 * readers to render the tray icon. 712 * 713 * Deprecated: Use notifications 714 * 715 * Params: 716 * title = the title 717 * 718 * Since: 2.18 719 */ 720 public void setTitle(string title) 721 { 722 gtk_status_icon_set_title(gtkStatusIcon, Str.toStringz(title)); 723 } 724 725 /** 726 * Sets @markup as the contents of the tooltip, which is marked up with 727 * the [Pango text markup language][PangoMarkupFormat]. 728 * 729 * This function will take care of setting #GtkStatusIcon:has-tooltip to %TRUE 730 * and of the default handler for the #GtkStatusIcon::query-tooltip signal. 731 * 732 * See also the #GtkStatusIcon:tooltip-markup property and 733 * gtk_tooltip_set_markup(). 734 * 735 * Deprecated: Use notifications 736 * 737 * Params: 738 * markup = the contents of the tooltip for @status_icon, or %NULL 739 * 740 * Since: 2.16 741 */ 742 public void setTooltipMarkup(string markup) 743 { 744 gtk_status_icon_set_tooltip_markup(gtkStatusIcon, Str.toStringz(markup)); 745 } 746 747 /** 748 * Sets @text as the contents of the tooltip. 749 * 750 * This function will take care of setting #GtkStatusIcon:has-tooltip to 751 * %TRUE and of the default handler for the #GtkStatusIcon::query-tooltip 752 * signal. 753 * 754 * See also the #GtkStatusIcon:tooltip-text property and 755 * gtk_tooltip_set_text(). 756 * 757 * Deprecated: Use notifications 758 * 759 * Params: 760 * text = the contents of the tooltip for @status_icon 761 * 762 * Since: 2.16 763 */ 764 public void setTooltipText(string text) 765 { 766 gtk_status_icon_set_tooltip_text(gtkStatusIcon, Str.toStringz(text)); 767 } 768 769 /** 770 * Shows or hides a status icon. 771 * 772 * Deprecated: Use notifications 773 * 774 * Params: 775 * visible = %TRUE to show the status icon, %FALSE to hide it 776 * 777 * Since: 2.10 778 */ 779 public void setVisible(bool visible) 780 { 781 gtk_status_icon_set_visible(gtkStatusIcon, visible); 782 } 783 784 int[string] connectedSignals; 785 786 void delegate(StatusIcon)[] onActivateListeners; 787 /** 788 * Gets emitted when the user activates the status icon. 789 * If and how status icons can activated is platform-dependent. 790 * 791 * Unlike most G_SIGNAL_ACTION signals, this signal is meant to 792 * be used by applications and should be wrapped by language bindings. 793 * 794 * Since: 2.10 795 */ 796 void addOnActivate(void delegate(StatusIcon) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 797 { 798 if ( "activate" !in connectedSignals ) 799 { 800 Signals.connectData( 801 this, 802 "activate", 803 cast(GCallback)&callBackActivate, 804 cast(void*)this, 805 null, 806 connectFlags); 807 connectedSignals["activate"] = 1; 808 } 809 onActivateListeners ~= dlg; 810 } 811 extern(C) static void callBackActivate(GtkStatusIcon* statusiconStruct, StatusIcon _statusicon) 812 { 813 foreach ( void delegate(StatusIcon) dlg; _statusicon.onActivateListeners ) 814 { 815 dlg(_statusicon); 816 } 817 } 818 819 bool delegate(GdkEventButton*, StatusIcon)[] onButtonPressListeners; 820 /** 821 * The ::button-press-event signal will be emitted when a button 822 * (typically from a mouse) is pressed. 823 * 824 * Whether this event is emitted is platform-dependent. Use the ::activate 825 * and ::popup-menu signals in preference. 826 * 827 * Params: 828 * event = the #GdkEventButton which triggered 829 * this signal 830 * 831 * Return: %TRUE to stop other handlers from being invoked 832 * for the event. %FALSE to propagate the event further. 833 * 834 * Since: 2.14 835 */ 836 void addOnButtonPress(bool delegate(GdkEventButton*, StatusIcon) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 837 { 838 if ( "button-press-event" !in connectedSignals ) 839 { 840 Signals.connectData( 841 this, 842 "button-press-event", 843 cast(GCallback)&callBackButtonPress, 844 cast(void*)this, 845 null, 846 connectFlags); 847 connectedSignals["button-press-event"] = 1; 848 } 849 onButtonPressListeners ~= dlg; 850 } 851 extern(C) static int callBackButtonPress(GtkStatusIcon* statusiconStruct, GdkEventButton* event, StatusIcon _statusicon) 852 { 853 foreach ( bool delegate(GdkEventButton*, StatusIcon) dlg; _statusicon.onButtonPressListeners ) 854 { 855 if ( dlg(event, _statusicon) ) 856 { 857 return 1; 858 } 859 } 860 861 return 0; 862 } 863 864 bool delegate(Event, StatusIcon)[] onButtonPressEventGenericListeners; 865 /** 866 * The ::button-press-event signal will be emitted when a button 867 * (typically from a mouse) is pressed. 868 * 869 * Whether this event is emitted is platform-dependent. Use the ::activate 870 * and ::popup-menu signals in preference. 871 * 872 * Params: 873 * event = the #GdkEventButton which triggered 874 * this signal 875 * 876 * Return: %TRUE to stop other handlers from being invoked 877 * for the event. %FALSE to propagate the event further. 878 * 879 * Since: 2.14 880 */ 881 void addOnButtonPress(bool delegate(Event, StatusIcon) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 882 { 883 if ( "button-press-event-generic-event" !in connectedSignals ) 884 { 885 Signals.connectData( 886 this, 887 "button-press-event", 888 cast(GCallback)&callBackButtonPressEventGeneric, 889 cast(void*)this, 890 null, 891 connectFlags); 892 connectedSignals["button-press-event-generic-event"] = 1; 893 } 894 onButtonPressEventGenericListeners ~= dlg; 895 } 896 extern(C) static int callBackButtonPressEventGeneric(GtkStatusIcon* statusiconStruct, GdkEvent* event, StatusIcon _statusicon) 897 { 898 foreach ( bool delegate(Event, StatusIcon) dlg; _statusicon.onButtonPressEventGenericListeners ) 899 { 900 if ( dlg(ObjectG.getDObject!(Event)(event), _statusicon) ) 901 { 902 return 1; 903 } 904 } 905 906 return 0; 907 } 908 909 bool delegate(GdkEventButton*, StatusIcon)[] onButtonReleaseListeners; 910 /** 911 * The ::button-release-event signal will be emitted when a button 912 * (typically from a mouse) is released. 913 * 914 * Whether this event is emitted is platform-dependent. Use the ::activate 915 * and ::popup-menu signals in preference. 916 * 917 * Params: 918 * event = the #GdkEventButton which triggered 919 * this signal 920 * 921 * Return: %TRUE to stop other handlers from being invoked 922 * for the event. %FALSE to propagate the event further. 923 * 924 * Since: 2.14 925 */ 926 void addOnButtonRelease(bool delegate(GdkEventButton*, StatusIcon) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 927 { 928 if ( "button-release-event" !in connectedSignals ) 929 { 930 Signals.connectData( 931 this, 932 "button-release-event", 933 cast(GCallback)&callBackButtonRelease, 934 cast(void*)this, 935 null, 936 connectFlags); 937 connectedSignals["button-release-event"] = 1; 938 } 939 onButtonReleaseListeners ~= dlg; 940 } 941 extern(C) static int callBackButtonRelease(GtkStatusIcon* statusiconStruct, GdkEventButton* event, StatusIcon _statusicon) 942 { 943 foreach ( bool delegate(GdkEventButton*, StatusIcon) dlg; _statusicon.onButtonReleaseListeners ) 944 { 945 if ( dlg(event, _statusicon) ) 946 { 947 return 1; 948 } 949 } 950 951 return 0; 952 } 953 954 bool delegate(Event, StatusIcon)[] onButtonReleaseEventGenericListeners; 955 /** 956 * The ::button-release-event signal will be emitted when a button 957 * (typically from a mouse) is released. 958 * 959 * Whether this event is emitted is platform-dependent. Use the ::activate 960 * and ::popup-menu signals in preference. 961 * 962 * Params: 963 * event = the #GdkEventButton which triggered 964 * this signal 965 * 966 * Return: %TRUE to stop other handlers from being invoked 967 * for the event. %FALSE to propagate the event further. 968 * 969 * Since: 2.14 970 */ 971 void addOnButtonRelease(bool delegate(Event, StatusIcon) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 972 { 973 if ( "button-release-event-generic-event" !in connectedSignals ) 974 { 975 Signals.connectData( 976 this, 977 "button-release-event", 978 cast(GCallback)&callBackButtonReleaseEventGeneric, 979 cast(void*)this, 980 null, 981 connectFlags); 982 connectedSignals["button-release-event-generic-event"] = 1; 983 } 984 onButtonReleaseEventGenericListeners ~= dlg; 985 } 986 extern(C) static int callBackButtonReleaseEventGeneric(GtkStatusIcon* statusiconStruct, GdkEvent* event, StatusIcon _statusicon) 987 { 988 foreach ( bool delegate(Event, StatusIcon) dlg; _statusicon.onButtonReleaseEventGenericListeners ) 989 { 990 if ( dlg(ObjectG.getDObject!(Event)(event), _statusicon) ) 991 { 992 return 1; 993 } 994 } 995 996 return 0; 997 } 998 999 void delegate(uint, uint, StatusIcon)[] onPopupMenuListeners; 1000 /** 1001 * Gets emitted when the user brings up the context menu 1002 * of the status icon. Whether status icons can have context 1003 * menus and how these are activated is platform-dependent. 1004 * 1005 * The @button and @activate_time parameters should be 1006 * passed as the last to arguments to gtk_menu_popup(). 1007 * 1008 * Unlike most G_SIGNAL_ACTION signals, this signal is meant to 1009 * be used by applications and should be wrapped by language bindings. 1010 * 1011 * Params: 1012 * button = the button that was pressed, or 0 if the 1013 * signal is not emitted in response to a button press event 1014 * activateTime = the timestamp of the event that 1015 * triggered the signal emission 1016 * 1017 * Since: 2.10 1018 */ 1019 void addOnPopupMenu(void delegate(uint, uint, StatusIcon) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1020 { 1021 if ( "popup-menu" !in connectedSignals ) 1022 { 1023 Signals.connectData( 1024 this, 1025 "popup-menu", 1026 cast(GCallback)&callBackPopupMenu, 1027 cast(void*)this, 1028 null, 1029 connectFlags); 1030 connectedSignals["popup-menu"] = 1; 1031 } 1032 onPopupMenuListeners ~= dlg; 1033 } 1034 extern(C) static void callBackPopupMenu(GtkStatusIcon* statusiconStruct, uint button, uint activateTime, StatusIcon _statusicon) 1035 { 1036 foreach ( void delegate(uint, uint, StatusIcon) dlg; _statusicon.onPopupMenuListeners ) 1037 { 1038 dlg(button, activateTime, _statusicon); 1039 } 1040 } 1041 1042 bool delegate(int, int, bool, Tooltip, StatusIcon)[] onQueryTooltipListeners; 1043 /** 1044 * Emitted when the hover timeout has expired with the 1045 * cursor hovering above @status_icon; or emitted when @status_icon got 1046 * focus in keyboard mode. 1047 * 1048 * Using the given coordinates, the signal handler should determine 1049 * whether a tooltip should be shown for @status_icon. If this is 1050 * the case %TRUE should be returned, %FALSE otherwise. Note that if 1051 * @keyboard_mode is %TRUE, the values of @x and @y are undefined and 1052 * should not be used. 1053 * 1054 * The signal handler is free to manipulate @tooltip with the therefore 1055 * destined function calls. 1056 * 1057 * Whether this signal is emitted is platform-dependent. 1058 * For plain text tooltips, use #GtkStatusIcon:tooltip-text in preference. 1059 * 1060 * Params: 1061 * x = the x coordinate of the cursor position where the request has been 1062 * emitted, relative to @status_icon 1063 * y = the y coordinate of the cursor position where the request has been 1064 * emitted, relative to @status_icon 1065 * keyboardMode = %TRUE if the tooltip was trigged using the keyboard 1066 * tooltip = a #GtkTooltip 1067 * 1068 * Return: %TRUE if @tooltip should be shown right now, %FALSE otherwise. 1069 * 1070 * Since: 2.16 1071 */ 1072 void addOnQueryTooltip(bool delegate(int, int, bool, Tooltip, StatusIcon) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1073 { 1074 if ( "query-tooltip" !in connectedSignals ) 1075 { 1076 Signals.connectData( 1077 this, 1078 "query-tooltip", 1079 cast(GCallback)&callBackQueryTooltip, 1080 cast(void*)this, 1081 null, 1082 connectFlags); 1083 connectedSignals["query-tooltip"] = 1; 1084 } 1085 onQueryTooltipListeners ~= dlg; 1086 } 1087 extern(C) static int callBackQueryTooltip(GtkStatusIcon* statusiconStruct, int x, int y, bool keyboardMode, GtkTooltip* tooltip, StatusIcon _statusicon) 1088 { 1089 foreach ( bool delegate(int, int, bool, Tooltip, StatusIcon) dlg; _statusicon.onQueryTooltipListeners ) 1090 { 1091 if ( dlg(x, y, keyboardMode, ObjectG.getDObject!(Tooltip)(tooltip), _statusicon) ) 1092 { 1093 return 1; 1094 } 1095 } 1096 1097 return 0; 1098 } 1099 1100 bool delegate(GdkEventScroll*, StatusIcon)[] onScrollListeners; 1101 /** 1102 * The ::scroll-event signal is emitted when a button in the 4 to 7 1103 * range is pressed. Wheel mice are usually configured to generate 1104 * button press events for buttons 4 and 5 when the wheel is turned. 1105 * 1106 * Whether this event is emitted is platform-dependent. 1107 * 1108 * Params: 1109 * event = the #GdkEventScroll which triggered 1110 * this signal 1111 * 1112 * Return: %TRUE to stop other handlers from being invoked for the event. 1113 * %FALSE to propagate the event further. 1114 * 1115 * Since: 2.16 1116 */ 1117 void addOnScroll(bool delegate(GdkEventScroll*, StatusIcon) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1118 { 1119 if ( "scroll-event" !in connectedSignals ) 1120 { 1121 Signals.connectData( 1122 this, 1123 "scroll-event", 1124 cast(GCallback)&callBackScroll, 1125 cast(void*)this, 1126 null, 1127 connectFlags); 1128 connectedSignals["scroll-event"] = 1; 1129 } 1130 onScrollListeners ~= dlg; 1131 } 1132 extern(C) static int callBackScroll(GtkStatusIcon* statusiconStruct, GdkEventScroll* event, StatusIcon _statusicon) 1133 { 1134 foreach ( bool delegate(GdkEventScroll*, StatusIcon) dlg; _statusicon.onScrollListeners ) 1135 { 1136 if ( dlg(event, _statusicon) ) 1137 { 1138 return 1; 1139 } 1140 } 1141 1142 return 0; 1143 } 1144 1145 bool delegate(Event, StatusIcon)[] onScrollEventGenericListeners; 1146 /** 1147 * The ::scroll-event signal is emitted when a button in the 4 to 7 1148 * range is pressed. Wheel mice are usually configured to generate 1149 * button press events for buttons 4 and 5 when the wheel is turned. 1150 * 1151 * Whether this event is emitted is platform-dependent. 1152 * 1153 * Params: 1154 * event = the #GdkEventScroll which triggered 1155 * this signal 1156 * 1157 * Return: %TRUE to stop other handlers from being invoked for the event. 1158 * %FALSE to propagate the event further. 1159 * 1160 * Since: 2.16 1161 */ 1162 void addOnScroll(bool delegate(Event, StatusIcon) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1163 { 1164 if ( "scroll-event-generic-event" !in connectedSignals ) 1165 { 1166 Signals.connectData( 1167 this, 1168 "scroll-event", 1169 cast(GCallback)&callBackScrollEventGeneric, 1170 cast(void*)this, 1171 null, 1172 connectFlags); 1173 connectedSignals["scroll-event-generic-event"] = 1; 1174 } 1175 onScrollEventGenericListeners ~= dlg; 1176 } 1177 extern(C) static int callBackScrollEventGeneric(GtkStatusIcon* statusiconStruct, GdkEvent* event, StatusIcon _statusicon) 1178 { 1179 foreach ( bool delegate(Event, StatusIcon) dlg; _statusicon.onScrollEventGenericListeners ) 1180 { 1181 if ( dlg(ObjectG.getDObject!(Event)(event), _statusicon) ) 1182 { 1183 return 1; 1184 } 1185 } 1186 1187 return 0; 1188 } 1189 1190 bool delegate(int, StatusIcon)[] onSizeChangedListeners; 1191 /** 1192 * Gets emitted when the size available for the image 1193 * changes, e.g. because the notification area got resized. 1194 * 1195 * Params: 1196 * size = the new size 1197 * 1198 * Return: %TRUE if the icon was updated for the new 1199 * size. Otherwise, GTK+ will scale the icon as necessary. 1200 * 1201 * Since: 2.10 1202 */ 1203 void addOnSizeChanged(bool delegate(int, StatusIcon) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1204 { 1205 if ( "size-changed" !in connectedSignals ) 1206 { 1207 Signals.connectData( 1208 this, 1209 "size-changed", 1210 cast(GCallback)&callBackSizeChanged, 1211 cast(void*)this, 1212 null, 1213 connectFlags); 1214 connectedSignals["size-changed"] = 1; 1215 } 1216 onSizeChangedListeners ~= dlg; 1217 } 1218 extern(C) static int callBackSizeChanged(GtkStatusIcon* statusiconStruct, int size, StatusIcon _statusicon) 1219 { 1220 foreach ( bool delegate(int, StatusIcon) dlg; _statusicon.onSizeChangedListeners ) 1221 { 1222 if ( dlg(size, _statusicon) ) 1223 { 1224 return 1; 1225 } 1226 } 1227 1228 return 0; 1229 } 1230 }