本文整理汇总了C++中BColumn类的典型用法代码示例。如果您正苦于以下问题:C++ BColumn类的具体用法?C++ BColumn怎么用?C++ BColumn使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BColumn类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ASSERT
void
BPose::DeselectWithoutErasingBackground(BRect, BPoseView* poseView)
{
ASSERT(poseView->ViewMode() != kListMode);
ASSERT(!IsSelected());
BPoint location(Location(poseView));
// draw icon directly
if (fPercent == -1)
DrawIcon(location, poseView, poseView->IconSize(), true);
else
UpdateIcon(location, poseView);
BColumn* column = poseView->FirstColumn();
if (column == NULL)
return;
BTextWidget* widget = WidgetFor(column->AttrHash());
if (widget == NULL || !widget->IsVisible())
return;
// just invalidate the background, don't draw anything
poseView->Invalidate(widget->CalcRect(location, 0, poseView));
}
示例2: ArpASSERT
status_t SeqManageRosterWindow::SetConfiguration(const BMessage* config)
{
ArpASSERT(config);
status_t err = SetDimensions(config, this);
if (err != B_OK) return err;
/* Set the columns
*/
BColumnListView* table = dynamic_cast<BColumnListView*>( FindView(TABLE_STR) );
if (table) {
BMessage colMsg;
for (int32 k = 0; config->FindMessage("column", k, &colMsg) == B_OK; k++) {
const char* colName;
float colW;
bool colVis;
if (colMsg.FindString("name", &colName) == B_OK
&& colMsg.FindFloat("width", &colW) == B_OK
&& colMsg.FindBool("visible", &colVis) == B_OK) {
BColumn* col = col_named(colName, table);
if (col) {
col->SetWidth(colW);
col->SetVisible(colVis);
}
}
}
}
return B_OK;
}
示例3: WidgetFor
bool
BPose::PointInPose(BPoint loc, const BPoseView* poseView, BPoint where,
BTextWidget** hitWidget) const
{
if (hitWidget)
*hitWidget = NULL;
// check intersection with icon
BRect rect;
rect.left = loc.x + kListOffset;
rect.right = rect.left + B_MINI_ICON;
rect.bottom = loc.y + poseView->ListElemHeight();
rect.top = rect.bottom - B_MINI_ICON;
if (rect.Contains(where))
return true;
for (int32 index = 0; ; index++) {
BColumn* column = poseView->ColumnAt(index);
if (column == NULL)
break;
BTextWidget* widget = WidgetFor(column->AttrHash());
if (widget
&& widget->CalcClickRect(loc, column, poseView).Contains(where)) {
if (hitWidget)
*hitWidget = widget;
return true;
}
}
return false;
}
示例4: poseLoc
void
BPose::EditPreviousNextWidgetCommon(BPoseView* poseView, bool next)
{
bool found = false;
int32 delta = next ? 1 : -1;
for (int32 index = next ? 0 : poseView->CountColumns() - 1; ;
index += delta) {
BColumn* column = poseView->ColumnAt(index);
if (column == NULL)
break;
BTextWidget* widget = WidgetFor(column->AttrHash());
if (widget != NULL && widget->IsActive()) {
poseView->CommitActivePose();
found = true;
continue;
}
if (found && column->Editable()) {
BRect bounds;
if (poseView->ViewMode() == kListMode) {
int32 poseIndex = poseView->IndexOfPose(this);
BPoint poseLoc(0, poseIndex* poseView->ListElemHeight());
bounds = widget->CalcRect(poseLoc, column, poseView);
} else
bounds = widget->CalcRect(Location(poseView), 0, poseView);
widget->StartEdit(bounds, poseView, this);
break;
}
}
}
示例5: FindView
void SeqStudioWindow::ToggleColumn(const char* name)
{
BColumnListView* table = dynamic_cast<BColumnListView*>( FindView(ENDPOINT_LIST_STR) );
if (!table) return;
BColumn* col = column_named(name, table);
if (!col) return;
if (col->IsVisible() ) col->SetVisible(false);
else col->SetVisible(true);
}
示例6: col_named
static BColumn* col_named(const char* name, BColumnListView* table)
{
BColumn* col;
for (int32 k = 0; (col = table->ColumnAt(k)); k++) {
BString colName;
col->GetColumnName( &colName );
if (strcmp( name, colName.String() ) == 0) return col;
}
return NULL;
}
示例7: column_named
static BColumn* column_named(const char* name, BColumnListView* fromTable)
{
if (!fromTable) return NULL;
BColumn* col;
for (uint32 k = 0; (col = fromTable->ColumnAt(k)); k++) {
BString n;
col->GetColumnName(&n);
if (strcmp( n.String(), name ) == 0) return col;
}
return NULL;
}
示例8: KeyMenuBar
void SeqManageRosterWindow::MenusBeginning()
{
inherited::MenusBeginning();
BMenuBar* bar = KeyMenuBar();
if (!bar) return;
BColumnListView* table = dynamic_cast<BColumnListView*>( FindView(TABLE_STR) );
if (!table) return;
BMenu* menu;
BMenuItem* item;
// Entry menu
bool canEdit = false, canDuplicate = false;
BString key, filePath;
bool readOnly;
if (GetSelectionInfo(key, filePath, &readOnly) == B_OK) {
canEdit = !readOnly;
canDuplicate = true;
}
if ( (menu = bar->SubmenuAt(ENTRY_MENU_INDEX)) != NULL) {
if ( (item = menu->FindItem(EDIT_ENTRY_MSG)) != NULL) item->SetEnabled(canEdit);
if ( (item = menu->FindItem(DUPLICATE_ENTRY_MSG)) != NULL) item->SetEnabled(canDuplicate);
if ( (item = menu->FindItem(DELETE_ENTRY_MSG)) != NULL) item->SetEnabled(canEdit);
}
// Attributes menu
if ( (menu = bar->SubmenuAt(ATTRIBUTES_MENU_INDEX)) != NULL) {
for (int32 k = 0; (item = menu->ItemAt(k)) != NULL; k++) {
const char* n;
if (item->Message() && item->Message()->FindString(COLUMN_NAME_STR, &n) == B_OK) {
BColumn* col = column_named(n, table);
if (col && col->IsVisible() ) {
if (!item->IsMarked() ) item->SetMarked(true);
} else {
if (item->IsMarked() ) item->SetMarked(false);
}
}
}
}
}
示例9: RowAt
bool
TreeTable::GetToolTipAt(BPoint point, BToolTip** _tip)
{
if (fToolTipProvider == NULL)
return AbstractTable::GetToolTipAt(point, _tip);
// get the table row
BRow* row = RowAt(point);
if (row == NULL)
return AbstractTable::GetToolTipAt(point, _tip);
TreeTableRow* treeRow = dynamic_cast<TreeTableRow*>(row);
// get the table column
BColumn* column = ColumnAt(point);
int32 columnIndex = column != NULL ? column->LogicalFieldNum() : -1;
TreeTablePath path;
_GetPathForNode(treeRow->Node(), path);
return fToolTipProvider->GetToolTipForTablePath(path, columnIndex,
_tip);
}
示例10: KeyMenuBar
void SeqStudioWindow::MenusBeginning()
{
inherited::MenusBeginning();
BMenuBar* bar = KeyMenuBar();
if (!bar) return;
BColumnListView* table = dynamic_cast<BColumnListView*>( FindView(ENDPOINT_LIST_STR) );
if (!table) return;
if (mDeviceCtrl && mDeviceCtrl->Menu() ) add_device_menu_items(mDeviceCtrl->Menu() );
// MIDI Port menu
if (mPortMenu) {
bool deleteEnabled = false;
_EndpointRow* r = dynamic_cast<_EndpointRow*>(table->CurrentSelection() );
if (r && !r->mIsValid && r->mEndpoint.channel < 0) deleteEnabled = true;
BMenuItem* deleteItem = mPortMenu->FindItem(DELETE_STR);
if (deleteItem && deleteItem->IsEnabled() != deleteEnabled) deleteItem->SetEnabled(deleteEnabled);
}
// Attributes menu
BMenu* menu;
BMenuItem* item;
if ( (menu = bar->SubmenuAt(ATTRIBUTES_MENU_INDEX)) != NULL) {
for (int32 k = 0; (item = menu->ItemAt(k)) != NULL; k++) {
const char* n;
if (item->Message() && item->Message()->FindString(COLUMN_NAME_STR, &n) == B_OK) {
BColumn* col = column_named(n, table);
if (col && col->IsVisible() ) {
if (!item->IsMarked() ) item->SetMarked(true);
} else {
if (item->IsMarked() ) item->SetMarked(false);
}
}
}
}
}
示例11: modelOpener
void
BPose::Draw(BRect rect, const BRect& updateRect, BPoseView* poseView,
BView* drawView, bool fullDraw, BPoint offset, bool selected)
{
// If the background wasn't cleared and Draw() is not called after
// having edited a name or similar (with fullDraw)
if (!fBackgroundClean && !fullDraw) {
fBackgroundClean = true;
poseView->Invalidate(rect);
return;
} else
fBackgroundClean = false;
bool directDraw = (drawView == poseView);
bool windowActive = poseView->Window()->IsActive();
bool showSelectionWhenInactive = poseView->fShowSelectionWhenInactive;
bool isDrawingSelectionRect = poseView->fIsDrawingSelectionRect;
ModelNodeLazyOpener modelOpener(fModel);
if (poseView->ViewMode() == kListMode) {
uint32 size = poseView->IconSizeInt();
BRect iconRect(rect);
iconRect.left += kListOffset;
iconRect.right = iconRect.left + size;
iconRect.top = iconRect.bottom - size;
if (updateRect.Intersects(iconRect)) {
iconRect.OffsetBy(offset);
DrawIcon(iconRect.LeftTop(), drawView, poseView->IconSize(),
directDraw, !windowActive && !showSelectionWhenInactive);
}
// draw text
int32 columnsToDraw = 1;
if (fullDraw)
columnsToDraw = poseView->CountColumns();
for (int32 index = 0; index < columnsToDraw; index++) {
BColumn* column = poseView->ColumnAt(index);
if (column == NULL)
break;
// if widget doesn't exist, create it
BTextWidget* widget = WidgetFor(column, poseView, modelOpener);
if (widget && widget->IsVisible()) {
BRect widgetRect(widget->ColumnRect(rect.LeftTop(), column,
poseView));
if (updateRect.Intersects(widgetRect)) {
BRect widgetTextRect(widget->CalcRect(rect.LeftTop(),
column, poseView));
bool selectDuringDraw = directDraw && selected
&& windowActive;
if (index == 0 && selectDuringDraw) {
//draw with dark background to select text
drawView->PushState();
drawView->SetLowColor(0, 0, 0);
}
if (index == 0) {
widget->Draw(widgetRect, widgetTextRect,
column->Width(), poseView, drawView, selected,
fClipboardMode, offset, directDraw);
} else {
widget->Draw(widgetTextRect, widgetTextRect,
column->Width(), poseView, drawView, false,
fClipboardMode, offset, directDraw);
}
if (index == 0 && selectDuringDraw)
drawView->PopState();
else if (index == 0 && selected) {
if (windowActive || isDrawingSelectionRect) {
widgetTextRect.OffsetBy(offset);
drawView->InvertRect(widgetTextRect);
} else if (!windowActive
&& showSelectionWhenInactive) {
widgetTextRect.OffsetBy(offset);
drawView->PushState();
drawView->SetDrawingMode(B_OP_BLEND);
drawView->SetHighColor(128, 128, 128, 255);
drawView->FillRect(widgetTextRect);
drawView->PopState();
}
}
}
}
}
} else {
// draw in icon mode
BPoint location(Location(poseView));
BPoint iconOrigin(location);
iconOrigin += offset;
DrawIcon(iconOrigin, drawView, poseView->IconSize(), directDraw,
!windowActive && !showSelectionWhenInactive);
//.........这里部分代码省略.........
示例12: Location
void
BPose::UpdateWidgetAndModel(Model* resolvedModel, const char* attrName,
uint32 attrType, int32, BPoint poseLoc, BPoseView* poseView, bool visible)
{
if (poseView->ViewMode() != kListMode)
poseLoc = Location(poseView);
ASSERT(resolvedModel == NULL || resolvedModel->IsNodeOpen());
if (attrName != NULL) {
// pick up new attributes and find out if icon needs updating
if (resolvedModel->AttrChanged(attrName) && visible)
UpdateIcon(poseLoc, poseView);
// ToDo: the following code is wrong, because this sort of hashing
// may overlap and we get aliasing
uint32 attrHash = AttrHashString(attrName, attrType);
BTextWidget* widget = WidgetFor(attrHash);
if (widget) {
BColumn* column = poseView->ColumnFor(attrHash);
if (column)
widget->CheckAndUpdate(poseLoc, column, poseView, visible);
} else if (attrType == 0) {
// attribute got likely removed, so let's search the
// column for the matching attribute name
int32 count = fWidgetList.CountItems();
for (int32 i = 0; i < count; i++) {
BTextWidget* widget = fWidgetList.ItemAt(i);
BColumn* column = poseView->ColumnFor(widget->AttrHash());
if (column != NULL && !strcmp(column->AttrName(), attrName)) {
widget->CheckAndUpdate(poseLoc, column, poseView,
visible);
break;
}
}
}
} else {
// no attr name means check all widgets for stat info changes
// pick up stat changes
if (resolvedModel && resolvedModel->StatChanged()) {
if (resolvedModel->InitCheck() != B_OK)
return;
if (visible)
UpdateIcon(poseLoc, poseView);
}
// distribute stat changes
for (int32 index = 0; ; index++) {
BColumn* column = poseView->ColumnAt(index);
if (column == NULL)
break;
if (column->StatField()) {
BTextWidget* widget = WidgetFor(column->AttrHash());
if (widget) {
widget->CheckAndUpdate(poseLoc, column, poseView,
visible);
}
}
}
}
}