当前位置: 首页>>代码示例>>C++>>正文


C++ CLVColumn::Width方法代码示例

本文整理汇总了C++中CLVColumn::Width方法的典型用法代码示例。如果您正苦于以下问题:C++ CLVColumn::Width方法的具体用法?C++ CLVColumn::Width怎么用?C++ CLVColumn::Width使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CLVColumn的用法示例。


在下文中一共展示了CLVColumn::Width方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ColumnAt

/***********************************************************
 * Destructor
 ***********************************************************/
HListView::~HListView() {
	HPrefs* prefs = ((HApp*)be_app)->Prefs();
	for (int16 i = 1; i <= 6; i++) {
		CLVColumn* col = ColumnAt(i);

		BString name = "col";
		name << (int32)i;
		int16 width = static_cast<int16>(col->Width());
		prefs->SetData(name.String(), width);
	}
	SetInvocationMessage(NULL);
	SetSelectionMessage(NULL);
}
开发者ID:kallisti5,项目名称:beget,代码行数:16,代码来源:HListView.cpp

示例2: saveTo

// Saves the application settings file to (saveEntry).  Because this is a
// non-essential file, errors are ignored when writing the settings.
void
ShortcutsWindow::_SaveWindowSettings(BEntry& saveEntry)
{
	BFile saveTo(&saveEntry, B_WRITE_ONLY | B_CREATE_FILE | B_ERASE_FILE);
	if (saveTo.InitCheck() != B_OK)
		return;

	BMessage saveMsg;
	saveMsg.AddRect("window frame", Frame());

	for (int i = 0; i < fColumnListView->CountColumns(); i++) {
		CLVColumn* column = fColumnListView->ColumnAt(i);
		saveMsg.AddFloat("column width", column->Width());
	}

	saveMsg.Flatten(&saveTo);
}
开发者ID:Barrett17,项目名称:haiku-contacts-kit-old,代码行数:19,代码来源:ShortcutsWindow.cpp

示例3: UpdateColumnSizesDataRectSizeScrollBars

void ColumnListView::UpdateColumnSizesDataRectSizeScrollBars()
{
	//Figure out the width
	float ColumnBegin;
	float ColumnEnd = -1.0;
	fDataWidth = 0.0;
	bool NextPushedByExpander = false;
	int32 NumberOfColumns = fColumnDisplayList.CountItems();
	for(int32 Counter = 0; Counter < NumberOfColumns; Counter++)
	{
		CLVColumn* Column = (CLVColumn*)fColumnDisplayList.ItemAt(Counter);
		if(NextPushedByExpander)
			Column->fPushedByExpander = true;
		else
			Column->fPushedByExpander = false;
		if(Column->IsShown())
		{
			float ColumnWidth = Column->Width();
			ColumnBegin = ColumnEnd + 1.0;
			ColumnEnd = ColumnBegin + ColumnWidth;
			Column->fColumnBegin = ColumnBegin;
			Column->fColumnEnd = ColumnEnd;
			fDataWidth = Column->fColumnEnd;
			if(NextPushedByExpander)
				if(!(Column->fFlags & CLV_PUSH_PASS))
					NextPushedByExpander = false;
			if(Column->fFlags & CLV_EXPANDER)
				//Set the next column to be pushed
				NextPushedByExpander = true;
		}
	}

	//Figure out the height
	fDataHeight = 0.0;
	int32 NumberOfItems = CountItems();
	for(int32 Counter2 = 0; Counter2 < NumberOfItems; Counter2++)
		fDataHeight += ItemAt(Counter2)->Height()+1.0;
	if(NumberOfItems > 0)
		fDataHeight -= 1.0;

	//Update the scroll bars
	UpdateScrollBars();
}
开发者ID:mariuz,项目名称:haiku,代码行数:43,代码来源:ColumnListView.cpp

示例4: screen

// Loads the application settings file from (loadMsg) and resizes the interface
// to match the previously saved settings.  Because this is a non-essential
// file, errors are ignored when loading the settings.
void
ShortcutsWindow::_LoadWindowSettings(const BMessage& loadMsg)
{
	BRect frame;
	if (loadMsg.FindRect("window frame", &frame) == B_OK) {
		// Ensure the frame does not resize below the computed minimum.
		float width = max_c(Bounds().right, frame.right - frame.left);
		float height = max_c(Bounds().bottom, frame.bottom - frame.top);
		ResizeTo(width, height);

		// Ensure the frame is not placed outside of the screen.
		BScreen screen(this);
		float left = min_c(screen.Frame().right - width, frame.left);
		float top = min_c(screen.Frame().bottom - height, frame.top);
		MoveTo(left, top);
	}

	for (int i = 0; i < fColumnListView->CountColumns(); i++) {
		CLVColumn* column = fColumnListView->ColumnAt(i);
		float columnWidth;
		if (loadMsg.FindFloat("column width", i, &columnWidth) == B_OK)
			column->SetWidth(max_c(column->Width(), columnWidth));
	}
}
开发者ID:Barrett17,项目名称:haiku-contacts-kit-old,代码行数:27,代码来源:ShortcutsWindow.cpp

示例5: MouseDown

void ColumnListView::MouseDown(BPoint point)
{
    int prevColumn = _selectedColumn;
	int32 numberOfColumns = fColumnDisplayList.CountItems();
	float xleft = point.x;
	for(int32 Counter = 0; Counter < numberOfColumns; Counter++)
	{
		CLVColumn* Column = (CLVColumn*)fColumnDisplayList.ItemAt(Counter);
		if(Column->IsShown())
		{
			if (xleft > 0) 
			{
			   xleft -= Column->Width();
			   if (xleft <= 0) 
			   {
			      SetSelectedColumnIndex(GetActualIndexOf(Counter));			          
			      break;
			   }
			}
		}				
	}
	int32 ItemIndex = IndexOf(point);
	if(ItemIndex >= 0)
	{
		CLVListItem* ClickedItem = (CLVListItem*)BListView::ItemAt(ItemIndex);
		if(ClickedItem->fSuperItem)
			if(ClickedItem->fExpanderButtonRect.Contains(point))
			{
				if(ClickedItem->IsExpanded())
					Collapse(ClickedItem);
				else
					Expand(ClickedItem);
				return;
			}
	}


	// If it's a right-click, hoist up the popup-menu
	const char * selectedText = NULL;
	CLVColumn * col = ColumnAt(_selectedColumn);
	if (col)
	{
	   BPopUpMenu * popup = col->GetPopup();
	   if (popup)
	   {
	      BMessage * msg = Window()->CurrentMessage();
	      int32 buttons;
	      if ((msg->FindInt32("buttons", &buttons) == B_NO_ERROR)&&(buttons == B_SECONDARY_MOUSE_BUTTON))
	      {	   
	         BPoint where(point);
	         Select(IndexOf(where));
	         ConvertToScreen(&where);
	         BMenuItem * result = popup->Go(where, false);
	         if (result) selectedText = result->Label();
	      }
	   }
	}
	
	int prevRow = CurrentSelection();
	BListView::MouseDown(point);
	
	int curRow = CurrentSelection();
	if ((_editMessage != NULL)&&((selectedText)||((_selectedColumn == prevColumn)&&(curRow == prevRow))))
	{
	   // Send mouse message...
	   BMessage temp(*_editMessage);
	   temp.AddInt32("column", _selectedColumn);
	   temp.AddInt32("row", CurrentSelection());      
	   if (selectedText) temp.AddString("text", selectedText);
	                else temp.AddInt32("mouseClick", 0);
	   _editTarget.SendMessage(&temp);       
	}
}
开发者ID:mariuz,项目名称:haiku,代码行数:73,代码来源:ColumnListView.cpp


注:本文中的CLVColumn::Width方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。