Пример #1
0
void
WMSetScrollViewHasHorizontalScroller(WMScrollView *sPtr, Bool flag)
{
    if (flag) {
        if (sPtr->flags.hasHScroller)
            return;
        sPtr->flags.hasHScroller = 1;

        sPtr->hScroller = WMCreateScroller(sPtr);
        WMSetScrollerAction(sPtr->hScroller, doScrolling, sPtr);
        /* make it a horiz. scroller */
        WMResizeWidget(sPtr->hScroller, 2, 1);

        if (W_VIEW_REALIZED(sPtr->view)) {
            WMRealizeWidget(sPtr->hScroller);
        }

        reorganizeInterior(sPtr);

        WMMapWidget(sPtr->hScroller);
    } else {
        if (!sPtr->flags.hasHScroller)
            return;

        WMUnmapWidget(sPtr->hScroller);
        WMDestroyWidget(sPtr->hScroller);
        sPtr->hScroller = NULL;
        sPtr->flags.hasHScroller = 0;

        reorganizeInterior(sPtr);
    }
}
Пример #2
0
void
WMSetScrollViewHasVerticalScroller(WMScrollView *sPtr, Bool flag)
{
    if (flag) {
        if (sPtr->flags.hasVScroller)
            return;
        sPtr->flags.hasVScroller = 1;

        sPtr->vScroller = WMCreateScroller(sPtr);
        WMSetScrollerAction(sPtr->vScroller, doScrolling, sPtr);
        WMSetScrollerArrowsPosition(sPtr->vScroller, WSAMaxEnd);
        /* make it a vert. scroller */
        WMResizeWidget(sPtr->vScroller, 1, 2);

        if (W_VIEW_REALIZED(sPtr->view)) {
            WMRealizeWidget(sPtr->vScroller);
        }

        reorganizeInterior(sPtr);

        WMMapWidget(sPtr->vScroller);
    } else {
        if (!sPtr->flags.hasVScroller)
            return;
        sPtr->flags.hasVScroller = 0;

        WMUnmapWidget(sPtr->vScroller);
        WMDestroyWidget(sPtr->vScroller);
        sPtr->vScroller = NULL;

        reorganizeInterior(sPtr);
    }
}
Пример #3
0
void
WMSetTabViewItemEnabled(WMTabViewItem *tPtr, Bool flag)
{
    tPtr->flags.enabled = ((flag==0) ? 0 : 1);
    if (tPtr->tabView && W_VIEW_REALIZED(tPtr->tabView->view))
        paintTabView(tPtr->tabView);
}
Пример #4
0
void
WMInsertItemInTabView(WMTabView *tPtr, int index, WMTabViewItem *item)
{
    wassertr(W_TabViewItemView(item) != NULL);

    if (tPtr->maxItems == tPtr->itemCount) {
        WMTabViewItem **items;

        items = wrealloc(tPtr->items,
                         sizeof(WMTabViewItem*) * (tPtr->maxItems + 10));
        memset(&items[tPtr->maxItems], 0, sizeof(WMTabViewItem*) * 10);
        tPtr->items = items;
        tPtr->maxItems += 10;
    }

    if (index > tPtr->itemCount)
        index = tPtr->itemCount;

    if (index == 0 && tPtr->items[0]) {
        W_UnmapTabViewItem(tPtr->items[0]);
    }

    if (index < tPtr->itemCount) {
        memmove(tPtr->items + index + 1, tPtr->items + index,
                (tPtr->itemCount - index) * sizeof(WMTabViewItem*));
    }

    tPtr->items[index] = item;

    tPtr->itemCount++;

    recalcTabWidth(tPtr);

    W_SetTabViewItemParent(item, tPtr);

    W_UnmapTabViewItem(item);

    if (tPtr->flags.bordered) {
        W_ReparentView(W_TabViewItemView(item), tPtr->view, 1,
                       tPtr->tabHeight + 1);

        W_ResizeView(W_TabViewItemView(item), tPtr->view->size.width - 3,
                     tPtr->view->size.height - tPtr->tabHeight - 3);
    } else {
        W_ReparentView(W_TabViewItemView(item), tPtr->view, 0,
                       tPtr->tabHeight);

        W_ResizeView(W_TabViewItemView(item), tPtr->view->size.width,
                     tPtr->view->size.height - tPtr->tabHeight);
    }

    if (index == 0) {
        W_MapTabViewItem(item);
    }
    if (tPtr->delegate && tPtr->delegate->didChangeNumberOfItems)
        (*tPtr->delegate->didChangeNumberOfItems)(tPtr->delegate, tPtr);

    if (W_VIEW_REALIZED(tPtr->view))
        paintTabView(tPtr);
}
Пример #5
0
void
WMSetTabViewEnabled(WMTabView *tPtr, Bool flag)
{
    tPtr->flags.enabled = ((flag==0) ? 0 : 1);
    if (W_VIEW_REALIZED(tPtr->view))
        paintTabView(tPtr);
}
Пример #6
0
void W_SetViewCursor(W_View * view, Cursor cursor)
{
	view->cursor = cursor;
	if (W_VIEW_REALIZED(view)) {
		XDefineCursor(W_VIEW_DISPLAY(view), W_VIEW_DRAWABLE(view), cursor);
	} else {
		view->attribFlags |= CWCursor;
		view->attribs.cursor = cursor;
	}
}
Пример #7
0
static void rearrange(TabView * tPtr)
{
	int i;
	int width, height;
	int bordered = tPtr->flags.bordered;

	recalcTabWidth(tPtr);

	width = tPtr->view->size.width - (bordered ? 3 : 0);
	height = tPtr->view->size.height - tPtr->tabHeight - (bordered ? 3 : 0);

	for (i = 0; i < tPtr->itemCount; i++) {
		W_MoveView(W_TabViewItemView(tPtr->items[i]), 1 * bordered, tPtr->tabHeight + 1 * bordered);
		W_ResizeView(W_TabViewItemView(tPtr->items[i]), width, height);
	}
	if (W_VIEW_MAPPED(tPtr->view) && W_VIEW_REALIZED(tPtr->view))
		paintTabView(tPtr);
}
Пример #8
0
void W_LowerView(W_View * view)
{
	if (W_VIEW_REALIZED(view))
		XLowerWindow(W_VIEW_DISPLAY(view), W_VIEW_DRAWABLE(view));
}
Пример #9
0
void W_RaiseView(W_View * view)
{
	if (W_VIEW_REALIZED(view))
		XRaiseWindow(W_VIEW_DISPLAY(view), W_VIEW_DRAWABLE(view));
}