Esempio n. 1
0
/* PressElement --
 * 	Presses the specified element.
 */
static void PressElement(ElementStateTracker *es, Ttk_LayoutNode *node)
{
    if (es->pressedElement) {
	ReleaseElement(es);
    }

    if (node) {
	Ttk_ChangeElementState(
	    node, TTK_STATE_PRESSED|TTK_STATE_ACTIVE, 0);
    }

    es->pressedElement = node;
    TtkRedisplayWidget(es->corePtr);
}
	/** Copies or moves a substorage or stream from this storage object to
	another storage object, possibly renaming it in the process if pszNewName
	is not NULL. Returns VTRUE on success, VFALSE on failure. If the element
	pszName is open, it will be closed and removed from the internal elements
	list.*/
	VBOOL				MoveElementTo(	VSTRING_CONST	pszName,
										IStorage*		pDestStorage,
										VSTRING_CONST	pszNewName = NULL,
										VDWORD			nFlags = STGMOVE_MOVE)
	{
		VASSERT(pszName && pDestStorage && GetStorage())

		/* Release the element if needed.*/
		ReleaseElement(pszName, VFALSE);

		return SUCCEEDED(GetStorage()->MoveElementTo(
			VTEXT_ANY(pszName),
			pDestStorage,
			VTEXT_ANY(((pszNewName)
			? pszNewName : pszName)),
			nFlags))
			? VTRUE : VFALSE;
	}
Esempio n. 3
0
static void
ElementStateEventProc(ClientData clientData, XEvent *ev)
{
    ElementStateTracker *es = (ElementStateTracker *)clientData;
    Ttk_LayoutNode *node;

    switch (ev->type)
    {
	case MotionNotify :
	    node = Ttk_LayoutIdentify(
		es->corePtr->layout,ev->xmotion.x,ev->xmotion.y);
	    ActivateElement(es, node);
	    break;
	case LeaveNotify:
	    ActivateElement(es, 0);
	    if (ev->xcrossing.mode == NotifyGrab)
		PressElement(es, 0);
	    break;
	case EnterNotify:
	    node = Ttk_LayoutIdentify(
		es->corePtr->layout,ev->xcrossing.x,ev->xcrossing.y);
	    ActivateElement(es, node);
	    break;
	case ButtonPress:
	    node = Ttk_LayoutIdentify(
		es->corePtr->layout, ev->xbutton.x, ev->xbutton.y);
	    if (node) 
		PressElement(es, node);
	    break;
	case ButtonRelease:
	    ReleaseElement(es);
	    break;
	case DestroyNotify:
	    /* Unregister this event handler and free client data. 
	     */
	    Tk_DeleteEventHandler(es->corePtr->tkwin,
		    ElementStateMask, ElementStateEventProc, es);
	    ckfree(clientData);
	    break;
    }
}
	/** Destroy a named element, a sub-storage or sub-stream. Returns VTRUE on
	success, VFALSE on failure. If the object is owned by this class, it will
	be released and removed from the internal list of elements. If not, the
	named element will simply be destroyed and removed from the storage.
	Returns VTRUE on success, VFALSE on failure.*/
	VBOOL				DestroyElement(VSTRING_CONST pszName)
		{ return ReleaseElement(pszName, VTRUE); }