Hi Damon,

The e-mail you used is not subscribed to the list, I had to authorize your
post. Please subscribe to the list in order to be able to post. If you
don't want to subscribe you can send e-mail directly to iup@tecgraf.-
puc-rio.br

 It is possible that the image file is not being found. I suggest you to
test it using the attached sample code.

Best,
Scuri

Em ter, 6 de ago de 2019 às 06:10, Damon H. (TheDcoder) <
thedco...@disroot.org> escreveu:

> Hello everyone!
>
> I am using IUP for developing a cross-platform GUI application, currently
> I am experimenting with the TRAY features in IUP, unfortunately it looks
> like it does not work well on my KDE desktop... the tray icon is not
> visible at all. I have set both the TRAY and TRAYIMAGE attributes of the
> main dialog like so:
>
> IupSetAttribute(dialog, "TRAY", "YES");
> IupSetAttribute(dialog, "TRAYIMAGE", "icon.png");
>
> I am running Fedora 29 (KDE Spin) with KDE Plasma 5.15.5, I appreciate any
> help in this regard.
>
> Thank you for reading and for the help in advance!
>
> P.S It is awesome to see that IUP has support for the tray functionality,
> I was certainly overjoyed when I learned of this as I was planning to
> manually add support for it myself.
> _______________________________________________
> Iup-users mailing list
> Iup-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/iup-users
>
#include <stdlib.h>
#include <stdio.h>
#include "iup.h"

static unsigned char pixmap [ ] = 
{
  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  0,0,1,2,3,3,3,3,3,3,3,2,1,0,0,0, 
  0,0,2,1,2,3,3,3,3,3,2,1,2,0,0,0, 
  0,0,3,2,1,2,3,3,3,2,1,2,3,0,0,0,
  0,0,3,3,2,1,2,3,2,1,2,3,3,0,0,0, 
  0,0,3,3,3,2,1,2,1,2,3,3,3,0,0,0, 
  0,0,3,3,3,3,2,1,2,3,3,3,3,0,0,0, 
  0,0,3,3,3,2,1,2,1,2,3,3,3,0,0,0, 
  0,0,3,3,2,1,2,3,2,1,2,3,3,0,0,0, 
  0,0,3,2,1,2,3,3,3,2,1,2,3,0,0,0, 
  0,0,2,1,2,3,3,3,3,3,2,1,2,0,0,0, 
  0,0,1,2,3,3,3,3,3,3,3,2,1,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
};

static int close(Ihandle* ih)
{
  IupDestroy((Ihandle*)IupGetAttribute(ih, "_DIALOG"));
  return IUP_IGNORE;
//  return IUP_CLOSE;
}

static int hide(Ihandle* ih)
{
  IupSetAttribute((Ihandle*)IupGetAttribute(ih, "_DIALOG"), "HIDETASKBAR", 
"YES");  
  return IUP_DEFAULT;
}

static int show(Ihandle* ih)
{
  IupSetAttribute((Ihandle*)IupGetAttribute(ih, "_DIALOG"), "HIDETASKBAR", 
"NO");  
  return IUP_DEFAULT;
}

static int showmenu(Ihandle* ih)
{
  Ihandle* menu = IupMenu(IupItem("Show", "show"), IupItem("Hide", "hide"), 
IupItem("Exit", "close"), NULL);
  IupSetAttribute(menu, "_DIALOG", (char*)ih);
  IupSetFunction("show", (Icallback) show);
  IupSetFunction("hide", (Icallback) hide);
  IupSetFunction("close", (Icallback) close);
  IupPopup(menu, IUP_MOUSEPOS, IUP_MOUSEPOS);
  IupDestroy(menu);
  return IUP_DEFAULT;
}

static int k_esc(Ihandle* ih)
{
  IupDestroy(ih);
  return IUP_DEFAULT;
}

static int close_cb(Ihandle* ih)
{
  IupSetAttribute(ih, "HIDETASKBAR", "YES");  
  return IUP_IGNORE;
}

static int trayclick(Ihandle *ih, int button, int pressed, int dclick)
{
printf("trayclick_cb(button=%d, pressed=%d, dclick=%d)\n", button, pressed, 
dclick);
  if (button == 1 && pressed)
    IupSetAttribute(ih, "HIDETASKBAR", "NO");  
  else if (button == 3 && pressed)
    showmenu(ih);
  return IUP_DEFAULT;
}

void TrayTest(void)
{
  Ihandle *dlg, *img;

  img = IupImage(16, 16, pixmap);
  IupSetAttribute(img, "0", "BGCOLOR");
  IupSetAttribute(img, "1", "255 255 0");
  IupSetAttribute(img, "2", "255 0 0"); 
  IupSetAttribute(img, "3", "255 255 0");
  IupSetHandle ("img", img);

  dlg = IupDialog(NULL);

  IupSetAttribute(dlg, "TITLE", "Tray Test");
  IupSetAttribute(dlg, "TRAY", "YES");
//  IupSetAttribute(dlg, "TRAYTIPBALLOON", "Yes");
//  IupSetAttribute(dlg, "TRAYTIPBALLOONTITLE", "Test Title");
//  IupSetAttribute(dlg, "TRAYTIPBALLOONTITLEICON", "1");
  IupSetAttribute(dlg, "TRAYTIP", "Tip at Tray");
  IupSetAttribute(dlg, "TRAYIMAGE", "img");
  IupSetAttribute(dlg, "SIZE", "100x100");
  IupSetCallback(dlg, "TRAYCLICK_CB", (Icallback)trayclick);
  IupSetCallback(dlg, "CLOSE_CB", (Icallback)close_cb);
  IupSetCallback(dlg, "K_ESC", (Icallback)k_esc);

  IupShowXY(dlg, IUP_CENTER, IUP_CENTER);

  /* start only the task bar icon */
  IupSetAttribute(dlg, "HIDETASKBAR", "YES");  
}


#ifndef BIG_TEST
int main(int argc, char* argv[])
{
  IupOpen(&argc, &argv);

  TrayTest();

  IupMainLoop();

  IupClose();

  return EXIT_SUCCESS;
}
#endif
_______________________________________________
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to