Exemplo n.º 1
0
static void
storeData(_Panel *panel)
{
    WMPropList *list;
    WMPropList *tmp;
    int i;
    char *p;

    list = WMCreatePLArray(NULL, NULL);
    for (i=0; i<WMGetListNumberOfRows(panel->icoL); i++) {
        p = WMGetListItem(panel->icoL, i)->text;
        tmp = WMCreatePLString(p);
        WMAddToPLArray(list, tmp);
    }
    SetObjectForKey(list, "IconPath");

    list = WMCreatePLArray(NULL, NULL);
    for (i=0; i<WMGetListNumberOfRows(panel->pixL); i++) {
        p = WMGetListItem(panel->pixL, i)->text;
        tmp = WMCreatePLString(p);
        WMAddToPLArray(list, tmp);
    }
    SetObjectForKey(list, "PixmapPath");
}
Exemplo n.º 2
0
char *WMSetBrowserPath(WMBrowser * bPtr, char *path)
{
	int i;
	char *str;
	char *tmp, *retPtr = NULL;
	int item;
	WMListItem *listItem;

	/* WMLoadBrowserColumnZero must be call first */
	if (!bPtr->flags.loaded) {
		return False;
	}

	removeColumn(bPtr, 1);

	WMSelectListItem(bPtr->columns[0], -1);
	WMSetListPosition(bPtr->columns[0], 0);

	i = 0;
	str = wstrdup(path);
	tmp = strtok(str, bPtr->pathSeparator);
	while (tmp) {
		/* select it in the column */
		item = WMFindRowOfListItemWithTitle(bPtr->columns[i], tmp);
		if (item < 0) {
			retPtr = &path[(int)(tmp - str)];
			break;
		}
		WMSelectListItem(bPtr->columns[i], item);
		WMSetListPosition(bPtr->columns[i], item);

		listItem = WMGetListItem(bPtr->columns[i], item);
		if (!listItem || !listItem->isBranch) {
			break;
		}

		/* load next column */
		WMAddBrowserColumn(bPtr);

		loadColumn(bPtr, i + 1);

		tmp = strtok(NULL, bPtr->pathSeparator);

		i++;
	}

	wfree(str);

	for (i = bPtr->usedColumnCount - 1; (i > -1) && !WMGetListSelectedItem(bPtr->columns[i]); i--) ;

	bPtr->selectedColumn = i;

	if (bPtr->columnCount < bPtr->maxVisibleColumns) {
		int i = bPtr->maxVisibleColumns - bPtr->columnCount;
		int curUsedColumnCount = bPtr->usedColumnCount;
		bPtr->usedColumnCount = bPtr->columnCount;
		while (i--) {
			WMAddBrowserColumn(bPtr);
		}
		bPtr->usedColumnCount = curUsedColumnCount;
	}

	scrollToColumn(bPtr, bPtr->columnCount - bPtr->maxVisibleColumns, True);

	return retPtr;
}