示例#1
0
文件: tooltips.c 项目: Limsik/e17
/*
 * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
 * Copyright (C) 2004-2011 Kim Woelders
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to
 * deal in the Software without restriction, including without limitation the
 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 * sell copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies of the Software, its documentation and marketing & publicity
 * materials, and acknowledgment shall be given in the documentation, materials
 * and software packages that this Software was used.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
#include "E.h"
#include "aclass.h"
#include "conf.h"
#include "dialog.h"
#include "e16-ecore_list.h"
#include "emodule.h"
#include "eobj.h"
#include "iclass.h"
#include "settings.h"
#include "tclass.h"
#include "timers.h"
#include "tooltips.h"
#include "xwin.h"

static Ecore_List  *tt_list = NULL;
static Timer       *tt_timer = NULL;

static struct {
   char                enable;
   char                showroottooltip;
   int                 delay;	/* milliseconds */
} Conf_tooltips;

static struct {
   int                 inhibit;
   char                root_motion_mask_set;
   CB_GetAclass       *ac_func;
   void               *ac_data;
} Mode_tooltips;

struct _tooltip {
   const char         *name;
   ImageClass         *iclass[5];
   TextClass          *tclass;
   int                 dist;
   Win                 iwin;
   EObj               *win[5];
   ImageClass         *tooltippic;
};

#define TTWIN win[4]
#define TTICL iclass[4]

static void
TooltipRealize(ToolTip * tt)
{
   int                 i, wh;
   EObj               *eo;

   for (i = 0; i < 5; i++)
     {
	if (!tt->iclass[i])
	   continue;

	wh = (i + 1) * 8;
	eo = EobjWindowCreate(EOBJ_TYPE_MISC, -50, -100, wh, wh, 1, tt->name);
	eo->fade = eo->shadow = 1;
	EobjChangeOpacity(eo, OpacityFromPercent(Conf.opacity.tooltips));
	tt->win[i] = eo;
     }
   tt->iwin = ECreateWindow(EobjGetWin(tt->TTWIN), 0, 0, 1, 1, 0);
}

static ToolTip     *
TooltipCreate(const char *name, const char *ic0, const char *ic1,
	      const char *ic2, const char *ic3, const char *ic4,
	      const char *tclass, int dist, const char *tooltippic)
{
   ToolTip            *tt;
   ImageClass         *ic;

   if (!ic0 || !tclass)
      return NULL;

   ic = ImageclassAlloc(ic0, 0);
   if (!ic)
      return NULL;

   tt = ECALLOC(ToolTip, 1);
   if (!tt)
      return NULL;

   tt->name = Estrdup(name);
   tt->iclass[0] = ImageclassAlloc(ic1, 0);
   tt->iclass[1] = ImageclassAlloc(ic2, 0);
   tt->iclass[2] = ImageclassAlloc(ic3, 0);
   tt->iclass[3] = ImageclassAlloc(ic4, 0);
   tt->iclass[4] = ic;
   tt->tclass = TextclassAlloc(tclass, 1);
   tt->tooltippic = ImageclassAlloc(tooltippic, 0);

   tt->dist = dist;

   if (!tt_list)
      tt_list = ecore_list_new();
   ecore_list_prepend(tt_list, tt);

   return tt;
}

#if 0				/* Not used */
static void
TooltipDestroy(ToolTip * tt)
{
   if (!tt)
      return;

   if (tt->ref_count > 0)
     {
	DialogOK("ToolTip Error!", _("%u references remain"), tt->ref_count);
     }
}
示例#2
0
文件: cursors.c 项目: burzumishi/e16
static void
ECursorDestroy(ECursor * ec)
{
   if (!ec)
      return;

   if (ec->ref_count > 0)
     {
	DialogOK("ECursor Error!", _("%u references remain"), ec->ref_count);
	return;
     }

   LIST_REMOVE(ECursor, &cursor_list, ec);

   Efree(ec->name);
   Efree(ec->file);

   Efree(ec);
}
示例#3
0
文件: iclass.c 项目: Limsik/e17
static void
ImageclassDestroy(ImageClass * ic)
{
   if (!ic)
      return;

   if (ic->ref_count > 0)
     {
	DialogOK("ImageClass Error!", _("%u references remain"), ic->ref_count);
	return;
     }

   ecore_list_node_remove(iclass_list, ic);

   Efree(ic->name);

   FreeImageStateArray(&(ic->norm));
   FreeImageStateArray(&(ic->active));
   FreeImageStateArray(&(ic->sticky));
   FreeImageStateArray(&(ic->sticky_active));

   Efree(ic);
}