1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-02-21 01:05:45 +01:00

- Fixed some issues with WMBrowser and the file panel that were

introduced by the latest changes in the WMList code (multiple and empty
  selection).
- added WMSetBrowserAllowMultipleSelection(), WMSetBrowserAllowEmptySelection()
  WMBrowserAllowsMultipleSelection() and WMBrowserAllowsEmptySelection().
This commit is contained in:
dan
2000-10-02 06:59:18 +00:00
parent b2478b634f
commit de99155948
6 changed files with 98 additions and 30 deletions

View File

@@ -41,7 +41,8 @@ typedef struct W_Browser {
struct {
unsigned int isTitled:1;
unsigned int allowMultipleSelection:1;
unsigned int allowMultipleSelection:1;
unsigned int allowEmptySelection:1;
unsigned int hasScroller:1;
/* */
@@ -150,6 +151,30 @@ WMCreateBrowser(WMWidget *parent)
}
void
WMSetBrowserAllowMultipleSelection(WMBrowser *bPtr, Bool flag)
{
int i;
bPtr->flags.allowMultipleSelection = flag ? 1 : 0;
for (i=0; i<bPtr->columnCount; i++) {
WMSetListAllowMultipleSelection(bPtr->columns[i], flag);
}
}
void
WMSetBrowserAllowEmptySelection(WMBrowser *bPtr, Bool flag)
{
int i;
bPtr->flags.allowEmptySelection = flag ? 1 : 0;
for (i=0; i<bPtr->columnCount; i++) {
WMSetListAllowEmptySelection(bPtr->columns[i], flag);
}
}
int
WMGetBrowserMaxVisibleColumns(WMBrowser *bPtr)
{
@@ -794,6 +819,20 @@ WMGetBrowserPathToColumn(WMBrowser *bPtr, int column)
}
Bool
WMBrowserAllowsMultipleSelection(WMBrowser *bPtr)
{
return bPtr->flags.allowMultipleSelection;
}
Bool
WMBrowserAllowsEmptySelection(WMBrowser *bPtr)
{
return bPtr->flags.allowEmptySelection;
}
static void
loadColumn(WMBrowser *bPtr, int column)
{
@@ -931,12 +970,8 @@ listCallback(void *self, void *clientData)
int i;
item = WMGetListSelectedItem(lPtr);
if (!item) {
oldItem = item;
return;
}
if (oldItem != item) {
if (oldItem==NULL || oldItem!=item) {
for (i=0; i<bPtr->columnCount; i++) {
if (lPtr == bPtr->columns[i])
break;
@@ -948,7 +983,7 @@ listCallback(void *self, void *clientData)
/* columns at right must be cleared */
removeColumn(bPtr, i+1);
/* open directory */
if (item->isBranch) {
if (item && item->isBranch) {
WMAddBrowserColumn(bPtr);
}
if (bPtr->usedColumnCount < bPtr->maxVisibleColumns)
@@ -956,7 +991,7 @@ listCallback(void *self, void *clientData)
else
i = bPtr->usedColumnCount-bPtr->maxVisibleColumns;
scrollToColumn(bPtr, i, True);
if (item->isBranch) {
if (item && item->isBranch) {
loadColumn(bPtr, bPtr->usedColumnCount-1);
}
}
@@ -1090,6 +1125,8 @@ WMAddBrowserColumn(WMBrowser *bPtr)
bPtr->titles[index] = NULL;
list = WMCreateList(bPtr);
WMSetListAllowMultipleSelection(list, bPtr->flags.allowMultipleSelection);
WMSetListAllowEmptySelection(list, bPtr->flags.allowEmptySelection);
WMSetListAction(list, listCallback, bPtr);
WMSetListDoubleAction(list, listDoubleCallback, bPtr);
WMSetListUserDrawProc(list, paintItem);