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 * Conversion parameters: 26 * inFile = GtkStatusIcon.html 27 * outPack = gtk 28 * outFile = StatusIcon 29 * strct = GtkStatusIcon 30 * realStrct= 31 * ctorStrct= 32 * clss = StatusIcon 33 * interf = 34 * class Code: Yes 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gtk_status_icon_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * - gtk_status_icon_new_from_stock 45 * - gtk_status_icon_new_from_file 46 * - gtk_status_icon_new_from_icon_name 47 * omit signals: 48 * imports: 49 * - glib.Str 50 * - gio.Icon 51 * - gio.IconIF 52 * - gdk.Pixbuf 53 * - gdk.Screen 54 * - gtk.Menu 55 * - gtk.Tooltip 56 * structWrap: 57 * - GIcon* -> IconIF 58 * - GdkPixbuf* -> Pixbuf 59 * - GdkScreen* -> Screen 60 * - GtkMenu* -> Menu 61 * - GtkTooltip* -> Tooltip 62 * module aliases: 63 * local aliases: 64 * overrides: 65 */ 66 67 module gtk.StatusIcon; 68 69 public import gtkc.gtktypes; 70 71 private import gtkc.gtk; 72 private import glib.ConstructionException; 73 private import gobject.ObjectG; 74 75 private import gobject.Signals; 76 public import gtkc.gdktypes; 77 private import glib.Str; 78 private import gio.Icon; 79 private import gio.IconIF; 80 private import gdk.Pixbuf; 81 private import gdk.Screen; 82 private import gtk.Menu; 83 private import gtk.Tooltip; 84 85 86 private import gobject.ObjectG; 87 88 /** 89 * The "system tray" or notification area is normally used for transient icons 90 * that indicate some special state. For example, a system tray icon might 91 * appear to tell the user that they have new mail, or have an incoming instant 92 * message, or something along those lines. The basic idea is that creating an 93 * icon in the notification area is less annoying than popping up a dialog. 94 * 95 * A GtkStatusIcon object can be used to display an icon in a "system tray". 96 * The icon can have a tooltip, and the user can interact with it by 97 * activating it or popping up a context menu. Critical information should 98 * not solely be displayed in a GtkStatusIcon, since it may not be 99 * visible (e.g. when the user doesn't have a notification area on his panel). 100 * This can be checked with gtk_status_icon_is_embedded(). 101 * 102 * On X11, the implementation follows the freedesktop.org "System Tray" 103 * specification. 104 * Implementations of the "tray" side of this specification can 105 * be found e.g. in the GNOME 2 and KDE panel applications. 106 * 107 * Note that a GtkStatusIcon is not a widget, but just 108 * a GObject. Making it a widget would be impractical, since the system tray 109 * on Win32 doesn't allow to embed arbitrary widgets. 110 */ 111 public class StatusIcon : ObjectG 112 { 113 114 /** the main Gtk struct */ 115 protected GtkStatusIcon* gtkStatusIcon; 116 117 118 /** Get the main Gtk struct */ 119 public GtkStatusIcon* getStatusIconStruct() 120 { 121 return gtkStatusIcon; 122 } 123 124 125 /** the main Gtk struct as a void* */ 126 protected override void* getStruct() 127 { 128 return cast(void*)gtkStatusIcon; 129 } 130 131 /** 132 * Sets our main struct and passes it to the parent class 133 */ 134 public this (GtkStatusIcon* gtkStatusIcon) 135 { 136 super(cast(GObject*)gtkStatusIcon); 137 this.gtkStatusIcon = gtkStatusIcon; 138 } 139 140 protected override void setStruct(GObject* obj) 141 { 142 super.setStruct(obj); 143 gtkStatusIcon = cast(GtkStatusIcon*)obj; 144 } 145 146 /** 147 * Creates a status icon displaying a stock icon. Sample stock icon 148 * names are StockID.OPEN, StockID.QUIT. You can register your 149 * own stock icon names, see gtk_icon_factory_add_default() and 150 * gtk_icon_factory_add(). 151 * Since 2.10 152 * Params: 153 * stock_id = a stock icon id 154 * Returns: 155 * a new GtkStatusIcon 156 * Throws: ConstructionException GTK+ fails to create the object. 157 */ 158 public this (StockID stockID) 159 { 160 // GtkStatusIcon* gtk_status_icon_new_from_stock (const gchar *stock_id); 161 auto p = gtk_status_icon_new_from_stock(Str.toStringz(StockDesc[stockID])); 162 if(p is null) 163 { 164 throw new ConstructionException("null returned by gtk_status_icon_new_from_stock"); 165 } 166 this(cast(GtkStatusIcon*)p); 167 } 168 169 /** 170 * Creates a status icon displaying an icon from the current icon theme. 171 * If the current icon theme is changed, the icon will be updated 172 * appropriately. 173 * Since 2.10 174 * Params: 175 * iconName = an icon name 176 * loadFromFile = treat iconName as a filename and load that image 177 * with gtk_status_icon_new_from_file. 178 * Throws: ConstructionException GTK+ fails to create the object. 179 */ 180 public this (string iconName, bool loadFromFile = false) 181 { 182 //TODO: look at a better way to do this. 183 GtkStatusIcon* p; 184 185 if(loadFromFile) 186 { 187 // GtkStatusIcon* gtk_status_icon_new_from_file (const gchar *filename); 188 p = cast(GtkStatusIcon*)gtk_status_icon_new_from_file(Str.toStringz(iconName)); 189 } 190 else 191 { 192 // GtkStatusIcon* gtk_status_icon_new_from_icon_name (const gchar *icon_name); 193 p = cast(GtkStatusIcon*)gtk_status_icon_new_from_icon_name(Str.toStringz(iconName)); 194 } 195 196 if(p is null) 197 { 198 throw new ConstructionException("null returned by gtk_status_icon_new_from_"); 199 } 200 201 this(p); 202 } 203 204 /** 205 */ 206 int[string] connectedSignals; 207 208 void delegate(StatusIcon)[] onActivateListeners; 209 /** 210 * Gets emitted when the user activates the status icon. 211 * If and how status icons can activated is platform-dependent. 212 * Unlike most G_SIGNAL_ACTION signals, this signal is meant to 213 * be used by applications and should be wrapped by language bindings. 214 * Since 2.10 215 */ 216 void addOnActivate(void delegate(StatusIcon) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 217 { 218 if ( !("activate" in connectedSignals) ) 219 { 220 Signals.connectData( 221 getStruct(), 222 "activate", 223 cast(GCallback)&callBackActivate, 224 cast(void*)this, 225 null, 226 connectFlags); 227 connectedSignals["activate"] = 1; 228 } 229 onActivateListeners ~= dlg; 230 } 231 extern(C) static void callBackActivate(GtkStatusIcon* statusIconStruct, StatusIcon _statusIcon) 232 { 233 foreach ( void delegate(StatusIcon) dlg ; _statusIcon.onActivateListeners ) 234 { 235 dlg(_statusIcon); 236 } 237 } 238 239 bool delegate(GdkEvent*, StatusIcon)[] onButtonPressListeners; 240 /** 241 * The ::button-press-event signal will be emitted when a button 242 * (typically from a mouse) is pressed. 243 * Whether this event is emitted is platform-dependent. Use the ::activate 244 * and ::popup-menu signals in preference. 245 * TRUE to stop other handlers from being invoked 246 * for the event. FALSE to propagate the event further. 247 * Since 2.14 248 */ 249 void addOnButtonPress(bool delegate(GdkEvent*, StatusIcon) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 250 { 251 if ( !("button-press-event" in connectedSignals) ) 252 { 253 Signals.connectData( 254 getStruct(), 255 "button-press-event", 256 cast(GCallback)&callBackButtonPress, 257 cast(void*)this, 258 null, 259 connectFlags); 260 connectedSignals["button-press-event"] = 1; 261 } 262 onButtonPressListeners ~= dlg; 263 } 264 extern(C) static gboolean callBackButtonPress(GtkStatusIcon* statusIconStruct, GdkEvent* event, StatusIcon _statusIcon) 265 { 266 foreach ( bool delegate(GdkEvent*, StatusIcon) dlg ; _statusIcon.onButtonPressListeners ) 267 { 268 if ( dlg(event, _statusIcon) ) 269 { 270 return 1; 271 } 272 } 273 274 return 0; 275 } 276 277 bool delegate(GdkEvent*, StatusIcon)[] onButtonReleaseListeners; 278 /** 279 * The ::button-release-event signal will be emitted when a button 280 * (typically from a mouse) is released. 281 * Whether this event is emitted is platform-dependent. Use the ::activate 282 * and ::popup-menu signals in preference. 283 * TRUE to stop other handlers from being invoked 284 * for the event. FALSE to propagate the event further. 285 * Since 2.14 286 */ 287 void addOnButtonRelease(bool delegate(GdkEvent*, StatusIcon) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 288 { 289 if ( !("button-release-event" in connectedSignals) ) 290 { 291 Signals.connectData( 292 getStruct(), 293 "button-release-event", 294 cast(GCallback)&callBackButtonRelease, 295 cast(void*)this, 296 null, 297 connectFlags); 298 connectedSignals["button-release-event"] = 1; 299 } 300 onButtonReleaseListeners ~= dlg; 301 } 302 extern(C) static gboolean callBackButtonRelease(GtkStatusIcon* statusIconStruct, GdkEvent* event, StatusIcon _statusIcon) 303 { 304 foreach ( bool delegate(GdkEvent*, StatusIcon) dlg ; _statusIcon.onButtonReleaseListeners ) 305 { 306 if ( dlg(event, _statusIcon) ) 307 { 308 return 1; 309 } 310 } 311 312 return 0; 313 } 314 315 void delegate(guint, guint, StatusIcon)[] onPopupMenuListeners; 316 /** 317 * Gets emitted when the user brings up the context menu 318 * of the status icon. Whether status icons can have context 319 * menus and how these are activated is platform-dependent. 320 * The button and activate_time parameters should be 321 * passed as the last to arguments to gtk_menu_popup(). 322 * Unlike most G_SIGNAL_ACTION signals, this signal is meant to 323 * be used by applications and should be wrapped by language bindings. 324 * Since 2.10 325 */ 326 void addOnPopupMenu(void delegate(guint, guint, StatusIcon) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 327 { 328 if ( !("popup-menu" in connectedSignals) ) 329 { 330 Signals.connectData( 331 getStruct(), 332 "popup-menu", 333 cast(GCallback)&callBackPopupMenu, 334 cast(void*)this, 335 null, 336 connectFlags); 337 connectedSignals["popup-menu"] = 1; 338 } 339 onPopupMenuListeners ~= dlg; 340 } 341 extern(C) static void callBackPopupMenu(GtkStatusIcon* statusIconStruct, guint button, guint activateTime, StatusIcon _statusIcon) 342 { 343 foreach ( void delegate(guint, guint, StatusIcon) dlg ; _statusIcon.onPopupMenuListeners ) 344 { 345 dlg(button, activateTime, _statusIcon); 346 } 347 } 348 349 bool delegate(gint, gint, gboolean, Tooltip, StatusIcon)[] onQueryTooltipListeners; 350 /** 351 * Emitted when the hover timeout has expired with the 352 * cursor hovering above status_icon; or emitted when status_icon got 353 * focus in keyboard mode. 354 * Using the given coordinates, the signal handler should determine 355 * whether a tooltip should be shown for status_icon. If this is 356 * the case TRUE should be returned, FALSE otherwise. Note that if 357 * keyboard_mode is TRUE, the values of x and y are undefined and 358 * should not be used. 359 * The signal handler is free to manipulate tooltip with the therefore 360 * destined function calls. 361 * Whether this signal is emitted is platform-dependent. 362 * For plain text tooltips, use "tooltip-text" in preference. 363 * TRUE if the tooltip was trigged using the keyboard 364 * TRUE if tooltip should be shown right now, FALSE otherwise. 365 * Since 2.16 366 */ 367 void addOnQueryTooltip(bool delegate(gint, gint, gboolean, Tooltip, StatusIcon) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 368 { 369 if ( !("query-tooltip" in connectedSignals) ) 370 { 371 Signals.connectData( 372 getStruct(), 373 "query-tooltip", 374 cast(GCallback)&callBackQueryTooltip, 375 cast(void*)this, 376 null, 377 connectFlags); 378 connectedSignals["query-tooltip"] = 1; 379 } 380 onQueryTooltipListeners ~= dlg; 381 } 382 extern(C) static gboolean callBackQueryTooltip(GtkStatusIcon* statusIconStruct, gint x, gint y, gboolean keyboardMode, GtkTooltip* tooltip, StatusIcon _statusIcon) 383 { 384 foreach ( bool delegate(gint, gint, gboolean, Tooltip, StatusIcon) dlg ; _statusIcon.onQueryTooltipListeners ) 385 { 386 if ( dlg(x, y, keyboardMode, ObjectG.getDObject!(Tooltip)(tooltip), _statusIcon) ) 387 { 388 return 1; 389 } 390 } 391 392 return 0; 393 } 394 395 bool delegate(GdkEvent*, StatusIcon)[] onScrollListeners; 396 /** 397 * The ::scroll-event signal is emitted when a button in the 4 to 7 398 * range is pressed. Wheel mice are usually configured to generate 399 * button press events for buttons 4 and 5 when the wheel is turned. 400 * Whether this event is emitted is platform-dependent. 401 * TRUE to stop other handlers from being invoked for the event. 402 * FALSE to propagate the event further. 403 * Since 2.16 404 */ 405 void addOnScroll(bool delegate(GdkEvent*, StatusIcon) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 406 { 407 if ( !("scroll-event" in connectedSignals) ) 408 { 409 Signals.connectData( 410 getStruct(), 411 "scroll-event", 412 cast(GCallback)&callBackScroll, 413 cast(void*)this, 414 null, 415 connectFlags); 416 connectedSignals["scroll-event"] = 1; 417 } 418 onScrollListeners ~= dlg; 419 } 420 extern(C) static gboolean callBackScroll(GtkStatusIcon* statusIconStruct, GdkEvent* event, StatusIcon _statusIcon) 421 { 422 foreach ( bool delegate(GdkEvent*, StatusIcon) dlg ; _statusIcon.onScrollListeners ) 423 { 424 if ( dlg(event, _statusIcon) ) 425 { 426 return 1; 427 } 428 } 429 430 return 0; 431 } 432 433 bool delegate(gint, StatusIcon)[] onSizeChangedListeners; 434 /** 435 * Gets emitted when the size available for the image 436 * changes, e.g. because the notification area got resized. 437 * TRUE if the icon was updated for the new 438 * size. Otherwise, GTK+ will scale the icon as necessary. 439 * Since 2.10 440 */ 441 void addOnSizeChanged(bool delegate(gint, StatusIcon) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 442 { 443 if ( !("size-changed" in connectedSignals) ) 444 { 445 Signals.connectData( 446 getStruct(), 447 "size-changed", 448 cast(GCallback)&callBackSizeChanged, 449 cast(void*)this, 450 null, 451 connectFlags); 452 connectedSignals["size-changed"] = 1; 453 } 454 onSizeChangedListeners ~= dlg; 455 } 456 extern(C) static gboolean callBackSizeChanged(GtkStatusIcon* statusIconStruct, gint size, StatusIcon _statusIcon) 457 { 458 foreach ( bool delegate(gint, StatusIcon) dlg ; _statusIcon.onSizeChangedListeners ) 459 { 460 if ( dlg(size, _statusIcon) ) 461 { 462 return 1; 463 } 464 } 465 466 return 0; 467 } 468 469 470 /** 471 * Creates an empty status icon object. 472 * Since 2.10 473 * Throws: ConstructionException GTK+ fails to create the object. 474 */ 475 public this () 476 { 477 // GtkStatusIcon * gtk_status_icon_new (void); 478 auto p = gtk_status_icon_new(); 479 if(p is null) 480 { 481 throw new ConstructionException("null returned by gtk_status_icon_new()"); 482 } 483 this(cast(GtkStatusIcon*) p); 484 } 485 486 /** 487 * Creates a status icon displaying pixbuf. 488 * The image will be scaled down to fit in the available 489 * space in the notification area, if necessary. 490 * Since 2.10 491 * Params: 492 * pixbuf = a GdkPixbuf 493 * Throws: ConstructionException GTK+ fails to create the object. 494 */ 495 public this (Pixbuf pixbuf) 496 { 497 // GtkStatusIcon * gtk_status_icon_new_from_pixbuf (GdkPixbuf *pixbuf); 498 auto p = gtk_status_icon_new_from_pixbuf((pixbuf is null) ? null : pixbuf.getPixbufStruct()); 499 if(p is null) 500 { 501 throw new ConstructionException("null returned by gtk_status_icon_new_from_pixbuf((pixbuf is null) ? null : pixbuf.getPixbufStruct())"); 502 } 503 this(cast(GtkStatusIcon*) p); 504 } 505 506 /** 507 * Creates a status icon displaying a GIcon. If the icon is a 508 * themed icon, it will be updated when the theme changes. 509 * Since 2.14 510 * Params: 511 * icon = a GIcon 512 * Throws: ConstructionException GTK+ fails to create the object. 513 */ 514 public this (IconIF icon) 515 { 516 // GtkStatusIcon * gtk_status_icon_new_from_gicon (GIcon *icon); 517 auto p = gtk_status_icon_new_from_gicon((icon is null) ? null : icon.getIconTStruct()); 518 if(p is null) 519 { 520 throw new ConstructionException("null returned by gtk_status_icon_new_from_gicon((icon is null) ? null : icon.getIconTStruct())"); 521 } 522 this(cast(GtkStatusIcon*) p); 523 } 524 525 /** 526 * Makes status_icon display pixbuf. 527 * See gtk_status_icon_new_from_pixbuf() for details. 528 * Since 2.10 529 * Params: 530 * pixbuf = a GdkPixbuf or NULL. [allow-none] 531 */ 532 public void setFromPixbuf(Pixbuf pixbuf) 533 { 534 // void gtk_status_icon_set_from_pixbuf (GtkStatusIcon *status_icon, GdkPixbuf *pixbuf); 535 gtk_status_icon_set_from_pixbuf(gtkStatusIcon, (pixbuf is null) ? null : pixbuf.getPixbufStruct()); 536 } 537 538 /** 539 * Makes status_icon display the file filename. 540 * See gtk_status_icon_new_from_file() for details. 541 * Since 2.10 542 * Params: 543 * filename = a filename. [type filename] 544 */ 545 public void setFromFile(string filename) 546 { 547 // void gtk_status_icon_set_from_file (GtkStatusIcon *status_icon, const gchar *filename); 548 gtk_status_icon_set_from_file(gtkStatusIcon, Str.toStringz(filename)); 549 } 550 551 /** 552 * Warning 553 * gtk_status_icon_set_from_stock has been deprecated since version 3.10 and should not be used in newly-written code. Use gtk_status_icon_set_from_icon_name() instead. 554 * Makes status_icon display the stock icon with the id stock_id. 555 * See gtk_status_icon_new_from_stock() for details. 556 * Since 2.10 557 * Params: 558 * stockId = a stock icon id 559 */ 560 public void setFromStock(string stockId) 561 { 562 // void gtk_status_icon_set_from_stock (GtkStatusIcon *status_icon, const gchar *stock_id); 563 gtk_status_icon_set_from_stock(gtkStatusIcon, Str.toStringz(stockId)); 564 } 565 566 /** 567 * Makes status_icon display the icon named icon_name from the 568 * current icon theme. 569 * See gtk_status_icon_new_from_icon_name() for details. 570 * Since 2.10 571 * Params: 572 * iconName = an icon name 573 */ 574 public void setFromIconName(string iconName) 575 { 576 // void gtk_status_icon_set_from_icon_name (GtkStatusIcon *status_icon, const gchar *icon_name); 577 gtk_status_icon_set_from_icon_name(gtkStatusIcon, Str.toStringz(iconName)); 578 } 579 580 /** 581 * Makes status_icon display the GIcon. 582 * See gtk_status_icon_new_from_gicon() for details. 583 * Since 2.14 584 * Params: 585 * icon = a GIcon 586 */ 587 public void setFromGicon(IconIF icon) 588 { 589 // void gtk_status_icon_set_from_gicon (GtkStatusIcon *status_icon, GIcon *icon); 590 gtk_status_icon_set_from_gicon(gtkStatusIcon, (icon is null) ? null : icon.getIconTStruct()); 591 } 592 593 /** 594 * Gets the type of representation being used by the GtkStatusIcon 595 * to store image data. If the GtkStatusIcon has no image data, 596 * the return value will be GTK_IMAGE_EMPTY. 597 * Since 2.10 598 * Returns: the image representation being used 599 */ 600 public GtkImageType getStorageType() 601 { 602 // GtkImageType gtk_status_icon_get_storage_type (GtkStatusIcon *status_icon); 603 return gtk_status_icon_get_storage_type(gtkStatusIcon); 604 } 605 606 /** 607 * Gets the GdkPixbuf being displayed by the GtkStatusIcon. 608 * The storage type of the status icon must be GTK_IMAGE_EMPTY or 609 * GTK_IMAGE_PIXBUF (see gtk_status_icon_get_storage_type()). 610 * The caller of this function does not own a reference to the 611 * returned pixbuf. 612 * Since 2.10 613 * Returns: the displayed pixbuf, or NULL if the image is empty. [transfer none] 614 */ 615 public Pixbuf getPixbuf() 616 { 617 // GdkPixbuf * gtk_status_icon_get_pixbuf (GtkStatusIcon *status_icon); 618 auto p = gtk_status_icon_get_pixbuf(gtkStatusIcon); 619 620 if(p is null) 621 { 622 return null; 623 } 624 625 return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p); 626 } 627 628 /** 629 * Warning 630 * gtk_status_icon_get_stock has been deprecated since version 3.10 and should not be used in newly-written code. Use gtk_status_icon_get_icon_name() instead. 631 * Gets the id of the stock icon being displayed by the GtkStatusIcon. 632 * The storage type of the status icon must be GTK_IMAGE_EMPTY or 633 * GTK_IMAGE_STOCK (see gtk_status_icon_get_storage_type()). 634 * The returned string is owned by the GtkStatusIcon and should not 635 * be freed or modified. 636 * Since 2.10 637 * Returns: stock id of the displayed stock icon, or NULL if the image is empty. 638 */ 639 public string getStock() 640 { 641 // const gchar * gtk_status_icon_get_stock (GtkStatusIcon *status_icon); 642 return Str.toString(gtk_status_icon_get_stock(gtkStatusIcon)); 643 } 644 645 /** 646 * Gets the name of the icon being displayed by the GtkStatusIcon. 647 * The storage type of the status icon must be GTK_IMAGE_EMPTY or 648 * GTK_IMAGE_ICON_NAME (see gtk_status_icon_get_storage_type()). 649 * The returned string is owned by the GtkStatusIcon and should not 650 * be freed or modified. 651 * Since 2.10 652 * Returns: name of the displayed icon, or NULL if the image is empty. 653 */ 654 public string getIconName() 655 { 656 // const gchar * gtk_status_icon_get_icon_name (GtkStatusIcon *status_icon); 657 return Str.toString(gtk_status_icon_get_icon_name(gtkStatusIcon)); 658 } 659 660 /** 661 * Retrieves the GIcon being displayed by the GtkStatusIcon. 662 * The storage type of the status icon must be GTK_IMAGE_EMPTY or 663 * GTK_IMAGE_GICON (see gtk_status_icon_get_storage_type()). 664 * The caller of this function does not own a reference to the 665 * returned GIcon. 666 * If this function fails, icon is left unchanged; 667 * Since 2.14 668 * Returns: the displayed icon, or NULL if the image is empty. [transfer none] 669 */ 670 public IconIF getGicon() 671 { 672 // GIcon * gtk_status_icon_get_gicon (GtkStatusIcon *status_icon); 673 auto p = gtk_status_icon_get_gicon(gtkStatusIcon); 674 675 if(p is null) 676 { 677 return null; 678 } 679 680 return ObjectG.getDObject!(Icon, IconIF)(cast(GIcon*) p); 681 } 682 683 /** 684 * Gets the size in pixels that is available for the image. 685 * Stock icons and named icons adapt their size automatically 686 * if the size of the notification area changes. For other 687 * storage types, the size-changed signal can be used to 688 * react to size changes. 689 * Note that the returned size is only meaningful while the 690 * status icon is embedded (see gtk_status_icon_is_embedded()). 691 * Since 2.10 692 * Returns: the size that is available for the image 693 */ 694 public int getSize() 695 { 696 // gint gtk_status_icon_get_size (GtkStatusIcon *status_icon); 697 return gtk_status_icon_get_size(gtkStatusIcon); 698 } 699 700 /** 701 * Sets the GdkScreen where status_icon is displayed; if 702 * the icon is already mapped, it will be unmapped, and 703 * then remapped on the new screen. 704 * Since 2.12 705 * Params: 706 * screen = a GdkScreen 707 */ 708 public void setScreen(Screen screen) 709 { 710 // void gtk_status_icon_set_screen (GtkStatusIcon *status_icon, GdkScreen *screen); 711 gtk_status_icon_set_screen(gtkStatusIcon, (screen is null) ? null : screen.getScreenStruct()); 712 } 713 714 /** 715 * Returns the GdkScreen associated with status_icon. 716 * Since 2.12 717 * Returns: a GdkScreen. [transfer none] 718 */ 719 public Screen getScreen() 720 { 721 // GdkScreen * gtk_status_icon_get_screen (GtkStatusIcon *status_icon); 722 auto p = gtk_status_icon_get_screen(gtkStatusIcon); 723 724 if(p is null) 725 { 726 return null; 727 } 728 729 return ObjectG.getDObject!(Screen)(cast(GdkScreen*) p); 730 } 731 732 /** 733 * Sets text as the contents of the tooltip. 734 * This function will take care of setting "has-tooltip" to 735 * TRUE and of the default handler for the "query-tooltip" 736 * signal. 737 * See also the "tooltip-text" property and 738 * gtk_tooltip_set_text(). 739 * Since 2.16 740 * Params: 741 * text = the contents of the tooltip for status_icon 742 */ 743 public void setTooltipText(string text) 744 { 745 // void gtk_status_icon_set_tooltip_text (GtkStatusIcon *status_icon, const gchar *text); 746 gtk_status_icon_set_tooltip_text(gtkStatusIcon, Str.toStringz(text)); 747 } 748 749 /** 750 * Gets the contents of the tooltip for status_icon. 751 * Since 2.16 752 * Returns: the tooltip text, or NULL. You should free the returned string with g_free() when done. 753 */ 754 public string getTooltipText() 755 { 756 // gchar * gtk_status_icon_get_tooltip_text (GtkStatusIcon *status_icon); 757 return Str.toString(gtk_status_icon_get_tooltip_text(gtkStatusIcon)); 758 } 759 760 /** 761 * Sets markup as the contents of the tooltip, which is marked up with 762 * the Pango text markup language. 763 * This function will take care of setting "has-tooltip" to TRUE 764 * and of the default handler for the "query-tooltip" signal. 765 * See also the "tooltip-markup" property and 766 * gtk_tooltip_set_markup(). 767 * Since 2.16 768 * Params: 769 * markup = the contents of the tooltip for status_icon, or NULL. [allow-none] 770 */ 771 public void setTooltipMarkup(string markup) 772 { 773 // void gtk_status_icon_set_tooltip_markup (GtkStatusIcon *status_icon, const gchar *markup); 774 gtk_status_icon_set_tooltip_markup(gtkStatusIcon, Str.toStringz(markup)); 775 } 776 777 /** 778 * Gets the contents of the tooltip for status_icon. 779 * Since 2.16 780 * Returns: the tooltip text, or NULL. You should free the returned string with g_free() when done. 781 */ 782 public string getTooltipMarkup() 783 { 784 // gchar * gtk_status_icon_get_tooltip_markup (GtkStatusIcon *status_icon); 785 return Str.toString(gtk_status_icon_get_tooltip_markup(gtkStatusIcon)); 786 } 787 788 /** 789 * Sets the has-tooltip property on status_icon to has_tooltip. 790 * See "has-tooltip" for more information. 791 * Since 2.16 792 * Params: 793 * hasTooltip = whether or not status_icon has a tooltip 794 */ 795 public void setHasTooltip(int hasTooltip) 796 { 797 // void gtk_status_icon_set_has_tooltip (GtkStatusIcon *status_icon, gboolean has_tooltip); 798 gtk_status_icon_set_has_tooltip(gtkStatusIcon, hasTooltip); 799 } 800 801 /** 802 * Returns the current value of the has-tooltip property. 803 * See "has-tooltip" for more information. 804 * Since 2.16 805 * Returns: current value of has-tooltip on status_icon. 806 */ 807 public int getHasTooltip() 808 { 809 // gboolean gtk_status_icon_get_has_tooltip (GtkStatusIcon *status_icon); 810 return gtk_status_icon_get_has_tooltip(gtkStatusIcon); 811 } 812 813 /** 814 * Sets the title of this tray icon. 815 * This should be a short, human-readable, localized string 816 * describing the tray icon. It may be used by tools like screen 817 * readers to render the tray icon. 818 * Since 2.18 819 * Params: 820 * title = the title 821 */ 822 public void setTitle(string title) 823 { 824 // void gtk_status_icon_set_title (GtkStatusIcon *status_icon, const gchar *title); 825 gtk_status_icon_set_title(gtkStatusIcon, Str.toStringz(title)); 826 } 827 828 /** 829 * Gets the title of this tray icon. See gtk_status_icon_set_title(). 830 * Since 2.18 831 * Returns: the title of the status icon 832 */ 833 public string getTitle() 834 { 835 // const gchar * gtk_status_icon_get_title (GtkStatusIcon *status_icon); 836 return Str.toString(gtk_status_icon_get_title(gtkStatusIcon)); 837 } 838 839 /** 840 * Sets the name of this tray icon. 841 * This should be a string identifying this icon. It is may be 842 * used for sorting the icons in the tray and will not be shown to 843 * the user. 844 * Since 2.20 845 * Params: 846 * name = the name 847 */ 848 public void setName(string name) 849 { 850 // void gtk_status_icon_set_name (GtkStatusIcon *status_icon, const gchar *name); 851 gtk_status_icon_set_name(gtkStatusIcon, Str.toStringz(name)); 852 } 853 854 /** 855 * Shows or hides a status icon. 856 * Since 2.10 857 * Params: 858 * visible = TRUE to show the status icon, FALSE to hide it 859 */ 860 public void setVisible(int visible) 861 { 862 // void gtk_status_icon_set_visible (GtkStatusIcon *status_icon, gboolean visible); 863 gtk_status_icon_set_visible(gtkStatusIcon, visible); 864 } 865 866 /** 867 * Returns whether the status icon is visible or not. 868 * Note that being visible does not guarantee that 869 * the user can actually see the icon, see also 870 * gtk_status_icon_is_embedded(). 871 * Since 2.10 872 * Returns: TRUE if the status icon is visible 873 */ 874 public int getVisible() 875 { 876 // gboolean gtk_status_icon_get_visible (GtkStatusIcon *status_icon); 877 return gtk_status_icon_get_visible(gtkStatusIcon); 878 } 879 880 /** 881 * Returns whether the status icon is embedded in a notification 882 * area. 883 * Since 2.10 884 * Returns: TRUE if the status icon is embedded in a notification area. 885 */ 886 public int isEmbedded() 887 { 888 // gboolean gtk_status_icon_is_embedded (GtkStatusIcon *status_icon); 889 return gtk_status_icon_is_embedded(gtkStatusIcon); 890 } 891 892 /** 893 * Menu positioning function to use with gtk_menu_popup() 894 * to position menu aligned to the status icon user_data. 895 * Since 2.10 896 * Params: 897 * menu = the GtkMenu 898 * x = return location for the x position. [out] 899 * y = return location for the y position. [out] 900 * pushIn = whether the first menu item should be offset 901 * (pushed in) to be aligned with the menu popup position 902 * (only useful for GtkOptionMenu). [out] 903 * userData = the status icon to position the menu on. [type GtkStatusIcon] 904 */ 905 public static void positionMenu(Menu menu, out int x, out int y, out int pushIn, void* userData) 906 { 907 // void gtk_status_icon_position_menu (GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer user_data); 908 gtk_status_icon_position_menu((menu is null) ? null : menu.getMenuStruct(), &x, &y, &pushIn, userData); 909 } 910 911 /** 912 * Obtains information about the location of the status icon 913 * on screen. This information can be used to e.g. position 914 * popups like notification bubbles. 915 * See gtk_status_icon_position_menu() for a more convenient 916 * alternative for positioning menus. 917 * Note that some platforms do not allow GTK+ to provide 918 * this information, and even on platforms that do allow it, 919 * the information is not reliable unless the status icon 920 * is embedded in a notification area, see 921 * gtk_status_icon_is_embedded(). 922 * Since 2.10 923 * Params: 924 * screen = return location for 925 * the screen, or NULL if the information is not needed. [out][transfer none][allow-none] 926 * area = return location for the area occupied by 927 * the status icon, or NULL. [out][allow-none] 928 * orientation = return location for the 929 * orientation of the panel in which the status icon is embedded, 930 * or NULL. A panel at the top or bottom of the screen is 931 * horizontal, a panel at the left or right is vertical. [out][allow-none] 932 * Returns: TRUE if the location information has been filled in 933 */ 934 public int getGeometry(out Screen screen, out Rectangle area, out GtkOrientation orientation) 935 { 936 // gboolean gtk_status_icon_get_geometry (GtkStatusIcon *status_icon, GdkScreen **screen, GdkRectangle *area, GtkOrientation *orientation); 937 GdkScreen* outscreen = null; 938 939 auto p = gtk_status_icon_get_geometry(gtkStatusIcon, &outscreen, &area, &orientation); 940 941 screen = ObjectG.getDObject!(Screen)(outscreen); 942 return p; 943 } 944 945 /** 946 * This function is only useful on the X11/freedesktop.org platform. 947 * It returns a window ID for the widget in the underlying 948 * status icon implementation. This is useful for the Galago 949 * notification service, which can send a window ID in the protocol 950 * in order for the server to position notification windows 951 * pointing to a status icon reliably. 952 * This function is not intended for other use cases which are 953 * more likely to be met by one of the non-X11 specific methods, such 954 * as gtk_status_icon_position_menu(). 955 * Since 2.14 956 * Returns: An 32 bit unsigned integer identifier for the underlying X11 Window 957 */ 958 public uint getX11_WindowId() 959 { 960 // guint32 gtk_status_icon_get_x11_window_id (GtkStatusIcon *status_icon); 961 return gtk_status_icon_get_x11_window_id(gtkStatusIcon); 962 } 963 }