本文整理汇总了C++中CLVColumn::Flags方法的典型用法代码示例。如果您正苦于以下问题:C++ CLVColumn::Flags方法的具体用法?C++ CLVColumn::Flags怎么用?C++ CLVColumn::Flags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CLVColumn
的用法示例。
在下文中一共展示了CLVColumn::Flags方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetSortMode
void ColumnListView::SetSortMode(int32 ColumnIndex,CLVSortMode Mode)
{
CLVColumn* Column;
if(ColumnIndex >= 0)
{
Column = (CLVColumn*)fColumnList.ItemAt(ColumnIndex);
if(!(Column->Flags()&CLV_SORT_KEYABLE))
return;
}
else
return;
if(Column->fSortMode != Mode)
{
BWindow* ParentWindow = Window();
if(ParentWindow)
ParentWindow->Lock();
BRect LabelBounds = fColumnLabelView->Bounds();
Column->fSortMode = Mode;
if(Mode == NoSort && fSortKeyList.HasItem(Column))
fSortKeyList.RemoveItem(Column);
SortItems();
//Need to draw or erase underline
fColumnLabelView->Invalidate(BRect(Column->fColumnBegin,LabelBounds.top,Column->fColumnEnd,
LabelBounds.bottom));
if(ParentWindow)
ParentWindow->Unlock();
}
}
示例2: AddSortKey
void ColumnListView::AddSortKey(int32 ColumnIndex)
{
CLVColumn* Column;
if(ColumnIndex >= 0)
{
Column = (CLVColumn*)fColumnList.ItemAt(ColumnIndex);
if(!(Column->Flags()&CLV_SORT_KEYABLE))
return;
}
else
Column = NULL;
if(Column && !fSortKeyList.HasItem(Column))
{
BWindow* ParentWindow = Window();
if(ParentWindow)
ParentWindow->Lock();
BRect LabelBounds = fColumnLabelView->Bounds();
fSortKeyList.AddItem(Column);
if(Column->fSortMode == NoSort)
SetSortMode(ColumnIndex,Ascending);
SortItems();
//Need to draw new underline
fColumnLabelView->Invalidate(BRect(Column->fColumnBegin,LabelBounds.top,Column->fColumnEnd,
LabelBounds.bottom));
if(ParentWindow)
ParentWindow->Unlock();
}
}
示例3: ReverseSortMode
void ColumnListView::ReverseSortMode(int32 ColumnIndex)
{
CLVColumn* Column;
if(ColumnIndex >= 0)
{
Column = (CLVColumn*)fColumnList.ItemAt(ColumnIndex);
if(!(Column->Flags()&CLV_SORT_KEYABLE))
return;
}
else
return;
if(Column->fSortMode == Ascending)
SetSortMode(ColumnIndex,Descending);
else if(Column->fSortMode == Descending)
SetSortMode(ColumnIndex,NoSort);
else if(Column->fSortMode == NoSort)
SetSortMode(ColumnIndex,Ascending);
}
示例4: SetSortKey
void ColumnListView::SetSortKey(int32 ColumnIndex)
{
CLVColumn* Column;
if(ColumnIndex >= 0)
{
Column = (CLVColumn*)fColumnList.ItemAt(ColumnIndex);
if(!(Column->Flags()&CLV_SORT_KEYABLE))
return;
}
else
Column = NULL;
if(fSortKeyList.ItemAt(0) != Column || Column == NULL)
{
BWindow* ParentWindow = Window();
if(ParentWindow)
ParentWindow->Lock();
BRect LabelBounds = fColumnLabelView->Bounds();
//Need to remove old sort keys and erase all the old underlines
int32 SortKeyCount = fSortKeyList.CountItems();
for(int32 Counter = 0; Counter < SortKeyCount; Counter++)
{
CLVColumn* UnderlineColumn = (CLVColumn*)fSortKeyList.ItemAt(Counter);
if(UnderlineColumn->fSortMode != NoSort)
fColumnLabelView->Invalidate(BRect(UnderlineColumn->fColumnBegin,LabelBounds.top,
UnderlineColumn->fColumnEnd,LabelBounds.bottom));
}
fSortKeyList.MakeEmpty();
if(Column)
{
fSortKeyList.AddItem(Column);
if(Column->fSortMode == NoSort)
SetSortMode(ColumnIndex,Ascending);
SortItems();
//Need to draw new underline
fColumnLabelView->Invalidate(BRect(Column->fColumnBegin,LabelBounds.top,Column->fColumnEnd,
LabelBounds.bottom));
}
if(ParentWindow)
ParentWindow->Unlock();
}
}
示例5: AddColumnList
bool ColumnListView::AddColumnList(BList* NewColumns)
//Adds a BList of CLVColumn's to the ColumnListView at the position specified, or at the end of the list
//if AtIndex == -1. Returns true if successful.
{
int32 NumberOfColumns = int32(fColumnList.CountItems());
int32 NumberOfColumnsToAdd = int32(NewColumns->CountItems());
//Make sure a second CLVExpander is not being added
int32 Counter;
int32 NumberOfExpanders = 0;
for(Counter = 0; Counter < NumberOfColumns; Counter++)
if(((CLVColumn*)fColumnList.ItemAt(Counter))->fFlags & CLV_EXPANDER)
NumberOfExpanders++;
int32 SetfExpanderColumnTo = -1;
for(Counter = 0; Counter < NumberOfColumnsToAdd; Counter++)
{
CLVColumn* ThisColumn = (CLVColumn*)NewColumns->ItemAt(Counter);
if(ThisColumn->fFlags & CLV_EXPANDER)
{
NumberOfExpanders++;
if(ThisColumn->IsShown())
SetfExpanderColumnTo = NumberOfColumns + Counter;
}
}
if(NumberOfExpanders != 0 && !fHierarchical)
return false;
if(NumberOfExpanders > 1)
return false;
if(SetfExpanderColumnTo != -1)
fExpanderColumn = SetfExpanderColumnTo;
//Make sure none of these columns have already been added to a ColumnListView
for(Counter = 0; Counter < NumberOfColumnsToAdd; Counter++)
if(((CLVColumn*)NewColumns->ItemAt(Counter))->fParent != NULL)
return false;
//Make sure none of these columns are being added twice
for(Counter = 0; Counter < NumberOfColumnsToAdd-1; Counter++)
for(int32 Counter2 = Counter+1; Counter2 < NumberOfColumnsToAdd; Counter2++)
if(NewColumns->ItemAt(Counter) == NewColumns->ItemAt(Counter2))
return false;
BWindow* ParentWindow = Window();
if(ParentWindow)
ParentWindow->Lock();
for(Counter = 0; Counter < NumberOfColumnsToAdd; Counter++)
{
CLVColumn* Column = (CLVColumn*)NewColumns->ItemAt(Counter);
//Check if this should be locked at the beginning or end, and adjust its position if necessary
int32 DisplayIndex = NumberOfColumns;
if(!Column->Flags() & CLV_LOCK_AT_END)
{
bool Repeat;
if(Column->Flags() & CLV_LOCK_AT_BEGINNING)
{
//Move it to the beginning, after the last CLV_LOCK_AT_BEGINNING item
DisplayIndex = 0;
Repeat = true;
while(Repeat && DisplayIndex < NumberOfColumns)
{
Repeat = false;
CLVColumn* LastColumn = (CLVColumn*)fColumnDisplayList.ItemAt(DisplayIndex);
if(LastColumn->Flags() & CLV_LOCK_AT_BEGINNING)
{
DisplayIndex++;
Repeat = true;
}
}
}
else
{
//Make sure it isn't after a CLV_LOCK_AT_END item
Repeat = true;
while(Repeat && DisplayIndex > 0)
{
Repeat = false;
CLVColumn* LastColumn = (CLVColumn*)fColumnDisplayList.ItemAt(DisplayIndex-1);
if(LastColumn->Flags() & CLV_LOCK_AT_END)
{
DisplayIndex--;
Repeat = true;
}
}
}
}
//Add the column to the display list in the appropriate position
fColumnDisplayList.AddItem(Column, DisplayIndex);
//Tell the column it belongs to me now
Column->fParent = this;
NumberOfColumns++;
}
//Add the columns to the end of the column list
fColumnList.AddList(NewColumns);
//Set the scroll bars and tell views to update
ColumnsChanged();
if(ParentWindow)
//.........这里部分代码省略.........
示例6: AddColumn
bool ColumnListView::AddColumn(CLVColumn* Column)
//Adds a column to the ColumnListView at the end of the list. Returns true if successful.
{
int32 NumberOfColumns = fColumnList.CountItems();
int32 DisplayIndex = NumberOfColumns;
//Make sure a second Expander is not being added
if(Column->fFlags & CLV_EXPANDER)
{
if(!fHierarchical)
return false;
for(int32 Counter = 0; Counter < NumberOfColumns; Counter++)
if(((CLVColumn*)fColumnList.ItemAt(Counter))->fFlags & CLV_EXPANDER)
return false;
if(Column->IsShown())
fExpanderColumn = NumberOfColumns;
}
//Make sure this column hasn't already been added to another ColumnListView
if(Column->fParent != NULL)
return false;
BWindow* ParentWindow = Window();
if(ParentWindow)
ParentWindow->Lock();
//Check if this should be locked at the beginning or end, and adjust its position if necessary
if(!Column->Flags() & CLV_LOCK_AT_END)
{
bool Repeat;
if(Column->Flags() & CLV_LOCK_AT_BEGINNING)
{
//Move it to the beginning, after the last CLV_LOCK_AT_BEGINNING item
DisplayIndex = 0;
Repeat = true;
while(Repeat && DisplayIndex < NumberOfColumns)
{
Repeat = false;
CLVColumn* LastColumn = (CLVColumn*)fColumnDisplayList.ItemAt(DisplayIndex);
if(LastColumn->Flags() & CLV_LOCK_AT_BEGINNING)
{
DisplayIndex++;
Repeat = true;
}
}
}
else
{
//Make sure it isn't after a CLV_LOCK_AT_END item
Repeat = true;
while(Repeat && DisplayIndex > 0)
{
Repeat = false;
CLVColumn* LastColumn = (CLVColumn*)fColumnDisplayList.ItemAt(DisplayIndex-1);
if(LastColumn->Flags() & CLV_LOCK_AT_END)
{
DisplayIndex--;
Repeat = true;
}
}
}
}
//Add the column to the display list in the appropriate position
fColumnDisplayList.AddItem(Column, DisplayIndex);
//Add the column to the end of the column list
fColumnList.AddItem(Column);
//Tell the column it belongs to me now
Column->fParent = this;
//Set the scroll bars and tell views to update
ColumnsChanged();
if(ParentWindow)
ParentWindow->Unlock();
return true;
}