示例#1
0
/**
 * _ConstructGUI()
 *
 * Creates the GUI for the View. MUST be called AFTER the View is attached to
 *	the Window, or will crash and/or create strange behaviour
 *
 * @param none
 * @return void
 */
void
MarginView::_ConstructGUI()
{
	BString str;
	// Create text fields
	BRect r(Frame().Width() - be_plain_font->StringWidth("Top#") - kWidth,
			kOffsetY, Frame().Width() - kOffsetX, kWidth);

	// top
	str << fMargins.top/fUnitValue;
	fTop = new BTextControl( r, "top", "Top:", str.String(), NULL,
				B_FOLLOW_RIGHT);

	fTop->SetModificationMessage(new BMessage(TOP_MARGIN_CHANGED));
	fTop->SetDivider(be_plain_font->StringWidth("Top#"));
	fTop->SetTarget(this);
	_AllowOnlyNumbers(fTop, kNumCount);
	AddChild(fTop);




	//left
	r.OffsetBy(0, kOffsetY);
	r.left = Frame().Width() - be_plain_font->StringWidth("Left#") - kWidth;
    str = "";
	str << fMargins.left/fUnitValue;
	fLeft = new BTextControl( r, "left", "Left:", str.String(), NULL,
				B_FOLLOW_RIGHT);

	fLeft->SetModificationMessage(new BMessage(LEFT_MARGIN_CHANGED));
	fLeft->SetDivider(be_plain_font->StringWidth("Left#"));
	fLeft->SetTarget(this);
	_AllowOnlyNumbers(fLeft, kNumCount);
	AddChild(fLeft);




	//bottom
	r.OffsetBy(0, kOffsetY);
	r.left = Frame().Width() - be_plain_font->StringWidth("Bottom#") - kWidth;
    str = "";
	str << fMargins.bottom/fUnitValue;
	fBottom = new BTextControl( r, "bottom", "Bottom:", str.String(), NULL,
				B_FOLLOW_RIGHT);

	fBottom->SetModificationMessage(new BMessage(BOTTOM_MARGIN_CHANGED));
	fBottom->SetDivider(be_plain_font->StringWidth("Bottom#"));
	fBottom->SetTarget(this);

	_AllowOnlyNumbers(fBottom, kNumCount);
	AddChild(fBottom);




	//right
	r.OffsetBy(0, kOffsetY);
	r.left = Frame().Width() - be_plain_font->StringWidth("Right#") - kWidth;
    str = "";
	str << fMargins.right/fUnitValue;
	fRight = new BTextControl( r, "right", "Right:", str.String(), NULL,
				B_FOLLOW_RIGHT);

	fRight->SetModificationMessage(new BMessage(RIGHT_MARGIN_CHANGED));
	fRight->SetDivider(be_plain_font->StringWidth("Right#"));
	fRight->SetTarget(this);
	_AllowOnlyNumbers(fRight, kNumCount);
	AddChild(fRight);



// Create Units popup
	r.OffsetBy(-kOffsetX, kOffsetY);
	r.right += kOffsetY;

	BPopUpMenu *menu = new BPopUpMenu("units");
	BMenuField *mf = new BMenuField(r, "units", "Units", menu,
			B_FOLLOW_BOTTOM | B_FOLLOW_RIGHT);
	mf->ResizeToPreferred();
	mf->SetDivider(be_plain_font->StringWidth("Units#"));

	BMenuItem *item;
	// Construct menu items
	for (int32 i = 0; kUnitNames[i] != NULL; i++) {
		BMessage *msg = new BMessage(MARGIN_UNIT_CHANGED);
		msg->AddInt32("marginUnit", kUnitMsg[i]);
		menu->AddItem(item = new BMenuItem(kUnitNames[i], msg));
		item->SetTarget(this);
		if (fMarginUnit == kUnitMsg[i])
			item->SetMarked(true);
	}
	AddChild(mf);

	// calculate the sizes for drawing page view
	_CalculateViewSize(MARGIN_CHANGED);
}
示例#2
0
void Node::AddChild(Node* const child, int zOrder)
{
	AddChild(child);
	child->SetZorder(zOrder);
}
示例#3
0
SettingsWindow::SettingsWindow(BRect frame): BWindow(frame, "Settings",
									 B_FLOATING_WINDOW_LOOK,B_FLOATING_SUBSET_WINDOW_FEEL,
									 B_ASYNCHRONOUS_CONTROLS|B_NOT_ZOOMABLE|B_NOT_RESIZABLE)
{
	view = new BView(Bounds(), "Settings View", B_FOLLOW_ALL_SIDES, B_WILL_DRAW);
	BRect the_rect = Bounds();
	the_rect.InsetBy(5.0f, 5.0f);
	float rectHOffset = frame.Width() / 2.0f - 2.0f;
	float rectVOffset = 18.0f;
	char buffer[10];

	the_rect.right = the_rect.left + rectHOffset;
	the_rect.bottom = the_rect.top + rectVOffset;
	
	gState->Register(this);
	 
	
	if (gState->LockAsReader())
	{
		sprintf(buffer,FLOAT_FORMAT, ixMin);	
		XMinBox = new BTextControl( the_rect, "xMin", "x-Min", buffer, new BMessage(XMIN_CHG));
		XMinBox->SetTarget(this); 
		XMinBox->SetDivider(30);
		view->AddChild(XMinBox);
		
		the_rect.OffsetBy(rectHOffset + 4,0);
		sprintf(buffer,FLOAT_FORMAT, ixMax);
		XMaxBox = new BTextControl( the_rect, "xMax", "x-Max", buffer, new BMessage(XMAX_CHG));
		XMaxBox->SetTarget(this);
		XMaxBox->SetDivider(30);
		view->AddChild(XMaxBox);
		
		the_rect.OffsetBy(-(rectHOffset + 4.0f), XMinBox->Bounds().Height() + 4.0f);
		sprintf(buffer,FLOAT_FORMAT, iyMin);	
		YMinBox = new BTextControl( the_rect, "yMin", "y-Min", buffer, new BMessage(YMIN_CHG));
		YMinBox->SetTarget(this);
		YMinBox->SetDivider(30);
		view->AddChild(YMinBox);
		
		the_rect.OffsetBy(rectHOffset + 4.0f, 0.0f);
		sprintf(buffer,FLOAT_FORMAT, iyMax);	
		YMaxBox = new BTextControl( the_rect, "yMax", "y-Max", buffer, new BMessage(YMAX_CHG));
		YMaxBox->SetTarget(this);
		YMaxBox->SetDivider(30);
		view->AddChild(YMaxBox);
				
		the_rect.OffsetBy(-(rectHOffset + 4.0f), YMaxBox->Bounds().Height()+4.0f);
		sprintf(buffer,FLOAT_FORMAT, gState->TellxStep());
		XStepBox = new BTextControl(the_rect,"x step", "x step", buffer, new BMessage(XSTEP_CHG));
		XStepBox->SetDivider(35);
		XStepBox->SetTarget(this);
//		XStepBox->ResizeToPreferred();
		view->AddChild(XStepBox);
		
		the_rect.OffsetBy(rectHOffset +4.0f,0.0f);
		sprintf(buffer,FLOAT_FORMAT, gState->TellyStep());
		YStepBox = new BTextControl(the_rect,"y step", "y step", buffer, new BMessage(YSTEP_CHG));
		YStepBox->SetDivider(35);
		YStepBox->SetTarget(this);
//		YStepBox->ResizeToPreferred();
		view->AddChild(YStepBox);
		
		the_rect.OffsetBy(-(rectHOffset+4.0f),XStepBox->Bounds().Height()+4.0f);
		sprintf(buffer,FLOAT_FORMAT, gState->TellThetaStep());
		ThetaStepBox = new BTextControl(the_rect,"theta step", "theta step", buffer, new BMessage(THETA_STEP_CHG));
		ThetaStepBox->SetDivider(50);
		ThetaStepBox->SetTarget(this);
//		ThetaStepBox->ResizeToPreferred();
		view->AddChild(ThetaStepBox);
		
		the_rect.OffsetBy(0,ThetaStepBox->Bounds().Height()+4.0f);
		sprintf(buffer,FLOAT_FORMAT, gState->TellThetaStart());
		ThetaStartBox = new BTextControl(the_rect,"theta start", "theta start", buffer, new BMessage(THETA_START_CHG));
		ThetaStartBox->SetDivider(53);
		ThetaStartBox->SetTarget(this);
//		ThetaStartBox->ResizeToPreferred();
		view->AddChild(ThetaStartBox);

		the_rect.OffsetBy(rectHOffset+4.0f,0.0f);
		sprintf(buffer,FLOAT_FORMAT, gState->TellThetaStop());
		ThetaStopBox = new BTextControl(the_rect,"theta stop", "theta stop", buffer, new BMessage(THETA_STOP_CHG));
		ThetaStopBox->SetDivider(50);
		ThetaStopBox->SetTarget(this);
//		ThetaStopBox->ResizeToPreferred();
		view->AddChild(ThetaStopBox);

		the_rect.OffsetBy(-(rectHOffset+4.0f),ThetaStartBox->Bounds().Height()+4.0f);
		sprintf(buffer,FLOAT_FORMAT, gState->TellTStep());
		TStepBox = new BTextControl(the_rect,"t step", "t step", buffer, new BMessage(T_STEP_CHG));
		TStepBox->SetDivider(35);
		TStepBox->SetTarget(this);
//		TStepBox->ResizeToPreferred();
		view->AddChild(TStepBox);
		
		the_rect.OffsetBy(0,TStepBox->Bounds().Height()+4.0f);
		sprintf(buffer,FLOAT_FORMAT, gState->TellTStart());
		TStartBox = new BTextControl(the_rect,"t start", "t start", buffer, new BMessage(T_START_CHG));
		TStartBox->SetDivider(35);
		TStartBox->SetTarget(this);
//		TStartBox->ResizeToPreferred();
		view->AddChild(TStartBox);

		the_rect.OffsetBy(rectHOffset+4.0f,0.0f);
		sprintf(buffer,FLOAT_FORMAT, gState->TellTStop());
		TStopBox = new BTextControl(the_rect,"t stop", "t stop", buffer, new BMessage(T_STOP_CHG));
		TStopBox->SetDivider(35);
		TStopBox->SetTarget(this);
//		TStopBox->ResizeToPreferred();
		view->AddChild(TStopBox);
	
		gState->UnlockAsReader();
	}
	
	
	
	view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	
	AddChild(view);
	
	ResizeTo(XMinBox->Bounds().Width() + XMaxBox->Bounds().Width() + 4.0f + 10.0f, XMinBox->Bounds().Height()*7+4.0f+ 4.0f +4.0f+4.0f+4.0f+4.0f+ 10.0f);

	Show();
	
	return;
}
void
RowSummaryView::AllAttached()
{
	
	//Bitmaps used to hold the pictures for the Primay key picture button
	BRect rect(0,0,13,11);

	PrefilledBitmap firstRowOffBitmap(rect, B_COLOR_8_BIT, FirstRowOffRaw, 1344);
	PrefilledBitmap firstRowOnBitmap(rect, B_COLOR_8_BIT, FirstRowOnRaw, 1344);
	
	PrefilledBitmap previousRowOffBitmap(rect, B_COLOR_8_BIT, PreviousRowOffRaw, 1344);
	PrefilledBitmap previousRowOnBitmap(rect, B_COLOR_8_BIT, PreviousRowOnRaw, 1344);

	PrefilledBitmap nextRowOffBitmap(rect, B_COLOR_8_BIT, NextRowOffRaw, 1344);
	PrefilledBitmap nextRowOnBitmap(rect, B_COLOR_8_BIT, NextRowOnRaw, 1344);	

	PrefilledBitmap lastRowOffBitmap(rect, B_COLOR_8_BIT, LastRowOffRaw, 1344);
	PrefilledBitmap lastRowOnBitmap(rect, B_COLOR_8_BIT, LastRowOnRaw, 1344);	

	PrefilledBitmap newRowOffBitmap(rect, B_COLOR_8_BIT, NewRowOffRaw, 1344);
	PrefilledBitmap newRowOnBitmap(rect, B_COLOR_8_BIT, NewRowOnRaw, 1344);	
	
	PrefilledBitmap previousRowOffDisabledBitmap(rect, B_COLOR_8_BIT, PreviousRowOffDisabledRaw, 1344);
	PrefilledBitmap nextRowOffDisabledBitmap(rect, B_COLOR_8_BIT, NextRowOffDisabledRaw, 1344);
	PrefilledBitmap newRowOffDisabledBitmap(rect, B_COLOR_8_BIT, NewRowOffDisabledRaw, 1344);
	
	//TempView used to create BPictures
	BView *tempView = new BView(rect, "temp", B_FOLLOW_NONE, B_WILL_DRAW);
	AddChild(tempView);

	//Record BPictures for Off bitmaps
	tempView->BeginPicture(new BPicture);
	tempView->DrawBitmap(&firstRowOnBitmap);
	BPicture* firstRowPictureOn = tempView->EndPicture();

	tempView->BeginPicture(new BPicture);
	tempView->DrawBitmap(&previousRowOffBitmap);
	BPicture* previousRowPictureOff = tempView->EndPicture();

	tempView->BeginPicture(new BPicture);
	tempView->DrawBitmap(&nextRowOffBitmap);
	BPicture* nextRowPictureOff = tempView->EndPicture();

	tempView->BeginPicture(new BPicture);
	tempView->DrawBitmap(&lastRowOffBitmap);
	BPicture* lastRowPictureOff = tempView->EndPicture();

	tempView->BeginPicture(new BPicture);
	tempView->DrawBitmap(&newRowOffBitmap);
	BPicture* newRowPictureOff = tempView->EndPicture();

	//Record BPicture for DisabledOff bitmaps
	tempView->BeginPicture(new BPicture);
	tempView->DrawBitmap(&previousRowOffDisabledBitmap);
	BPicture* previousRowDisabledPictureOff = tempView->EndPicture();

	tempView->BeginPicture(new BPicture);
	tempView->DrawBitmap(&nextRowOffDisabledBitmap);
	BPicture* nextRowDisabledPictureOff = tempView->EndPicture();

	tempView->BeginPicture(new BPicture);
	tempView->DrawBitmap(&newRowOffDisabledBitmap);
	BPicture* newRowDisabledPictureOff = tempView->EndPicture();
	
	//Record BPictures for On bitmaps
	tempView->BeginPicture(new BPicture);
	tempView->DrawBitmap(&firstRowOffBitmap);
	BPicture* firstRowPictureOff = tempView->EndPicture();

	tempView->BeginPicture(new BPicture);
	tempView->DrawBitmap(&previousRowOnBitmap);
	BPicture* previousRowPictureOn = tempView->EndPicture();

	tempView->BeginPicture(new BPicture);
	tempView->DrawBitmap(&nextRowOnBitmap);
	BPicture* nextRowPictureOn = tempView->EndPicture();

	tempView->BeginPicture(new BPicture);
	tempView->DrawBitmap(&lastRowOnBitmap);
	BPicture* lastRowPictureOn = tempView->EndPicture();

	tempView->BeginPicture(new BPicture);
	tempView->DrawBitmap(&newRowOnBitmap);
	BPicture* newRowPictureOn = tempView->EndPicture();
	
	RemoveChild(tempView);
	delete tempView;

	// First Row Button
	BMessage* homeMsg = new BMessage(GRID_GOTO_ROW_MSG);
	homeMsg->AddInt32("rowNumber", int32(0));
	
	fFirstRowButton = new BPictureButton(BRect(48,1,61,12), "homeButton", firstRowPictureOff, 
	                                 firstRowPictureOn, homeMsg);

	// Previous Row Button
	BMessage* prevMsg = new BMessage(GRID_GOTO_PREV_ROW_MSG);
	fPreviousRowButton = new BPictureButton(BRect(63,1,76,12), "previousButton", 
									previousRowPictureOff, previousRowPictureOn, prevMsg);
	fPreviousRowButton->SetDisabledOff(previousRowDisabledPictureOff);
	
	// Row Number Display
	BRect frame(80,1,130,12);
	BRect textRect(0,0,frame.Width(),frame.Height());
	fRowNumberDisplay = new RowNumberDisplay(frame, "rowNumberDisplay", textRect, 
	                                  B_FOLLOW_BOTTOM, B_WILL_DRAW|B_NAVIGABLE);
	BFont font;
	font.SetSize(10);
	fRowNumberDisplay->SetFontAndColor(&font);
	fRowNumberDisplay->SetAlignment(B_ALIGN_RIGHT);
	fRowNumberDisplay->SetWordWrap(false);

	// Next Row Button
	BMessage* nextMsg = new BMessage(GRID_GOTO_NEXT_ROW_MSG);
	fNextRowButton = new BPictureButton(BRect(134,1,147,12), "nextButton", 
									nextRowPictureOff, nextRowPictureOn, nextMsg);
	fNextRowButton->SetDisabledOff(nextRowDisabledPictureOff);
	
	// Last Row Button
	BMessage* lastMsg = new BMessage(GRID_GOTO_LAST_ROW_MSG);
	fLastRowButton = new BPictureButton(BRect(149,1,162,12), "lastButton", 
									lastRowPictureOff, lastRowPictureOn, lastMsg);

	// New Row Button
	BMessage* newMsg = new BMessage(GRID_GOTO_NEW_ROW_MSG);
	fNewRowButton = new BPictureButton(BRect(164,1,177,12), "newButton", 
									newRowPictureOff, newRowPictureOn, newMsg);
	fNewRowButton->SetDisabledOff(newRowDisabledPictureOff);
	fNewRowButton->SetDisabledOn(newRowDisabledPictureOff);
	
	AddChild(fFirstRowButton);
	AddChild(fPreviousRowButton);
	AddChild(fRowNumberDisplay);
	AddChild(fNextRowButton);
	AddChild(fLastRowButton);
	AddChild(fNewRowButton);
}
示例#5
0
文件: editwin.cpp 项目: PyroOS/Pyro
EditWin::EditWin(const Rect & r, const String& name, Message *pcMsg, Looper *pcParent, const String& id)
	:Window(r, "EditWin", String().Format("%s - %s", name.c_str(),ID_SETTINGS_EDITOR_WINDOW.c_str()), 0, CURRENT_DESKTOP)
{
	Rect bounds = GetBounds();

	m_pcMessage = pcMsg;
	m_cName = name;
	m_cID = id;
	m_nIDCtr = 0;
	m_pcMessenger = new Messenger(pcParent, pcParent);

	int nCount;

	pcMsg->GetNameInfo(name.c_str(), &m_nType, &nCount);


 // --- Root layout node ---------------------------------------------------------

	LayoutNode* pcRoot = new VLayoutNode("pcRoot");
 
 // --- ListView -----------------------------------------------------------------

	m_pcItems = new ListView(Rect(), "m_pcListView", ListView::F_NO_AUTO_SORT|ListView::F_RENDER_BORDER);
	
	m_pcItems->InsertColumn(ID_LISTVIEW_INDEX.c_str(), 50);
	m_pcItems->InsertColumn(ID_LISTVIEW_VALUE.c_str(), 250);

	for(int i = 0; i < nCount; i++) {
		ListViewStringRow *lvs = new ListViewStringRow;
		char bfr[16];
		sprintf(bfr, "%d", i);
		lvs->AppendString(bfr);
		lvs->AppendString(MsgDataToText(name, i, pcMsg));
		sprintf(bfr, "%d", ++m_nIDCtr);	
		lvs->AppendString(bfr);
		m_pcItems->InsertRow(lvs);
	}
	
	m_pcItems->SetInvokeMsg(new Message(ID_EDIT_ITEM));

	pcRoot->AddChild(m_pcItems);

 // --- Buttons ------------------------------------------------------------------

	pcRoot->AddChild(new VLayoutSpacer("ButtonTopSpacer", 8, 8));
	LayoutNode *pcButtons = new HLayoutNode("pcButtons", 0.0f);
	pcButtons->AddChild(new HLayoutSpacer("ButtonLeftSpacer", 8, 8));
 	pcButtons->AddChild(new Button(Rect(), "pcAdd", ID_BUTTON_PLUS, new Message(ID_EDIT_ADD)));
	pcButtons->AddChild(new HLayoutSpacer("ButtonIntermediateSpacer", 8, 8));
 	pcButtons->AddChild(new Button(Rect(), "pcRem", ID_BUTTON_MINUS, new Message(ID_EDIT_DELETE)));
	pcButtons->AddChild(new HLayoutSpacer("ButtonIntermediateSpacer", 0, COORD_MAX));
 	pcButtons->AddChild(new Button(Rect(), "pcSave", ID_BUTTON_SAVE, new Message(ID_EDIT_SAVE)));
	pcButtons->AddChild(new HLayoutSpacer("ButtonIntermediateSpacer", 8, 8));
 	pcButtons->AddChild(new Button(Rect(), "pcCancel", ID_BUTTON_CLOSE, new Message(ID_EDIT_CANCEL)));
	pcButtons->AddChild(new HLayoutSpacer("ButtonRightSpacer", 8, 8));
 	pcButtons->SameWidth("pcSave", "pcCancel", NULL);
 	pcButtons->SameWidth("pcRem", "pcAdd", NULL);
 	pcRoot->AddChild(pcButtons);
	pcRoot->AddChild(new VLayoutSpacer("ButtonBottomSpacer", 8, 8));
	
	AddChild(new LayoutView(bounds, "pcLayout", pcRoot));
}
示例#6
0
void Ctrl::AddChild(Ctrl *child)
{
	AddChild(child, lastchild);
}
示例#7
0
//------------------------------------------------------------------------------
void WindowEditor::InitFlagsBoxes()
{
	BRect work = Bounds();
	work.left = 10;
	work.top = 100;
	work.bottom -= 5;
	work.right -= 10;
	work.right -= 10;
	int i = 20;
	int inc = 10;
	BBox* box = new BBox(work, "flags");
	BCheckBox* cbox;
	BMessage* msg;
	box->SetLabel("Window Flags");
	uint32 flags = fWindowInfo.flags;
	bool longLabel;

	for (int index = 0; WindowFlags[index].name; ++index)
	{
		longLabel = strlen(WindowFlags[index].label) > 20;
		// First column of checkboxes
		msg = new BMessage(MSG_WINDOW_SET_FLAG);
		msg->AddInt32("flags", WindowFlags[index].flag);
		cbox = new BCheckBox(BRect(10, i, longLabel ? 210 : 125, i + inc),
							 WindowFlags[index].name, WindowFlags[index].label, msg);
		fFlagBoxes.push_back(cbox);
		box->AddChild(cbox);
		if (WindowFlags[index].flip == (flags & WindowFlags[index].flag))
		{
			cbox->SetValue(B_CONTROL_ON);
		}

		// We skip to the next row as needed to make room for long labels
		if (!longLabel && WindowFlags[index + 1].name)
		{
			++index;
			// Second column of checkboxes
			msg = new BMessage(MSG_WINDOW_SET_FLAG);
			msg->AddInt32("flags", WindowFlags[index].flag);
			cbox = new BCheckBox(BRect(130, i, 210, i + inc),
								 WindowFlags[index].name,
								 WindowFlags[index].label,
								 msg);
			fFlagBoxes.push_back(cbox);
			box->AddChild(cbox);
			if (WindowFlags[index].flip == (flags & WindowFlags[index].flag))
			{
				cbox->SetValue(B_CONTROL_ON);
			}
		}

		i += inc * 2;
	}
#if 0
	msg = new BMessage(MSG_WINDOW_SET_FLAG);
	msg->AddInt32("flags",B_NOT_MOVABLE);
	box->AddChild(new BCheckBox(BRect(10,i,120,i+inc),"nmov","Movable",msg));
	msg = new BMessage(MSG_WINDOW_SET_FLAG);
	msg->AddInt32("flags",B_NOT_CLOSABLE);
	box->AddChild(new BCheckBox(BRect(130,i,210,i+inc),"clos","Closable",msg));
	msg = new BMessage(MSG_WINDOW_SET_FLAG);
	i+= inc*2;
	msg->AddInt32("flags",B_NOT_ZOOMABLE);
	box->AddChild(new BCheckBox(BRect(10,i,120,i+inc),"zoom","Zoomable",msg));
	msg = new BMessage(MSG_WINDOW_SET_FLAG);
	msg->AddInt32("flags",B_NOT_MINIMIZABLE);
	box->AddChild(new BCheckBox(BRect(130,i,210,i+inc),"mini","Minimizable",msg));
	msg = new BMessage(MSG_WINDOW_SET_FLAG);
	i+= inc*2;
	msg->AddInt32("flags",B_NOT_H_RESIZABLE);
	box->AddChild(new BCheckBox(BRect(10,i,210,i+inc),"hres","Horizontally Resizable",msg));
	msg = new BMessage(MSG_WINDOW_SET_FLAG);
	i+= inc*2;
	msg->AddInt32("flags",B_NOT_V_RESIZABLE);
	box->AddChild(new BCheckBox(BRect(10,i,125,i+inc),"vres","Vertically Resizable",msg));
	menubox = new BCheckBox(BRect(130,i,210,i+inc),"menus","Menu Bar",new BMessage(MSG_WINDOW_ADD_MENU));
	box->AddChild(menubox);
	if (fWindowInfo.has_menu)
		menubox->SetValue(B_CONTROL_ON);
	msg = new BMessage(MSG_WINDOW_SET_FLAG);
	i+= inc*2;
	msg->AddInt32("flags",B_OUTLINE_RESIZE);
	box->AddChild(new BCheckBox(BRect(10,i,210,i+inc),"roiw","Resize with Outline Instead of Window",msg));
	msg = new BMessage(MSG_WINDOW_SET_FLAG);
	i+= inc*2;
	msg->AddInt32("flags",B_WILL_ACCEPT_FIRST_CLICK);
	box->AddChild(new BCheckBox(BRect(10,i,210,i+inc),"wafc","Will Accept First Click",msg));
	msg = new BMessage(MSG_WINDOW_SET_FLAG);
	i+= inc*2;
	msg->AddInt32("flags",B_AVOID_FRONT);
	box->AddChild(new BCheckBox(BRect(10,i,120,i+inc),"avfr","Avoid Front",msg));
	msg = new BMessage(MSG_WINDOW_SET_FLAG);
	msg->AddInt32("flags",B_AVOID_FOCUS);
	box->AddChild(new BCheckBox(BRect(130,i,210,i+inc),"avfo","Avoid Focus",msg));
	msg = new BMessage(MSG_WINDOW_SET_FLAG);
	i+= inc*2;
	msg->AddInt32("flags",B_NO_WORKSPACE_ACTIVATION);
	box->AddChild(new BCheckBox(BRect(10,i,210,i+inc),"nwoa","Do Not Activate Workspace",msg));
	msg = new BMessage(MSG_WINDOW_SET_FLAG);
	i+= inc*2;
	msg->AddInt32("flags",B_NOT_ANCHORED_ON_ACTIVATE);
	box->AddChild(new BCheckBox(BRect(10,i,210,i+inc),"brcu","Bring Window To Current Workspace",msg));
	msg = new BMessage(MSG_WINDOW_SET_FLAG);
	i+= inc*2;
	msg->AddInt32("flags",B_ASYNCHRONOUS_CONTROLS);
	box->AddChild(new BCheckBox(BRect(10,i,210,+inc),"async","Asynchronous Controls (Should Be On)",msg));
#endif
#if 0
	if (!(flags & B_NOT_MOVABLE))
		((BCheckBox *)(box->ChildAt(0)))->SetValue(B_CONTROL_ON);
	if (!(flags & B_NOT_CLOSABLE))
		((BCheckBox *)(box->ChildAt(1)))->SetValue(B_CONTROL_ON);
	if (!(flags & B_NOT_ZOOMABLE))
		((BCheckBox *)(box->ChildAt(2)))->SetValue(B_CONTROL_ON);
	if (!(flags & B_NOT_MINIMIZABLE))
		((BCheckBox *)(box->ChildAt(3)))->SetValue(B_CONTROL_ON);
	if (!(flags & B_NOT_H_RESIZABLE))
		((BCheckBox *)(box->ChildAt(4)))->SetValue(B_CONTROL_ON);
	if (!(flags & B_NOT_V_RESIZABLE))
		((BCheckBox *)(box->ChildAt(5)))->SetValue(B_CONTROL_ON);
	if (flags & B_OUTLINE_RESIZE)
		((BCheckBox *)(box->ChildAt(7)))->SetValue(B_CONTROL_ON);
	if (flags & B_WILL_ACCEPT_FIRST_CLICK)
		((BCheckBox *)(box->ChildAt(8)))->SetValue(B_CONTROL_ON);
	if (flags & B_AVOID_FRONT)
		((BCheckBox *)(box->ChildAt(9)))->SetValue(B_CONTROL_ON);
	if (flags & B_AVOID_FOCUS)
		((BCheckBox *)(box->ChildAt(10)))->SetValue(B_CONTROL_ON);
	if (flags & B_NO_WORKSPACE_ACTIVATION)
		((BCheckBox *)(box->ChildAt(11)))->SetValue(B_CONTROL_ON);
	if (flags & B_NOT_ANCHORED_ON_ACTIVATE)
		((BCheckBox *)(box->ChildAt(12)))->SetValue(B_CONTROL_ON);
	if (flags & B_ASYNCHRONOUS_CONTROLS)
		((BCheckBox *)(box->ChildAt(13)))->SetValue(B_CONTROL_ON);
#endif

	AddChild(box);

	cbox = (BCheckBox*)FindView("menus");
	if (cbox)
	{
		cbox->SetValue(fWindowInfo.has_menu);
		cbox->SetMessage(new BMessage(MSG_WINDOW_ADD_MENU));
	}
}
示例#8
0
CharismaWindow::CharismaWindow(BPoint origin):
	BWindow(BRect(origin.x,origin.y,origin.x+200,origin.y+80),
		"Charisma", B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, 
		B_NOT_RESIZABLE|B_NOT_ZOOMABLE|B_WILL_ACCEPT_FIRST_CLICK)
{
	BRect nullrect(0,0,0,0),r;
	BMenu *m;
	BWindow *w;
	char buf[100];
	
	isminim=0;
	
	// le menu
	menubar=new BMenuBar(BRect(0,0,0,0),"menu bar");
	m=new BMenu("File");
	m->AddItem(new BMenuItem("About…",new BMessage(kMsg_About)));
	m->AddSeparatorItem();
	m->AddItem(new BMenuItem("Quit",new BMessage(B_QUIT_REQUESTED),'Q'));
	menubar->AddItem(m);
	m=new BMenu("Settings");
	m->AddItem(new BMenuItem("Select Web Directory…",new BMessage(kMsg_SelectDirectory)));
	m->AddSeparatorItem();
	m->AddItem(extcontrol_item=new BMenuItem("External Control",new BMessage(kMsg_ExternalControl)));
	m->AddItem(netposautoset_item=new BMenuItem("Net+ Autosettings",new BMessage(kMsg_NetposAutosettings)));
	m->AddSeparatorItem();
	m->AddItem(new BMenuItem("Clear Hits",new BMessage(kMsg_ClearHits)));
	menubar->AddItem(m);
	AddChild(menubar);

	// le fond gris
	r=Frame();
	setupview=new BView(
		BRect(0,menubar->Frame().bottom,r.Width(),r.Height()),
		"background",B_FOLLOW_NONE,B_WILL_DRAW);
	setupview->SetViewColor(0xDD,0xDD,0xDD);
	AddChild(setupview);
	
	// "Mode"
	m=new BPopUpMenu("");
	m->AddItem(new BMenuItem("Disabled",MSG));
	m->AddItem(new BMenuItem("Offline",MSG));
	m->AddItem(new BMenuItem("Online",MSG));
	modemenu=new BMenuField(
		BRect(10.0f,10.0f,20.0f,20.0f),"mode",
		"Mode:",
		m);
	BMenuField_resize(modemenu);
	setupview->AddChild(modemenu);

	// "Refresh"
	m=new BPopUpMenu("");
	m->AddItem(new BMenuItem("Dumb",MSG));
	m->AddSeparatorItem();
	m->AddItem(new BMenuItem("Always",MSG));
	m->AddItem(new BMenuItem("Once per session",MSG));
	m->AddSeparatorItem();
	m->AddItem(new BMenuItem("After 1 hour",MSG));
	m->AddItem(new BMenuItem("After 6 hours",MSG));
	m->AddItem(new BMenuItem("After 12 hours",MSG));
	m->AddSeparatorItem();
	m->AddItem(new BMenuItem("After 1 day",MSG));
	m->AddItem(new BMenuItem("After 2 days",MSG));
	m->AddItem(new BMenuItem("After 3 days",MSG));
	m->AddSeparatorItem();
	m->AddItem(new BMenuItem("After 1 week",MSG));
	m->AddItem(new BMenuItem("After 2 weeks",MSG));
	m->AddSeparatorItem();
	m->AddItem(new BMenuItem("After 1 month",MSG));
	m->AddItem(new BMenuItem("After 2 month",MSG));
	m->AddItem(new BMenuItem("After 6 month",MSG));
	m->AddSeparatorItem();
	m->AddItem(new BMenuItem("After 1 year",MSG));
	m->AddItem(new BMenuItem("After 2 years",MSG));
	m->AddSeparatorItem();
	m->AddItem(new BMenuItem("never",MSG));
	smartrefresh=new BMenuField(
		rectunder(modemenu),"refresh",
		"Refresh:",
		m);
	BMenuField_resize(smartrefresh);
	setupview->AddChild(smartrefresh);
	
	// "Hits"
	r.left=10.0f;
	r.top=smartrefresh->Frame().bottom+10.0f;
	r.right=r.left+setupview->StringWidth("hits: 99999");
	r.bottom=r.top+BView_textheight(setupview);
	hits=new BStringView(r,"hits","");
	setupview->AddChild(hits);

	if(!gregistered){
		sprintf(buf,"This copy is not registered");
		r.left=10.0f;
		r.top=hits->Frame().bottom+10.0f;
		r.right=r.left+setupview->StringWidth(buf);
		r.bottom=r.top+BView_textheight(setupview);
		setupview->AddChild(new BStringView(r,NULL,buf));
	}

	r=BView_childrenframe(setupview);
	setupview->ResizeTo(r.right+10,r.bottom+10);
	r=setupview->Frame();
	ResizeTo(r.right,r.bottom);
	
	hitcount=0;
	hitspulser=spawn_thread(pulsehits_,"StaminaWindow::pulsehits",
		B_NORMAL_PRIORITY,this);
	if(hitspulser<B_NO_ERROR)
		fatal(__FILE__,__LINE__,"spawn_thread failed");
	resume_thread(hitspulser);
	
	selectdirpanel=new BFilePanel(
		B_OPEN_PANEL,
		&BMessenger(this),
		NULL,
		B_DIRECTORY_NODE,
		false,
		new BMessage(kMsg_DirSelected));
	w=selectdirpanel->Window();
	w->Lock();
	w->SetTitle("Select Web Directory");
	selectdirpanel->SetButtonLabel(B_DEFAULT_BUTTON,"Select");
	r=w->FindView("cancel button")->Frame();
	r.right=r.left-15.0f;
	r.left=10.0f;
	r.bottom=r.top+BView_textheight(w->ChildAt(0));
	currentdir=new BStringView(r,"current","",B_FOLLOW_LEFT_RIGHT|B_FOLLOW_BOTTOM);
	w->ChildAt(0)->AddChild(currentdir);
	w->Unlock();
	
}
示例#9
0
SelectionWindow::SelectionWindow(BContainerWindow* window)
	:
	BWindow(BRect(0, 0, 270, 0), B_TRANSLATE("Select"),	B_TITLED_WINDOW,
		B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE | B_NOT_V_RESIZABLE
			| B_NO_WORKSPACE_ACTIVATION | B_ASYNCHRONOUS_CONTROLS
			| B_NOT_ANCHORED_ON_ACTIVATE),
	fParentWindow(window)
{
	if (window->Feel() & kDesktopWindowFeel) {
		// The window will not show up if we have
		// B_FLOATING_SUBSET_WINDOW_FEEL and use it with the desktop window
		// since it's never in front.
		SetFeel(B_NORMAL_WINDOW_FEEL);
	}

	AddToSubset(fParentWindow);

	BView* backgroundView = new BView(Bounds(), "bgView", B_FOLLOW_ALL,
		B_WILL_DRAW);
	backgroundView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
	AddChild(backgroundView);

	BMenu* menu = new BPopUpMenu("");
	menu->AddItem(new BMenuItem(B_TRANSLATE("starts with"),	NULL));
	menu->AddItem(new BMenuItem(B_TRANSLATE("ends with"), NULL));
	menu->AddItem(new BMenuItem(B_TRANSLATE("contains"), NULL));
	menu->AddItem(new BMenuItem(B_TRANSLATE("matches wildcard expression"),
		NULL));
	menu->AddItem(new BMenuItem(B_TRANSLATE("matches regular expression"),
		NULL));

	menu->SetLabelFromMarked(true);
	menu->ItemAt(3)->SetMarked(true);
		// Set wildcard matching to default.

	// Set up the menu field
	fMatchingTypeMenuField = new BMenuField(BRect(7, 6,
		Bounds().right - 5, 0), NULL, B_TRANSLATE("Name"), menu);
	backgroundView->AddChild(fMatchingTypeMenuField);
	fMatchingTypeMenuField->SetDivider(fMatchingTypeMenuField->StringWidth(
		B_TRANSLATE("Name")) + 8);
	fMatchingTypeMenuField->ResizeToPreferred();

	// Set up the expression text control
	fExpressionTextControl = new BTextControl(BRect(7,
			fMatchingTypeMenuField->Bounds().bottom + 11,
			Bounds().right - 6, 0),
		NULL, NULL, NULL, NULL, B_FOLLOW_LEFT_RIGHT);
	backgroundView->AddChild(fExpressionTextControl);
	fExpressionTextControl->ResizeToPreferred();
	fExpressionTextControl->MakeFocus(true);

	// Set up the Invert checkbox
	fInverseCheckBox = new BCheckBox(
		BRect(7, fExpressionTextControl->Frame().bottom + 6, 6, 6), NULL,
		B_TRANSLATE("Invert"), NULL);
	backgroundView->AddChild(fInverseCheckBox);
	fInverseCheckBox->ResizeToPreferred();

	// Set up the Ignore Case checkbox
	fIgnoreCaseCheckBox = new BCheckBox(
		BRect(fInverseCheckBox->Frame().right + 10,
			fInverseCheckBox->Frame().top, 6, 6),
		NULL, B_TRANSLATE("Ignore case"), NULL);
	fIgnoreCaseCheckBox->SetValue(1);
	backgroundView->AddChild(fIgnoreCaseCheckBox);
	fIgnoreCaseCheckBox->ResizeToPreferred();

	// Set up the Select button
	fSelectButton = new BButton(BRect(0, 0, 5, 5), NULL,
		B_TRANSLATE("Select"), new BMessage(kSelectButtonPressed),
		B_FOLLOW_RIGHT);

	backgroundView->AddChild(fSelectButton);
	fSelectButton->ResizeToPreferred();
	fSelectButton->MoveTo(Bounds().right - 10 - fSelectButton->Bounds().right,
		fExpressionTextControl->Frame().bottom + 9);
	fSelectButton->MakeDefault(true);
#if !B_BEOS_VERSION_DANO
	fSelectButton->SetLowColor(backgroundView->ViewColor());
	fSelectButton->SetViewColor(B_TRANSPARENT_COLOR);
#endif

	font_height fh;
	be_plain_font->GetHeight(&fh);
	// Center the checkboxes vertically to the button
	float topMiddleButton =
		(fSelectButton->Bounds().Height() / 2 -
		(fh.ascent + fh.descent + fh.leading + 4) / 2)
		+ fSelectButton->Frame().top;
	fInverseCheckBox->MoveTo(fInverseCheckBox->Frame().left, topMiddleButton);
	fIgnoreCaseCheckBox->MoveTo(fIgnoreCaseCheckBox->Frame().left,
		topMiddleButton);

	float bottomMinWidth = 32 + fSelectButton->Bounds().Width()
		+ fInverseCheckBox->Bounds().Width()
		+ fIgnoreCaseCheckBox->Bounds().Width();
	float topMinWidth = be_plain_font->StringWidth(
		B_TRANSLATE("Name matches wildcard expression:###"));
	float minWidth = bottomMinWidth > topMinWidth
		? bottomMinWidth : topMinWidth;

	class EscapeFilter : public BMessageFilter {
	public:
		EscapeFilter(BWindow* target)
			:
			BMessageFilter(B_KEY_DOWN),
			fTarget(target)
		{
		}

		virtual filter_result Filter(BMessage* message, BHandler** _target)
		{
			int8 byte;
			if (message->what == B_KEY_DOWN
				&& message->FindInt8("byte", &byte) == B_OK
				&& byte == B_ESCAPE) {
				fTarget->Hide();
				return B_SKIP_MESSAGE;
			}
			return B_DISPATCH_MESSAGE;
		}

	private:
		BWindow* fTarget;
	};
	AddCommonFilter(new(std::nothrow) EscapeFilter(this));

	Run();

	Lock();
	ResizeTo(minWidth, fSelectButton->Frame().bottom + 6);

	SetSizeLimits(minWidth, 1280, Bounds().bottom, Bounds().bottom);

	MoveCloseToMouse();
	Unlock();
}
示例#10
0
文件: Slider.cpp 项目: gedrin/Becasso
void Slider::KeyDown (const char *bytes, int32 numBytes)
{
	if (numBytes == 1)
	{
		switch (*bytes)
		{
		case B_ESCAPE:
		{
			if (tc)
			{
				// printf ("TextControl is open\n");
				RemoveChild (tc);
				delete (tc);
				tc = NULL;
			}
			break;
		}
		case B_SPACE:
		case B_ENTER:
		{	
			//printf ("Enter\n");
			if (tc)
			{
				// printf ("TextControl is open\n");
				BMessage *key = new BMessage ('tcVC');
				MessageReceived (key);
				delete key;
			}
			else
			{
				knobpos = BPoint (float (value - min)/(max - min)*(width - knobsize), 1);
				BRect kbr = BRect (knobpos.x + sep, knobpos.y, knobpos.x + knobsize - 2 + sep, knobpos.y + height - 3);
		//		kbr.PrintToStream();
				tc = new BTextControl (kbr, "slider value field", "", "", new BMessage ('tcVC'));
				tc->SetTarget (this);
				tc->SetDivider (0);
				EnterFilter *filter = new EnterFilter (this);
				tc->TextView()->AddFilter (filter);
				char vs[64];
				sprintf (vs, fmt, value);
				tc->SetText (vs);
				AddChild (tc);
				tc->MakeFocus (true);
				inherited::KeyDown (bytes, numBytes);
			}
			break;
		}
		case B_LEFT_ARROW:
			//printf ("Left\n");
			if (value > min)
			{
				value -= step;
				Invalidate();
				NotifyTarget();
			}
			break;
		case B_RIGHT_ARROW:
			//printf ("Right\n");
			if (value < max)
			{
				value += step;
				Invalidate();
				NotifyTarget();
			}
			break;
		case B_TAB:
			// printf ("Tab\n");
			if (tc)
			{
				// printf ("TextControl is open\n");
				BMessage *key = new BMessage ('tcVC');
				MessageReceived (key);
				delete key;
			}
			else
			{
			// MakeFocus (false);
				inherited::KeyDown (bytes, numBytes);
				Invalidate();
				break;
			}
		default:
			inherited::KeyDown (bytes, numBytes);
		}
	}
	else
		inherited::KeyDown (bytes, numBytes);
}
示例#11
0
//=======================================================================================
//  CFuiTBROS  Terra Browser
//=======================================================================================
CFuiTBROS::CFuiTBROS(Tag idn, const char *filename)
:CFuiWindow(idn,filename,600,360,0)
{ strncpy(text,"TERRA BROWSER",255);
	//-------------------------------------------------
	state	= 0;
	sel		= 0;
	chng	= 0;
	Type  = -1;
  inf.mADR = 0;
  inf.xOBJ = 0;
  inf.res  = TX_HIGHTR;
	obtn	= 0;
	abtn	= 0;
	lock  = 1;
  //----Create a label title ----------------------
  CFuiLabel *lab1 = new CFuiLabel(20,10,280, 20,this);
  lab1->SetText("TYPE OF TERRAIN TEXTURES");
  AddChild('lbl1',lab1);

  //----Create the List box -----------------------
  xWIN  =           new CFuiList (20,30,270,256,this);
  xWIN->SetVScroll();
  AddChild('xlst',xWIN);

  //----Create a Canvas ---------------------------
  xCNV  =           new CFuiCanva(320,30,256,256,this);
  AddChild('xcnv',xCNV);
  xCNV->EraseCanvas();
  //----Create Canvas Title -----------------------
  wLB1  =           new CFuiLabel(320,10,256,20,this);
  AddChild('wlb1',wLB1);
  //----Create RadioButton ------------------------
  wLOK  =           new CFuiCheckbox(20, 300,420,16,this);
  AddChild('wlok',wLOK,OptTXT[lock]);
  wLOK->SetState(lock);

  //----Create the button -------------------------
  wBT1  =           new CFuiButton(420,  300, 140,20,this);
  AddChild('wbt1',wBT1,"Assign selected Texture");
  //----Create Cancel button ----------------------
  zBTN  =           new CFuiButton(420,  326, 140,20,this);
  AddChild('zbtn',zBTN,"CANCEL");
	//--- Create group edit -------------------------
	BuildGroupEdit(10,320);
  //----Create surface ----------------------------
  CFuiWindow::ReadFinished();
  aBOX = globals->tcm->GetTerraBox();
  aBOX->SetParameters(this,'xlst',LIST_DONT_FREE);
  //---Get a camera to draw texture ---------------
  Cam     = new CCameraSpot();
  //-----------------------------------------------
  tFIL    = globals->tcm->GetTerraFile();
  //-----------------------------------------------
  aBOX->SortAndDisplay();
  int tex  = globals->tcm->GetGroundType();
  aBOX->GoToKey(&tex);
  GetSelection();
	//--- Set application profile -------------------
  ctx.prof	= TBROS_PROF;
	ctx.mode	= SLEW_RCAM;
  rcam			= globals->ccm->SetRabbitCamera(ctx,RABBIT_S_AND_C);

}
示例#12
0
文件: Slider.cpp 项目: gedrin/Becasso
void Slider::MouseDown (BPoint point)
// Note: Still assumes horizontal slider ATM!
{
	if (tc)	// TextControl still visible...  Block other mouse movement.
		return;
		
	BPoint knobpos = BPoint (float (value - min)/(max - min)*(width - knobsize), 1);
	knob = BRect (knobpos.x + 1, knobpos.y + 1, knobpos.x + knobsize - 2, knobpos.y + height - 2);
	ulong buttons;
	buttons = Window()->CurrentMessage()->FindInt32 ("buttons");
	float px = -1;
	bool dragging = false;
	if (click != 2 && buttons & B_PRIMARY_MOUSE_BUTTON && !(modifiers() & B_CONTROL_KEY))
	{
		BPoint bp, pbp;
		uint32 bt;
		GetMouse (&pbp, &bt, true);
		bigtime_t start = system_time();
		if (knob.Contains (BPoint (pbp.x - sep, pbp.y)))
		{
			while (system_time() - start < dcspeed)
			{
				snooze (20000);
				GetMouse (&bp, &bt, true);
				if (!bt && click != 2)
				{
					click = 0;
				}
				if (bt && !click)
				{
					click = 2;
				}
				if (bp != pbp)
					break;
			}
		}
		if (click != 2)
		{
			// Now we're dragging...
			while (buttons)
			{
				BPoint p = BPoint (point.x - sep, point.y);
				float x = p.x;
				if (!(knob.Contains (p)) && !dragging)
				{
					if (x > knob.left)
					{
						value += step * (x - knob.right)/10;
					}
					else
					{
						value += step * (x - knob.left)/10;
					}
					if (value < min)
						value = min;
					if (value > max)
						value = max;
					if (step > 1 && fmod (value - min, step))	// Hack hack!
						value = int ((value - min)/step)*step + min;
		//			if (fmt[strlen (fmt) - 2] == '0')
		//				value = int (value + 0.5);
					offslid->Lock();
					Invalidate (BRect (sep + 1, 0, offslid->Bounds().Width() + sep, height));
					offslid->Unlock();
					NotifyTarget();
				}
				else if (px != p.x && step <= 1)	// Hacks galore!
				{
					dragging = true;
					value = (x - knobsize/2) / (width - knobsize) * (max - min) + min;
					//printf ("x = %f, knobsize = %f, value = %f\n", x, knobsize, value);
					//printf ("Value: %f ", value);
					if (value < min)
						value = min;
					if (value > max)
						value = max;
					if (step > 1 && fmod (value - min, step))
						value = int ((value - min)/step)*step + min;
					if (fmt[strlen (fmt) - 2] == '0')
						value = int (value + 0.5);
					//printf ("-> %f\n", value);
					offslid->Lock();
					Invalidate (BRect (sep + 1, 0, offslid->Bounds().Width() + sep, height));
					offslid->Unlock();
					px = p.x;
					NotifyTarget();
				}
				knobpos = BPoint (float (value - min)/(max - min)*(width - knobsize), 1);
				knob = BRect (knobpos.x + 1, knobpos.y + 1, knobpos.x + knobsize - 2, knobpos.y + height - 2);
				snooze (20000);
				GetMouse (&point, &buttons, true);
			}
			click = 1;
		}
	}
	if (click == 2 || buttons & B_SECONDARY_MOUSE_BUTTON || modifiers() & B_CONTROL_KEY)
	{
		click = 1;
		if (tc)
		{
			RemoveChild (tc);
			delete tc;
		}
		knobpos = BPoint (float (value - min)/(max - min)*(width - knobsize), 1);
		BRect kbr = BRect (knobpos.x + sep, knobpos.y, knobpos.x + knobsize - 2 + sep, knobpos.y + height - 3);
//		kbr.PrintToStream();
		tc = new BTextControl (kbr, "slider value field", "", "", new BMessage ('tcVC'));
		tc->SetTarget (this);
		tc->SetDivider (0);
		EnterFilter *filter = new EnterFilter (this);
		tc->TextView()->AddFilter (filter);
		char vs[64];
		sprintf (vs, fmt, value);
		tc->SetText (vs);
		AddChild (tc);
		tc->MakeFocus (true);
	}
	NotifyTarget ();
}
示例#13
0
/***********************************************************
 * InitGUI
 ***********************************************************/
void
HAddressView::InitGUI()
{
	float divider = StringWidth(_("Subject:")) + 20;
	divider = max_c(divider , StringWidth(_("From:"))+20);
	divider = max_c(divider , StringWidth(_("To:"))+20);
	divider = max_c(divider , StringWidth(_("Bcc:"))+20);
	
	BRect rect = Bounds();
	rect.top += 5;
	rect.left += 20 + divider;
	rect.right = Bounds().right - 5;
	rect.bottom = rect.top + 25;
	
	BTextControl *ctrl;
	ResourceUtils rutils;
	const char* name[] = {"to","subject","from","cc","bcc"};
	
	for(int32 i = 0;i < 5;i++)
	{
		ctrl = new BTextControl(BRect(rect.left,rect.top
								,(i == 1)?rect.right+divider:rect.right
								,rect.bottom)
								,name[i],"","",NULL
								,B_FOLLOW_LEFT_RIGHT|B_FOLLOW_TOP,B_WILL_DRAW|B_NAVIGABLE);
		
		if(i == 1)
		{
			ctrl->SetLabel(_("Subject:"));
			ctrl->SetDivider(divider);
			ctrl->MoveBy(-divider,0);
		}else{
			ctrl->SetDivider(0);
		}
		BMessage *msg = new BMessage(M_MODIFIED);
		msg->AddPointer("pointer",ctrl);
		ctrl->SetModificationMessage(msg);
		ctrl->SetEnabled(!fReadOnly);
		AddChild(ctrl);
	
		rect.OffsetBy(0,25);
		switch(i)
		{
		case 0:
			fTo = ctrl;
			break;
		case 1:
			fSubject = ctrl;
			break;
		case 2:
			fFrom = ctrl;
			fFrom->SetEnabled(false);
			fFrom->SetFlags(fFrom->Flags() & ~B_NAVIGABLE);
			break;
		case 3:
			fCc = ctrl;
			break;
		case 4:
			fBcc = ctrl;
			break;
		}
	}
	//
	BRect menuRect= Bounds();
	menuRect.top += 5;
	menuRect.left += 22;
	menuRect.bottom = menuRect.top + 25;
	menuRect.right = menuRect.left + 16;
	
	BMenu *toMenu = new BMenu(_("To:"));
	BMenu *ccMenu = new BMenu(_("Cc:"));
	BMenu *bccMenu = new BMenu(_("Bcc:"));
	BQuery query;
	BVolume volume;
	BVolumeRoster().GetBootVolume(&volume);
	query.SetVolume(&volume);
	query.SetPredicate("((META:email=*)&&(BEOS:TYPE=application/x-person))");

	if(!fReadOnly && query.Fetch() == B_OK)
	{
		BString addr[4],name,group,nick;
		entry_ref ref;
		BList peopleList;
	
	
		while(query.GetNextRef(&ref) == B_OK)
		{
			BNode node(&ref);
			if(node.InitCheck() != B_OK)
				continue;
			
			ReadNodeAttrString(&node,"META:name",&name);		
			ReadNodeAttrString(&node,"META:email",&addr[0]);
			ReadNodeAttrString(&node,"META:email2",&addr[1]);
			ReadNodeAttrString(&node,"META:email3",&addr[2]);
			ReadNodeAttrString(&node,"META:email4",&addr[3]);
			ReadNodeAttrString(&node,"META:group",&group);
			ReadNodeAttrString(&node,"META:nickname",&nick);
			
			for(int32 i = 0;i < 4;i++)
			{
				if(addr[i].Length() > 0)
				{
					if(nick.Length() > 0)
					{
						nick += " <";
						nick += addr[i];
						nick += ">";
						fAddrList.AddItem(strdup(nick.String()));
					}
					fAddrList.AddItem(strdup(addr[i].String()));
					
					BString title = name;
					title << " <" << addr[i] << ">";
				
					AddPersonToList(peopleList,title.String(),group.String());
				}
			}
		}
		
		// Sort people data
		peopleList.SortItems(HAddressView::SortPeople);
		// Build menus
		BTextControl *control[3] = {fTo,fCc,fBcc};
		BMenu *menus[3] = {toMenu,ccMenu,bccMenu};
		int32 count = peopleList.CountItems();
		PersonData *data;
		bool needSeparator = false;
		bool hasSeparator = false;
		for(int32 k = 0;k < 3;k++)
		{
			for(int32 i = 0;i < count;i++)
			{
				BMessage *msg = new BMessage(M_ADDR_MSG);
				msg->AddPointer("pointer",control[k]);
				data =  (PersonData*)peopleList.ItemAt(i);
				msg->AddString("email",data->email);
				if(needSeparator && !hasSeparator && strlen(data->group) == 0)
				{
					menus[k]->AddSeparatorItem();
					hasSeparator = true;
				}else
					needSeparator = true;
				AddPerson(menus[k],data->email,data->group,msg,0,0);
			}
			hasSeparator = false;
			needSeparator = false;
		}
		// free all data
		while(count > 0)
		{
			data =  (PersonData*)peopleList.RemoveItem(--count);
			free(data->email);
			free(data->group);
			delete data;
		}
	}
	BMenuField *field = new BMenuField(menuRect,"ToMenu","",toMenu,
							B_FOLLOW_TOP|B_FOLLOW_LEFT,B_WILL_DRAW);
	field->SetDivider(0);
	field->SetEnabled(!fReadOnly);
	AddChild(field);
	
	rect = menuRect;
	rect.OffsetBy(0,28);
	rect.left = Bounds().left + 5;
	rect.right = rect.left + 16;
	rect.top += 26;
	rect.bottom = rect.top + 16;
	ArrowButton *arrow = new ArrowButton(rect,"addr_arrow"
										,new BMessage(M_EXPAND_ADDRESS));
	AddChild(arrow);
	//==================== From menu
	BMenu *fromMenu = new BMenu(_("From:"));
	BPath path;
	::find_directory(B_USER_SETTINGS_DIRECTORY,&path);
	path.Append(APP_NAME);
	path.Append("Accounts");
	BDirectory dir(path.Path());
	BEntry entry;
	status_t err = B_OK;
	int32 account_count = 0;
	while(err == B_OK)
	{
		if((err = dir.GetNextEntry(&entry)) == B_OK && !entry.IsDirectory())
		{
			char name[B_FILE_NAME_LENGTH+1];
			entry.GetName(name);
			BMessage *msg = new BMessage(M_ACCOUNT_CHANGE);
			msg->AddString("name",name);
			BMenuItem *item = new BMenuItem(name,msg);
			fromMenu->AddItem(item);
			item->SetTarget(this,Window());
			account_count++;
		}
	}
	if(account_count != 0)
	{
		int32 smtp_account;
		((HApp*)be_app)->Prefs()->GetData("smtp_account",&smtp_account);
		BMenuItem *item(NULL);
		if(account_count > smtp_account)
			item = fromMenu->ItemAt(smtp_account);
		if(!item)
			item = fromMenu->ItemAt(0);
		if(item)
		{
			ChangeAccount(item->Label());
			item->SetMarked(true);
		}
	}else{
		(new BAlert("",_("Could not find mail accounts"),_("OK"),NULL,NULL,B_WIDTH_AS_USUAL,B_INFO_ALERT))->Go();
		Window()->PostMessage(B_QUIT_REQUESTED);
	}
	fromMenu->SetRadioMode(true);
	
	menuRect.OffsetBy(0,25*2);
	field = new BMenuField(menuRect,"FromMenu","",fromMenu,
							B_FOLLOW_TOP|B_FOLLOW_LEFT,B_WILL_DRAW);
	field->SetDivider(0);
	
	AddChild(field);
	//=================== CC menu
	menuRect.OffsetBy(0,25);
	field = new BMenuField(menuRect,"CcMenu","",ccMenu,
							B_FOLLOW_TOP|B_FOLLOW_LEFT,B_WILL_DRAW);
	field->SetDivider(0);
	field->SetEnabled(!fReadOnly);
	AddChild(field);

	//=================== BCC menu	
	menuRect.OffsetBy(0,25);
	field = new BMenuField(menuRect,"BccMenu","",bccMenu,
							B_FOLLOW_TOP|B_FOLLOW_LEFT,B_WILL_DRAW);
	field->SetDivider(0);
	field->SetEnabled(!fReadOnly);
	AddChild(field);
	

}
示例#14
0
//---------------------------------------------------------------------------------------
//=======================================================================================
//  CFuiProb:  Display susbsystem property
//=======================================================================================
CFuiProbe::CFuiProbe(Tag idn, const char *filename)
    :CFuiWindow(idn,filename,500,600,0)
{   strncpy(text,"SUBSYSTEM PROBE",255);
    title = 1;
    close = 1;
    zoom  = 0;
    mini  = 0;
    //--------Create the subsystem list -----------------------
    wSub  = new CFuiList(20,10,170,380,this);
    wSub->SetVScroll();
    AddChild('lsub',wSub);
    //--------Create First selector ------------------------------
    pob1.btn  = new CFuiButton(DEB_POS,10,130,20,this);
    AddChild('btn1',pob1.btn,"Subsystem 1");
    //--------Create the first canvas -------------------------
    pob1.wCn  = new CFuiCanva (DEB_POS,40,130,200,this);
    AddChild('wcn1',pob1.wCn);
    //--------Create the first dpent button --------------------
    pob1.dpn  = new CFuiButton(DEB_POS,250,130,20,this);
    AddChild('bdp1',pob1.dpn,"Dependents");
    pob1.sub  = 0;
    //--------Create the first dependent list -----------------
    pob1.wsy  = new CFuiList(DEB_POS,280,130,70,this);
    pob1.wsy->SetVScroll();
    AddChild('dpn1',pob1.wsy);
    pob1.box.SetParameters(this,'dpn1',0);
    //--------Create the first popup option menu -------------------
    pob1.pop  = new CFuiPopupMenu(DEB_POS,354,130,30,this);
    AddChild('pop1',pob1.pop,"Options");
    pob1.lst  = prob_OP1;
    //--------Create second selector  ------------------------------
    pob2.btn  = new CFuiButton(MID_POS,10,130,20,this);
    AddChild('btn2',pob2.btn,"Subsystem 2");
    //-------Create the second canva --------------------------
    pob2.wCn  = new CFuiCanva(MID_POS,40,130,200,this);
    AddChild('wcn2',pob2.wCn);
    //--------Create the second button -------------------------
    pob2.dpn  = new CFuiButton(MID_POS,250,130,20,this);
    AddChild('bdp2',pob2.dpn,"Dependents");
    pob2.sub  = 0;
    //--------Create the second dependent list -----------------
    pob2.wsy  = new CFuiList(MID_POS,280,130,70,this);
    pob2.wsy->SetVScroll();
    AddChild('dpn2',pob2.wsy);
    pob2.box.SetParameters(this,'dpn2',0);
    //--------Create the second popup option menu --------------
    pob2.pop  = new CFuiPopupMenu(MID_POS,354,130,30,this);
    AddChild('pop2',pob2.pop,"Options");
    pob2.lst  = prob_OP2;
    //--------Create info canvas ------------------------------
    info  = new CFuiCanva(20,400,460,50,this);
    info->SetId('info');
    info->ReadFinished();
    childList.push_back(info);
    //--------Create metar canvas -----------------------------
    meto  = new CFuiCanva(20,460,460,50,this);
    meto->SetId('meto');
    meto->ReadFinished();
    childList.push_back(meto);
    //-------Create Animator list -----------------------------
    wPID  = new CFuiList(20,520,170,70,this);
    wPID->SetVScroll();
    AddChild('wpid',wPID);
    bPID.SetParameters(this,'wpid',0);
    //--------Create Animator Canva ---------------------------
    cPID  = new CFuiCanva(DEB_POS,520,280,70,this);
    cPID->SetId('cpid');
    cPID->ReadFinished();
    childList.push_back(cPID);
    //--------Display subsystems ------------------------------
    CFuiWindow::ReadFinished();
    veh = globals->pln;
    if (veh)  Init();
    else      Close();
}
示例#15
0
AddTorrentWindow::AddTorrentWindow(TorrentObject* torrent)
	:	BWindow(BRect(),
				"Add torrent", 
				B_TITLED_WINDOW_LOOK,
				B_NORMAL_WINDOW_FEEL, 
				B_AUTO_UPDATE_SIZE_LIMITS |
				B_ASYNCHRONOUS_CONTROLS |
				B_NOT_ZOOMABLE |
				B_NOT_RESIZABLE |
				B_PULSE_NEEDED ),
		fTorrent(torrent),
		fCancelAdd(true)
{
	SetPulseRate(1000000);
	SetLayout(new BGroupLayout(B_VERTICAL));	
	
	float spacing = be_control_look->DefaultItemSpacing();
	
	//
	//
	//
	fInfoHeaderView = new InfoHeaderView(fTorrent);
	fFileList		= new BColumnListView("FileList", 0, B_PLAIN_BORDER, true);
	fStartCheckBox 	= new BCheckBox("", "Start when added", NULL);
	fCancelButton	= new BButton("Cancel", new BMessage(B_QUIT_REQUESTED));
	fAddButton		= new BButton("Add", new BMessage(MSG_BUTTON_ADD));
	fLoadingView	= new BStatusBar("", "Downloading Metadata");
	fLoadingView->SetBarHeight(12);
	fLoadingView->SetMaxValue(1.0);
	
	if( !fTorrent->IsMagnet() )
		fLoadingView->Hide();
	
	fStartCheckBox->SetValue(B_CONTROL_ON);
	
	//
	//
	//
	fFileList->SetColumnFlags(B_ALLOW_COLUMN_RESIZE);
	fFileList->SetSortingEnabled(false);
	fFileList->SetExplicitMinSize(BSize(550, FILE_COLUMN_HEIGHT * 5));
	
	fFileList->AddColumn(new FileColumn("Name", 400, 400, 500), COLUMN_FILE_NAME);
	fFileList->AddColumn(new CheckBoxColumn("DL", 40, 40, 40), COLUMN_FILE_DOWNLOAD);
	
	//
	// We're a magnet or a complete torrent file?
	//
	if( fTorrent->IsMagnet() )
	{
		fTorrent->SetMetadataCallbackHandler(this);
		//const_cast<TorrentObject*>(fTorrent)->StartTransfer();
	}
	else
		UpdateFileList();

	
	AddChild(BGroupLayoutBuilder(B_VERTICAL, spacing)
		.Add(fInfoHeaderView)
		.AddGlue()
		.Add(fFileList)
		.Add(BGroupLayoutBuilder(B_HORIZONTAL, spacing)
			.SetInsets(spacing, spacing, spacing, spacing)
			.Add(fStartCheckBox)
			.AddGlue()
			.Add(fCancelButton)
			.Add(fAddButton)
			.Add(fLoadingView)
		)
		.SetInsets(spacing, spacing, spacing, spacing)
	);
	
	CenterOnScreen();
	Run();
}
示例#16
0
OP_STATUS TransfersPanel::Init()
{
	RETURN_IF_ERROR(OpTreeView::Construct(&m_transfers_view));
	m_transfers_view->SetSystemFont(OP_SYSTEM_FONT_UI_PANEL);
	
	AddChild(m_transfers_view, TRUE);

	RETURN_IF_ERROR(OpGroup::Construct(&m_item_details_group));
	AddChild(m_item_details_group, TRUE);
	m_item_details_group->SetSkinned(TRUE);
	m_item_details_group->GetBorderSkin()->SetImage("Transfer Panel Details Skin", "Window Skin");

	RETURN_IF_ERROR(OpLabel::Construct(&m_item_details_from_label));
	m_item_details_from_label->SetSystemFont(OP_SYSTEM_FONT_UI_PANEL);
	m_item_details_group->AddChild(m_item_details_from_label, TRUE);
	RETURN_IF_ERROR(OpLabel::Construct(&m_item_details_to_label));
	m_item_details_to_label->SetSystemFont(OP_SYSTEM_FONT_UI_PANEL);
	m_item_details_group->AddChild(m_item_details_to_label, TRUE);
	RETURN_IF_ERROR(OpLabel::Construct(&m_item_details_size_label));
	m_item_details_size_label->SetSystemFont(OP_SYSTEM_FONT_UI_PANEL);
	m_item_details_group->AddChild(m_item_details_size_label, TRUE);
	RETURN_IF_ERROR(OpLabel::Construct(&m_item_details_transferred_label));
	m_item_details_transferred_label->SetSystemFont(OP_SYSTEM_FONT_UI_PANEL);
	m_item_details_group->AddChild(m_item_details_transferred_label, TRUE);
	RETURN_IF_ERROR(OpLabel::Construct(&m_item_details_connections_label));
	m_item_details_connections_label->SetSystemFont(OP_SYSTEM_FONT_UI_PANEL);
	m_item_details_group->AddChild(m_item_details_connections_label, TRUE);
	RETURN_IF_ERROR(OpLabel::Construct(&m_item_details_activetransfers_label));
	m_item_details_activetransfers_label->SetSystemFont(OP_SYSTEM_FONT_UI_PANEL);
	m_item_details_group->AddChild(m_item_details_activetransfers_label, TRUE);
	RETURN_IF_ERROR(OpEdit::Construct(&m_item_details_from_info_label));
	m_item_details_from_info_label->SetSystemFont(OP_SYSTEM_FONT_UI_PANEL);
	m_item_details_from_info_label->SetForceTextLTR(TRUE);
	m_item_details_group->AddChild(m_item_details_from_info_label, TRUE);
	m_item_details_from_info_label->SetFlatMode();
	RETURN_IF_ERROR(OpEdit::Construct(&m_item_details_to_info_label));
	m_item_details_to_info_label->SetSystemFont(OP_SYSTEM_FONT_UI_PANEL);
	m_item_details_to_info_label->SetForceTextLTR(TRUE);
	m_item_details_group->AddChild(m_item_details_to_info_label, TRUE);
	m_item_details_to_info_label->SetFlatMode();
	RETURN_IF_ERROR(OpEdit::Construct(&m_item_details_size_info_label));
	m_item_details_size_info_label->SetSystemFont(OP_SYSTEM_FONT_UI_PANEL);
	m_item_details_group->AddChild(m_item_details_size_info_label, TRUE);
	m_item_details_size_info_label->SetFlatMode();
	RETURN_IF_ERROR(OpEdit::Construct(&m_item_details_transferred_info_label));
	m_item_details_transferred_info_label->SetSystemFont(OP_SYSTEM_FONT_UI_PANEL);
	m_item_details_group->AddChild(m_item_details_transferred_info_label, TRUE);
	m_item_details_transferred_info_label->SetFlatMode();
	RETURN_IF_ERROR(OpEdit::Construct(&m_item_details_connections_info_label));
	m_item_details_connections_info_label->SetSystemFont(OP_SYSTEM_FONT_UI_PANEL);
	m_item_details_group->AddChild(m_item_details_connections_info_label, TRUE);
	m_item_details_connections_info_label->SetFlatMode();
	RETURN_IF_ERROR(OpEdit::Construct(&m_item_details_activetransfers_info_label));
	m_item_details_activetransfers_info_label->SetSystemFont(OP_SYSTEM_FONT_UI_PANEL);
	m_item_details_group->AddChild(m_item_details_activetransfers_info_label, TRUE);
	m_item_details_activetransfers_info_label->SetFlatMode();

	SetToolbarName("Transfers Panel Toolbar", "Transfers Full Toolbar");
	SetName("Transfers");

	m_showdetails = g_pcui->GetIntegerPref(PrefsCollectionUI::TransWinShowDetails);

	m_show_extra_info = FALSE;

	m_transfers_view->SetListener(this);

	OpString ui_text;

	g_languageManager->GetString(Str::DI_IDL_SOURCE, ui_text);
	m_item_details_from_label->SetLabel(ui_text.CStr());

	g_languageManager->GetString(Str::DI_IDL_DESTINATION, ui_text);
	m_item_details_to_label->SetLabel(ui_text.CStr());

	g_languageManager->GetString(Str::DI_IDL_SIZE, ui_text);
	m_item_details_size_label->SetLabel(ui_text.CStr());

	g_languageManager->GetString(Str::DI_IDL_TRANSFERED, ui_text);
	m_item_details_transferred_label->SetLabel(ui_text.CStr());

	g_languageManager->GetString(Str::S_TRANSFERS_PANEL_CONNECTION_SHORT, ui_text);
	m_item_details_connections_label->SetLabel(ui_text.CStr());

	g_languageManager->GetString(Str::S_TRANSFERS_PANEL_ACTIVE_TRANSFERS, ui_text);
	m_item_details_activetransfers_label->SetLabel(ui_text.CStr());

	m_transfers_view->SetMultiselectable(TRUE);
#ifdef WINDOW_COMMANDER_TRANSFER
	m_transfers_view->SetTreeModel((OpTreeModel *)g_desktop_transfer_manager);
#endif // WINDOW_COMMANDER_TRANSFER

	m_transfers_view->SetColumnWeight(1, 250);
	m_transfers_view->SetColumnFixedWidth(0, 18);
	m_transfers_view->SetVisibility(TRUE);

	if(g_pcui->GetIntegerPref(PrefsCollectionUI::EnableDrag)&DRAG_BOOKMARK)
	{
		m_transfers_view->SetDragEnabled(TRUE);
	}

	m_transfers_view->SetSelectedItem(g_pcui->GetIntegerPref(PrefsCollectionUI::TransferItemsAddedOnTop) ? 0 : m_transfers_view->GetItemCount() - 1 );
	m_transfers_view->SetFocus(FOCUS_REASON_OTHER);

	m_item_details_from_info_label->SetListener(&m_widgetlistener);
	m_item_details_to_info_label->SetListener(&m_widgetlistener);
	m_item_details_size_info_label->SetListener(&m_widgetlistener);
	m_item_details_transferred_info_label->SetListener(&m_widgetlistener);
	m_item_details_connections_info_label->SetListener(&m_widgetlistener);
	m_item_details_activetransfers_info_label->SetListener(&m_widgetlistener);

	m_transfers_view->SetThreadColumn(1);

	return OpStatus::OK;
}
示例#17
0
//=====================================================================================
//  Window to control camera
//=====================================================================================
CFuiCamControl::CFuiCamControl(Tag idn, const char *filename)
:CFuiWindow(idn,filename,240,180,0)
{	SetProperty(FUI_TRANSPARENT);
	SetProperty(FUI_NO_BORDER);
	//---- Set the back bitmap ----------------------
	SetBackPicture("CamControl.bmp");
	CFuiWindow::ReadFinished();
	//----Create all buttons ------------------------
	U_INT col = MakeRGBA(255,255,255,255);
	lrot	= new CFuiLabel (43,48,47,19,this);
	lrot->RazProperty(FUI_NO_BORDER);
	lrot->SetColour(col);
	AddChild('lrot',lrot,"");
	rtlf  = new CFuiButton( 6,48,36,20,this); 
  AddChild('rtlf',rtlf,"-",FUI_REPEAT_BT);
	rtrt  = new CFuiButton(91,48,36,20,this);
	AddChild('rtrt',rtrt,"+",FUI_REPEAT_BT);
	rtup  = new CFuiButton(40,26,52,20,this);
	AddChild('rtup',rtup,"+",FUI_REPEAT_BT);
	rtdn  = new CFuiButton(40,68,52,20,this);
	AddChild('rtdn',rtdn,"-",FUI_REPEAT_BT);
	//----Create range items ------------------------
  lrng  = new CFuiLabel (168,48,36,19,this);
	lrng->RazProperty(FUI_NO_BORDER);
	lrng->SetColour(col);
	AddChild('lrng',lrng,"");

	rnut  = new CFuiButton(168,26,36,20,this);  
  AddChild('rnut',rnut,"+",FUI_REPEAT_BT);
	rnin  = new CFuiButton(168,68,36,20,this);  
  AddChild('rnin',rnin,"-",FUI_REPEAT_BT);
	//----Create zoom items -------------------------
	lzom  = new CFuiLabel (101,130,38,19,this);
	lzom->RazProperty(FUI_NO_BORDER);
	lzom->SetColour(col);
	AddChild('lzom',lzom,"");
	zmin  = new CFuiButton( 64,129,36,20,this); 
	AddChild('zmin',zmin,"-",FUI_REPEAT_BT);
	zmup  = new CFuiButton(140,129,36,20,this); 
	AddChild('zmup',zmup,"+",FUI_REPEAT_BT);

}
示例#18
0
MainWin::MainWin(BRect frame_rect)
	:
	BWindow(frame_rect, B_TRANSLATE_SYSTEM_NAME(NAME), B_TITLED_WINDOW,
 	B_ASYNCHRONOUS_CONTROLS /* | B_WILL_ACCEPT_FIRST_CLICK */)
 ,	fController(new Controller)
 ,	fIsFullscreen(false)
 ,	fKeepAspectRatio(true)
 ,	fAlwaysOnTop(false)
 ,	fNoMenu(false)
 ,	fNoBorder(false)
 ,	fSourceWidth(720)
 ,	fSourceHeight(576)
 ,	fWidthScale(1.0)
 ,	fHeightScale(1.0)
 ,	fMouseDownTracking(false)
 ,	fFrameResizedTriggeredAutomatically(false)
 ,	fIgnoreFrameResized(false)
 ,	fFrameResizedCalled(true)
{
	BRect rect = Bounds();

	// background
	fBackground = new BView(rect, "background", B_FOLLOW_ALL,
		B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE);
	fBackground->SetViewColor(0,0,0);
	AddChild(fBackground);

	// menu
	fMenuBar = new BMenuBar(fBackground->Bounds(), "menu");
	CreateMenu();
	fBackground->AddChild(fMenuBar);
	fMenuBar->ResizeToPreferred();
	fMenuBarHeight = (int)fMenuBar->Frame().Height() + 1;
	fMenuBar->SetResizingMode(B_FOLLOW_TOP | B_FOLLOW_LEFT_RIGHT);

	// video view
	BRect video_rect = BRect(0, fMenuBarHeight, rect.right, rect.bottom);
	fVideoView = new VideoView(video_rect, "video display", B_FOLLOW_ALL,
		B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE);
	fBackground->AddChild(fVideoView);

	fVideoView->MakeFocus();

//	SetSizeLimits(fControlViewMinWidth - 1, 32767,
//		fMenuBarHeight + fControlViewHeight - 1, fMenuBarHeight
//		+ fControlViewHeight - 1);

//	SetSizeLimits(320 - 1, 32767, 240 + fMenuBarHeight - 1, 32767);

	SetSizeLimits(0, 32767, fMenuBarHeight - 1, 32767);

	fController->SetVideoView(fVideoView);
	fController->SetVideoNode(fVideoView->Node());

	fVideoView->IsOverlaySupported();

	SetupInterfaceMenu();
	SelectInitialInterface();
	SetInterfaceMenuMarker();
	SetupChannelMenu();
	SetChannelMenuMarker();

	VideoFormatChange(fSourceWidth, fSourceHeight, fWidthScale, fHeightScale);

	CenterOnScreen();
}
示例#19
0
ShowImageWindow::ShowImageWindow(BRect frame, const entry_ref& ref,
	const BMessenger& trackerMessenger)
	:
	BWindow(frame, "", B_DOCUMENT_WINDOW, B_AUTO_UPDATE_SIZE_LIMITS),
	fNavigator(ref, trackerMessenger),
	fSavePanel(NULL),
	fBar(NULL),
	fBrowseMenu(NULL),
	fGoToPageMenu(NULL),
	fSlideShowDelayMenu(NULL),
	fToolBar(NULL),
	fImageView(NULL),
	fStatusView(NULL),
	fProgressWindow(new ProgressWindow()),
	fModified(false),
	fFullScreen(false),
	fShowCaption(true),
	fShowToolBar(true),
	fPrintSettings(NULL),
	fSlideShowRunner(NULL),
	fSlideShowDelay(kDefaultSlideShowDelay)
{
	_ApplySettings();

	SetLayout(new BGroupLayout(B_VERTICAL, 0));

	// create menu bar
	fBar = new BMenuBar("menu_bar");
	_AddMenus(fBar);
	float menuBarMinWidth = fBar->MinSize().width;
	AddChild(fBar);

	// Add a content view so the tool bar can be moved outside of the
	// visible portion without colliding with the menu bar.

	BView* contentView = new BView(BRect(), "content", B_FOLLOW_NONE, 0);
	contentView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	contentView->SetExplicitMinSize(BSize(250, 100));
	AddChild(contentView);

	// Create the tool bar
	BRect viewFrame = contentView->Bounds();
	viewFrame.right -= B_V_SCROLL_BAR_WIDTH;
	fToolBar = new BToolBar(viewFrame);

	// Add the tool icons.

//	fToolBar->AddAction(MSG_FILE_OPEN, be_app,
//		tool_bar_icon(kIconDocumentOpen), B_TRANSLATE("Open" B_UTF8_ELLIPSIS));
	fToolBar->AddAction(MSG_FILE_PREV, this,
		tool_bar_icon(kIconGoPrevious), B_TRANSLATE("Previous file"), false);
	fToolBar->AddAction(MSG_FILE_NEXT, this, tool_bar_icon(kIconGoNext),
		B_TRANSLATE("Next file"), false);
	BMessage* fullScreenSlideShow = new BMessage(MSG_SLIDE_SHOW);
	fullScreenSlideShow->AddBool("full screen", true);
	fToolBar->AddAction(fullScreenSlideShow, this,
		tool_bar_icon(kIconMediaMovieLibrary), B_TRANSLATE("Slide show"),
		false);
	fToolBar->AddSeparator();
	fToolBar->AddAction(MSG_SELECTION_MODE, this,
		tool_bar_icon(kIconDrawRectangularSelection),
		B_TRANSLATE("Selection mode"), false);
	fToolBar->AddSeparator();
	fToolBar->AddAction(kMsgOriginalSize, this,
		tool_bar_icon(kIconZoomOriginal), B_TRANSLATE("Original size"), true);
	fToolBar->AddAction(kMsgFitToWindow, this,
		tool_bar_icon(kIconZoomFitBest), B_TRANSLATE("Fit to window"), false);
	fToolBar->AddAction(MSG_ZOOM_IN, this, tool_bar_icon(kIconZoomIn),
		B_TRANSLATE("Zoom in"), false);
	fToolBar->AddAction(MSG_ZOOM_OUT, this, tool_bar_icon(kIconZoomOut),
		B_TRANSLATE("Zoom out"), false);
	fToolBar->AddSeparator();
	fToolBar->AddAction(MSG_PAGE_PREV, this, tool_bar_icon(kIconPagePrevious),
		B_TRANSLATE("Previous page"), false);
	fToolBar->AddAction(MSG_PAGE_NEXT, this, tool_bar_icon(kIconPageNext),
		B_TRANSLATE("Next page"), false);
	fToolBar->AddGlue();
	fToolBar->AddAction(MSG_FULL_SCREEN, this,
		tool_bar_icon(kIconViewWindowed), B_TRANSLATE("Leave full screen"),
		false);
	fToolBar->SetActionVisible(MSG_FULL_SCREEN, false);

	fToolBar->ResizeTo(viewFrame.Width(), fToolBar->MinSize().height);

	contentView->AddChild(fToolBar);

	if (fShowToolBar)
		viewFrame.top = fToolBar->Frame().bottom + 1;
	else
		fToolBar->Hide();

	fToolBarVisible = fShowToolBar;

	viewFrame.bottom = contentView->Bounds().bottom;
	viewFrame.bottom -= B_H_SCROLL_BAR_HEIGHT;

	// create the image view
	fImageView = new ShowImageView(viewFrame, "image_view", B_FOLLOW_ALL,
		B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE | B_PULSE_NEEDED
			| B_FRAME_EVENTS);
	// wrap a scroll view around the view
	fScrollView = new BScrollView("image_scroller", fImageView,
		B_FOLLOW_ALL, 0, true, true, B_PLAIN_BORDER);
	contentView->AddChild(fScrollView);

	fStatusView = new ShowImageStatusView(fScrollView);
	fScrollView->AddChild(fStatusView);

	// Update minimum window size
	float toolBarMinWidth = fToolBar->MinSize().width;
	SetSizeLimits(std::max(menuBarMinWidth, toolBarMinWidth), 100000, 100,
		100000);

	// finish creating the window
	if (_LoadImage() != B_OK) {
		_LoadError(ref);
		Quit();
		return;
	}

	// add View menu here so it can access ShowImageView methods
	BMenu* menu = new BMenu(B_TRANSLATE_CONTEXT("View", "Menus"));
	_BuildViewMenu(menu, false);
	fBar->AddItem(menu);

	fBar->AddItem(_BuildRatingMenu());

	SetPulseRate(100000);
		// every 1/10 second; ShowImageView needs it for marching ants

	_MarkMenuItem(menu, MSG_SELECTION_MODE,
		fImageView->IsSelectionModeEnabled());

	// Tell application object to query the clipboard
	// and tell this window if it contains interesting data or not
	be_app_messenger.SendMessage(B_CLIPBOARD_CHANGED);

	// The window will be shown on screen automatically
	Run();
}
示例#20
0
StatusView::StatusView()
	:
	BView(NULL, B_WILL_DRAW),
	fCurrentFileInfo(NULL)
{
	SetViewColor(kPieBGColor);
	SetLowColor(kPieBGColor);

	fSizeView = new BStringView(NULL, kEmptyStr);
	fSizeView->SetExplicitMinSize(BSize(StringWidth("9999.99 GiB"),
		B_SIZE_UNSET));
	fSizeView->SetExplicitMaxSize(BSize(StringWidth("9999.99 GiB"),
		B_SIZE_UNSET));

	char testLabel[256];
	snprintf(testLabel, sizeof(testLabel), B_TRANSLATE_COMMENT("%d files",
		"For UI layouting only, use the longest plural form for your language"),
		999999);

	fCountView = new BStringView(NULL, kEmptyStr);
	float width, height;
	fCountView->GetPreferredSize(&width, &height);
	fCountView->SetExplicitMinSize(BSize(StringWidth(testLabel),
		B_SIZE_UNSET));
	fCountView->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, height));

	fPathView = new BStringView(NULL, kEmptyStr);
	fPathView->GetPreferredSize(&width, &height);
	fPathView->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, height));

	fRefreshBtn = new BButton(NULL, B_TRANSLATE("Scan"),
		new BMessage(kBtnRescan));

	fRefreshBtn->SetExplicitMaxSize(BSize(B_SIZE_UNSET, B_SIZE_UNLIMITED));

	BBox* divider1 = new BBox(BRect(), B_EMPTY_STRING, B_FOLLOW_ALL_SIDES,
		B_WILL_DRAW | B_FRAME_EVENTS, B_FANCY_BORDER);

	BBox* divider2 = new BBox(BRect(), B_EMPTY_STRING, B_FOLLOW_ALL_SIDES,
		B_WILL_DRAW | B_FRAME_EVENTS, B_FANCY_BORDER);

	divider1->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, 1));
	divider2->SetExplicitMaxSize(BSize(1, B_SIZE_UNLIMITED));

	SetLayout(new BGroupLayout(B_VERTICAL));

	AddChild(BLayoutBuilder::Group<>(B_HORIZONTAL, 0)
		.AddGroup(B_VERTICAL, 0)
			.Add(fPathView)
			.Add(divider1)
			.AddGroup(B_HORIZONTAL, 0)
				.Add(fCountView)
				.Add(divider2)
				.Add(fSizeView)
				.End()
			.End()
		.AddStrut(kSmallHMargin)
		.Add(fRefreshBtn)
		.SetInsets(kSmallVMargin, kSmallVMargin, kSmallVMargin, kSmallVMargin)
	);
}
示例#21
0
SerialWindow::SerialWindow()
	: BWindow(BRect(100, 100, 400, 400), SerialWindow::kWindowTitle,
		B_DOCUMENT_WINDOW, B_QUIT_ON_WINDOW_CLOSE | B_AUTO_UPDATE_SIZE_LIMITS)
	, fLogFilePanel(NULL)
{
	BMenuBar* menuBar = new BMenuBar(Bounds(), "menuBar");
	menuBar->ResizeToPreferred();

	BRect r = Bounds();
	r.top = menuBar->Bounds().bottom + 1;
	r.right -= B_V_SCROLL_BAR_WIDTH;
	fTermView = new TermView(r);
	fTermView->ResizeToPreferred();

	r = fTermView->Frame();
	r.left = r.right + 1;
	r.right = r.left + B_V_SCROLL_BAR_WIDTH;
	r.top -= 1;
	r.bottom -= B_H_SCROLL_BAR_HEIGHT - 1;
	BScrollBar* scrollBar = new BScrollBar(r, "scrollbar", NULL, 0, 0,
		B_VERTICAL);

	scrollBar->SetTarget(fTermView);

	ResizeTo(r.right - 1, r.bottom + B_H_SCROLL_BAR_HEIGHT - 1);

	AddChild(menuBar);
	AddChild(fTermView);
	AddChild(scrollBar);

	fConnectionMenu = new BMenu("Connection");
	BMenu* fileMenu = new BMenu("File");
	BMenu* settingsMenu = new BMenu("Settings");

	fConnectionMenu->SetRadioMode(true);

	menuBar->AddItem(fConnectionMenu);
	menuBar->AddItem(fileMenu);
	menuBar->AddItem(settingsMenu);

	// TODO edit menu - what's in it ?
	//BMenu* editMenu = new BMenu("Edit");
	//menuBar->AddItem(editMenu);

	BMenuItem* logFile = new BMenuItem("Log to file" B_UTF8_ELLIPSIS,
		new BMessage(kMsgLogfile));
	fileMenu->AddItem(logFile);
#if 0
	// TODO implement these
	BMenuItem* xmodemSend = new BMenuItem("X/Y/ZModem send" B_UTF8_ELLIPSIS,
		NULL);
	fileMenu->AddItem(xmodemSend);
	BMenuItem* xmodemReceive = new BMenuItem(
		"X/Y/Zmodem receive" B_UTF8_ELLIPSIS, NULL);
	fileMenu->AddItem(xmodemReceive);
#endif

	// Configuring all this by menus may be a bit unhandy. Make a setting
	// window instead ?
	fBaudrateMenu = new BMenu("Baud rate");
	fBaudrateMenu->SetRadioMode(true);
	settingsMenu->AddItem(fBaudrateMenu);

	fParityMenu = new BMenu("Parity");
	fParityMenu->SetRadioMode(true);
	settingsMenu->AddItem(fParityMenu);

	fStopbitsMenu = new BMenu("Stop bits");
	fStopbitsMenu->SetRadioMode(true);
	settingsMenu->AddItem(fStopbitsMenu);

	fFlowcontrolMenu = new BMenu("Flow control");
	fFlowcontrolMenu->SetRadioMode(true);
	settingsMenu->AddItem(fFlowcontrolMenu);

	fDatabitsMenu = new BMenu("Data bits");
	fDatabitsMenu->SetRadioMode(true);
	settingsMenu->AddItem(fDatabitsMenu);


	BMessage* message = new BMessage(kMsgSettings);
	message->AddInt32("parity", B_NO_PARITY);
	BMenuItem* parityNone = new BMenuItem("None", message);

	message = new BMessage(kMsgSettings);
	message->AddInt32("parity", B_ODD_PARITY);
	BMenuItem* parityOdd = new BMenuItem("Odd", message);

	message = new BMessage(kMsgSettings);
	message->AddInt32("parity", B_EVEN_PARITY);
	BMenuItem* parityEven = new BMenuItem("Even", message);

	fParityMenu->AddItem(parityNone);
	fParityMenu->AddItem(parityOdd);
	fParityMenu->AddItem(parityEven);
	fParityMenu->SetTargetForItems(be_app);

	message = new BMessage(kMsgSettings);
	message->AddInt32("databits", B_DATA_BITS_7);
	BMenuItem* data7 = new BMenuItem("7", message);

	message = new BMessage(kMsgSettings);
	message->AddInt32("databits", B_DATA_BITS_8);
	BMenuItem* data8 = new BMenuItem("8", message);

	fDatabitsMenu->AddItem(data7);
	fDatabitsMenu->AddItem(data8);
	fDatabitsMenu->SetTargetForItems(be_app);

	message = new BMessage(kMsgSettings);
	message->AddInt32("stopbits", B_STOP_BITS_1);
	BMenuItem* stop1 = new BMenuItem("1", message);

	message = new BMessage(kMsgSettings);
	message->AddInt32("stopbits", B_STOP_BITS_2);
	BMenuItem* stop2 = new BMenuItem("2", message);

	fStopbitsMenu->AddItem(stop1);
	fStopbitsMenu->AddItem(stop2);
	fStopbitsMenu->SetTargetForItems(be_app);

	// Loop backwards to add fastest rates at top of menu
	for (int i = sizeof(kBaudrates) / sizeof(char*); --i >= 0;)
	{
		message = new BMessage(kMsgSettings);
		message->AddInt32("baudrate", kBaudrateConstants[i]);

		char buffer[7];
		sprintf(buffer, "%d", kBaudrates[i]);
		BMenuItem* item = new BMenuItem(buffer, message);

		fBaudrateMenu->AddItem(item);
	}

	fBaudrateMenu->SetTargetForItems(be_app);

	message = new BMessage(kMsgSettings);
	message->AddInt32("flowcontrol", B_HARDWARE_CONTROL);
	BMenuItem* hardware = new BMenuItem("Hardware", message);

	message = new BMessage(kMsgSettings);
	message->AddInt32("flowcontrol", B_SOFTWARE_CONTROL);
	BMenuItem* software = new BMenuItem("Software", message);

	message = new BMessage(kMsgSettings);
	message->AddInt32("flowcontrol", B_HARDWARE_CONTROL | B_SOFTWARE_CONTROL);
	BMenuItem* both = new BMenuItem("Both", message);

	message = new BMessage(kMsgSettings);
	message->AddInt32("flowcontrol", 0);
	BMenuItem* noFlow = new BMenuItem("None", message);

	fFlowcontrolMenu->AddItem(hardware);
	fFlowcontrolMenu->AddItem(software);
	fFlowcontrolMenu->AddItem(both);
	fFlowcontrolMenu->AddItem(noFlow);
	fFlowcontrolMenu->SetTargetForItems(be_app);

	CenterOnScreen();
}
示例#22
0
// ---------------------------------------------------------------
// Constructor
//
// Sets up the view settings
//
// Preconditions:
//
// Parameters:
//
// Postconditions:
//
// Returns:
// ---------------------------------------------------------------
SlideShowConfigView::SlideShowConfigView(const BRect &frame, const char *name,
	uint32 resize, uint32 flags, LiveSettings *settings)
	:	BView(frame, name, resize, flags)
{
	fSettings = settings;

	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	BMessage *pMsg;
	int32 val;

	// Show Caption checkbox
	pMsg = new BMessage(CHANGE_CAPTION);
	fShowCaption = new BCheckBox(BRect(10, 45, 180, 62),
		"Show caption", "Show caption", pMsg);
	val = (fSettings->SetGetBool(SAVER_SETTING_CAPTION)) ? 1 : 0;
	fShowCaption->SetValue(val);
	fShowCaption->SetViewColor(ViewColor());
	AddChild(fShowCaption);

	// Change Border checkbox
	pMsg = new BMessage(CHANGE_BORDER);
	fShowBorder = new BCheckBox(BRect(10, 70, 180, 87),
		"Show border", "Show border", pMsg);
	val = (fSettings->SetGetBool(SAVER_SETTING_BORDER)) ? 1 : 0;
	fShowBorder->SetValue(val);
	fShowBorder->SetViewColor(ViewColor());
	AddChild(fShowBorder);

	// Delay Menu
	// setup PNG interlace options menu
	int32 currentDelay = fSettings->SetGetInt32(SAVER_SETTING_DELAY) / 1000;
	fDelayMenu = new BPopUpMenu("Delay menu");
	struct DelayItem {
		const char *name;
		int32 delay;
	};
	DelayItem items[] = {
		{"No delay",	0},
		{"1 second",	1},
		{"2 seconds",	2},
		{"3 seconds",	3},
		{"4 seconds",	4},
		{"5 seconds",	5},
		{"6 seconds",	6},
		{"7 seconds",	7},
		{"8 seconds",	8},
		{"9 seconds",	9},
		{"10 seconds",	10},
		{"15 seconds",	15},
		{"20 seconds",	20},
		{"30 seconds",	30},
		{"1 minute",	1 * 60},
		{"2 minutes",	2 * 60},
		{"5 minutes",	5 * 60},
		{"10 minutes",	10 * 60},
		{"15 minutes",	15 * 60}
	};
	for (uint32 i = 0; i < sizeof(items) / sizeof(DelayItem); i++) {
		BMenuItem *menuItem =
			new BMenuItem(items[i].name, delay_msg(items[i].delay));
		fDelayMenu->AddItem(menuItem);
		if (items[i].delay == currentDelay)
			menuItem->SetMarked(true);
	}
	fDelayMenuField = new BMenuField(BRect(10, 100, 180, 120),
		"Delay Menu Field", "Delay:", fDelayMenu);
	fDelayMenuField->SetViewColor(ViewColor());
	fDelayMenuField->SetDivider(40);
	AddChild(fDelayMenuField);

	// Choose Image Folder button
	pMsg = new BMessage(CHOOSE_DIRECTORY);
	fChooseFolder = new BButton(BRect(50, 160, 180, 180),
		"Choose Folder", "Choose image folder" B_UTF8_ELLIPSIS, pMsg);
	AddChild(fChooseFolder);

	// Setup choose folder file panel
	pMsg = new BMessage(CHANGE_DIRECTORY);
	fFilePanel = new BFilePanel(B_OPEN_PANEL, NULL, (const entry_ref *) NULL,
		B_DIRECTORY_NODE, false, pMsg, NULL, true, true);
	fFilePanel->SetButtonLabel(B_DEFAULT_BUTTON, "Select");
	delete pMsg;
}
/*
========================
idMenuScreen_Shell_MatchSettings::Initialize
========================
*/
void idMenuScreen_Shell_MatchSettings::Initialize( idMenuHandler * data ) {
	idMenuScreen::Initialize( data );

	if ( data != NULL ) {
		menuGUI = data->GetGUI();
	}

	SetSpritePath( "menuMatchSettings" );

	options = new (TAG_SWF) idMenuWidget_DynamicList();
	options->SetNumVisibleOptions( NUM_GAME_OPTIONS_OPTIONS );
	options->SetSpritePath( GetSpritePath(), "info", "options" );
	options->SetWrappingAllowed( true );
	options->SetControlList( true );
	options->Initialize( data );
	AddChild( options );

	btnBack = new (TAG_SWF) idMenuWidget_Button();
	btnBack->Initialize( data );
	btnBack->SetLabel( "#str_swf_multiplayer" );
	btnBack->SetSpritePath( GetSpritePath(), "info", "btnBack" );
	btnBack->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_GO_BACK );
	AddChild( btnBack );

	idMenuWidget_ControlButton * control;
	control = new (TAG_SWF) idMenuWidget_ControlButton();
	control->SetOptionType( OPTION_SLIDER_TEXT );
	control->SetLabel( "#str_swf_mode" );	// Mode
	control->SetDataSource( &matchData, idMenuDataSource_MatchSettings::MATCH_FIELD_MODE );
	control->SetupEvents( DEFAULT_REPEAT_TIME, options->GetChildren().Num() );
	control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_PRESS_FOCUSED, options->GetChildren().Num() );
	options->AddChild( control );

	control = new (TAG_SWF) idMenuWidget_ControlButton();
	control->SetOptionType( OPTION_SLIDER_TEXT );
	control->SetLabel( "#str_02049" );	// Map
	control->SetDataSource( &matchData, idMenuDataSource_MatchSettings::MATCH_FIELD_MAP );
	control->SetupEvents( DEFAULT_REPEAT_TIME, options->GetChildren().Num() );
	control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_PRESS_FOCUSED, options->GetChildren().Num() );
	options->AddChild( control );

	control = new (TAG_SWF) idMenuWidget_ControlButton();
	control->SetOptionType( OPTION_SLIDER_TEXT );
	control->SetLabel( "#str_02183" );	// Time
	control->SetDataSource( &matchData, idMenuDataSource_MatchSettings::MATCH_FIELD_TIME );
	control->SetupEvents( DEFAULT_REPEAT_TIME, options->GetChildren().Num() );
	control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_PRESS_FOCUSED, options->GetChildren().Num() );
	options->AddChild( control );

	control = new (TAG_SWF) idMenuWidget_ControlButton();
	control->SetOptionType( OPTION_SLIDER_TEXT );
	control->SetLabel( "#str_00100917" );	// Score
	control->SetDataSource( &matchData, idMenuDataSource_MatchSettings::MATCH_FIELD_SCORE );
	control->SetupEvents( DEFAULT_REPEAT_TIME, options->GetChildren().Num() );
	control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_PRESS_FOCUSED, options->GetChildren().Num() );
	options->AddChild( control );

	options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER, WIDGET_EVENT_SCROLL_DOWN ) );
	options->AddEventAction( WIDGET_EVENT_SCROLL_UP ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER, WIDGET_EVENT_SCROLL_UP ) );
	options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_RELEASE ) );
	options->AddEventAction( WIDGET_EVENT_SCROLL_UP_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_RELEASE ) );
	options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER, WIDGET_EVENT_SCROLL_DOWN_LSTICK ) );
	options->AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER, WIDGET_EVENT_SCROLL_UP_LSTICK ) );
	options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ) );
	options->AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ) );
}
示例#24
0
void
ClientWindowDock::AddWinList (void)
{
	fWinListAgent = new AgentDockWinList (fWorkingFrame);
	AddChild (fWinListAgent);
}
示例#25
0
void 
DialogPane::SetMode(int32 mode, bool initialSetup)
{
	ASSERT(mode < 3 && mode >= 0);
	
	if (!initialSetup && mode == fMode)
		return;
	
	int32 oldMode = fMode;
	fMode = mode;
	
	bool followBottom = (ResizingMode() & B_FOLLOW_BOTTOM) != 0;
	// if we are follow bottom, we will move ourselves, need to place us back
	float bottomOffset = 0;
	if (followBottom)
		bottomOffset = Window()->Bounds().bottom - Frame().bottom;

	BRect newBounds(BoundsForMode(fMode));
	if (!initialSetup)
		ResizeParentWindow(fMode, oldMode);

	ResizeTo(newBounds.Width(), newBounds.Height());

	float delta = 0;
	if (followBottom)
		delta = (Window()->Bounds().bottom - Frame().bottom) - bottomOffset;
	
	if (delta != 0) {
		MoveBy(0, delta);
		if (fLatch && (fLatch->ResizingMode() & B_FOLLOW_BOTTOM))
			fLatch->MoveBy(0, delta);			
	}

	switch (fMode) {
		case 0:
			{
				if (oldMode > 1)
					fMode3Items.RemoveAll(this);
				if (oldMode > 0)
					fMode2Items.RemoveAll(this);
				
				BView *separator = FindView("separatorLine");
				if (separator) {
					BRect frame(separator->Frame());
					frame.InsetBy(-1, -1);
					RemoveChild(separator);
					Invalidate();
				}
					
				AddChild(new SeparatorLine(BPoint(newBounds.left, newBounds.top
					+ newBounds.Height() / 2), newBounds.Width(), false,
					"separatorLine"));
			}
			break;
		case 1:
			{
				if (oldMode > 1) 
					fMode3Items.RemoveAll(this);
				else 
					fMode2Items.AddAll(this);

				BView *separator = FindView("separatorLine");
				if (separator) {
					BRect frame(separator->Frame());
					frame.InsetBy(-1, -1);
					RemoveChild(separator);
					Invalidate();
				}
			}
			break;						
		case 2:
			{
				fMode3Items.AddAll(this);
				if (oldMode < 1) 
					fMode2Items.AddAll(this);
	
				BView *separator = FindView("separatorLine");
				if (separator) {
					BRect frame(separator->Frame());
					frame.InsetBy(-1, -1);
					RemoveChild(separator);
					Invalidate();
				}
			}
			break;						
	}
}
示例#26
0
void Streamer::Init()
{
    
    //Game* game = (Game*)g_pSceneManager->Find("game");
	initAudio("128.198.85.100", 8000);
	s3eDeviceRegister(S3E_DEVICE_EXIT, &exitCB, 0);
    
    facebook = new CSprite();
    facebook->SetImage(g_pResources->getFacebook());
    facebook->m_X = (float)IwGxGetScreenWidth() / 1.4;
    facebook->m_Y = (float)IwGxGetScreenHeight() / 16;
    facebook->m_W = facebook->GetImage()->GetWidth();
    facebook->m_H = facebook->GetImage()->GetHeight();
    facebook->m_AnchorX = 0.5;
    facebook->m_AnchorY = 0.5;
    facebook->m_ScaleX = (float)IwGxGetScreenWidth() / facebook->GetImage()->GetWidth() / 8;
    facebook->m_ScaleY = (float)IwGxGetScreenHeight() / facebook->GetImage()->GetHeight() / 12;
    
    twitter = new CSprite();
    twitter->SetImage(g_pResources->getTwitter());
    twitter->m_X = (float)IwGxGetScreenWidth() / 1.1;
    twitter->m_Y = (float)IwGxGetScreenHeight() / 16;
    twitter->m_W = twitter->GetImage()->GetWidth();
    twitter->m_H = twitter->GetImage()->GetHeight();
    twitter->m_AnchorX = 0.5;
    twitter->m_AnchorY = 0.5;
    twitter->m_ScaleX = (float)IwGxGetScreenWidth() / twitter->GetImage()->GetWidth() / 8;
    twitter->m_ScaleY = (float)IwGxGetScreenHeight() / twitter->GetImage()->GetHeight() / 12;

    // Create menu background
    header = new CSprite();
    header->SetImage(g_pResources->getHeader());
    header->m_X = (float)IwGxGetScreenWidth() / 3;
    header->m_Y = (float)IwGxGetScreenHeight() / 17;
    header->m_W = header->GetImage()->GetWidth();
    header->m_H = header->GetImage()->GetHeight();
    header->m_AnchorX = 0.5;
    header->m_AnchorY = 0.5;
    // Fit background to screen size
    header->m_ScaleX = (float)IwGxGetScreenWidth() / header->GetImage()->GetWidth() / 1.5;
    header->m_ScaleY = (float)IwGxGetScreenHeight() / header->GetImage()->GetHeight() / 5;
    
    // Create menu background
    CSprite* whiteBanner = new CSprite();
    whiteBanner->SetImage(g_pResources->getWhiteBanner());
    whiteBanner->m_X = (float)IwGxGetScreenWidth() / 2;
    whiteBanner->m_Y = (float)IwGxGetScreenHeight() / 17;
    
    whiteBanner->m_W = whiteBanner->GetImage()->GetWidth();
    whiteBanner->m_H = whiteBanner->GetImage()->GetHeight();
    whiteBanner->m_AnchorX = 0.5;
    whiteBanner->m_AnchorY = 0.5;
    // Fit background to screen size
    whiteBanner->m_ScaleX = (float)IwGxGetScreenWidth() / whiteBanner->GetImage()->GetWidth() / 1;
    whiteBanner->m_ScaleY = (float)IwGxGetScreenHeight() / whiteBanner->GetImage()->GetHeight() / 5;
    
    // Create menu background
    playWrapper = new CSprite();
    playWrapper->SetImage(g_pResources->getPlayWrapper());
    playWrapper->m_X = (float)IwGxGetScreenWidth() / 2;
    playWrapper->m_Y = (float)IwGxGetScreenHeight() / 1.09;
    playWrapper->m_W = playWrapper->GetImage()->GetWidth();
    playWrapper->m_H = playWrapper->GetImage()->GetHeight();
    playWrapper->m_AnchorX = 0.5;
    playWrapper->m_AnchorY = 0.5;
    //playWrapper->m_Alpha = 0.9;
    // Fit background to screen size
    playWrapper->m_ScaleX = (float)IwGxGetScreenWidth() / playWrapper->GetImage()->GetWidth() / 1;
    playWrapper->m_ScaleY = (float)IwGxGetScreenHeight() / playWrapper->GetImage()->GetHeight() / 6;

    playButton = new CSprite();
    playButton->SetImage(g_pResources->getPlayButton());
    playButton->m_X = (float)IwGxGetScreenWidth() / 2;
    playButton->m_Y = (float)IwGxGetScreenHeight() / 1.13;
    //buttonTop = (float)IwGxGetScreenHeight() / 1.14 - (playButton->GetImage()->GetHeight() / 8);
    playButton->m_W = playButton->GetImage()->GetWidth();
    playButton->m_H = playButton->GetImage()->GetHeight();
    playButton->m_AnchorX = 0.5;
    playButton->m_AnchorY = 0.5;
    // Fit background to screen size
    playButton->m_ScaleX = (float)IwGxGetScreenWidth() / playButton->GetImage()->GetWidth() / 3.2;
    playButton->m_ScaleY = (float)IwGxGetScreenHeight() / playButton->GetImage()->GetHeight() / 4.5;
    
    //buttonTop = ((float)IwGxGetScreenHeight() / 1.14) - (playButton->GetImage()->GetHeight() / 3.7);
    
    stopButton = new CSprite();
    stopButton->SetImage(g_pResources->getStopButton());
    stopButton->m_X = (float)IwGxGetScreenWidth() / 2;
    stopButton->m_Y = (float)IwGxGetScreenHeight() / 1.13;
    stopButton->m_W = stopButton->GetImage()->GetWidth();
    stopButton->m_H = stopButton->GetImage()->GetHeight();
    stopButton->m_AnchorX = 0.5;
    stopButton->m_AnchorY = 0.5;
    // Fit background to screen size
    stopButton->m_ScaleX = (float)IwGxGetScreenWidth() / stopButton->GetImage()->GetWidth() / 3.2;
    stopButton->m_ScaleY = (float)IwGxGetScreenHeight() / stopButton->GetImage()->GetHeight() / 4.5;
    
    banner = new CSprite();
    banner->SetImage(g_pResources->getGreyBanner());
    banner->m_X = (float)IwGxGetScreenWidth() / 2;
    banner->m_Y = (float)IwGxGetScreenHeight() /6;
    banner->m_W = banner->GetImage()->GetWidth();
    banner->m_H = banner->GetImage()->GetHeight();
    banner->m_AnchorX = 0.5;
    banner->m_AnchorY = 0.5;
    // Fit background to screen size
    banner->m_ScaleX = (float)IwGxGetScreenWidth() / banner->GetImage()->GetWidth() / 1;
    banner->m_ScaleY = (float)IwGxGetScreenHeight() / banner->GetImage()->GetHeight() / 8;
    
    buttonTop = IwGxGetScreenHeight() / 4;
    
    labelLeft = new CLabel();
	labelLeft->m_Font = g_pResources->getBannerFontSmall();
	labelLeft->m_Text = "Cal.";
    labelLeft->m_Y = IwGxGetDisplayHeight() / 6.5;
    labelLeft->m_W = IwGxGetDisplayWidth() / 2;
    labelLeft->m_ScaleX = 1.0;
    labelLeft->m_AlignHor = IW_2D_FONT_ALIGN_LEFT;
    labelLeft->m_X += 10;
    labelLeft->m_Color = CColor(114, 114, 114, 0xff);
    
    labelRight = new CLabel();
	labelRight->m_Font = g_pResources->getBannerFontSmall();
	labelRight->m_Text = "Events";
    labelRight->m_Y = IwGxGetDisplayHeight() / 6.5;
    labelRight->m_W = IwGxGetDisplayWidth() / 2;
    labelRight->m_AlignHor = IW_2D_FONT_ALIGN_RIGHT;
    labelRight->m_X += (IwGxGetDisplayWidth() / 2.0) -10;
    labelRight->m_Color = CColor(114, 114, 114, 0xff);
    
    labelMain = new CLabel();
	labelMain->m_Font = g_pResources->getBannerFontLarge();
	labelMain->m_Text = "News";
    labelMain->m_Y = IwGxGetDisplayHeight() / 7.5;
    labelMain->m_W = IwGxGetDisplayWidth();
    labelMain->m_AlignHor = IW_2D_FONT_ALIGN_CENTRE;
    
    AddChild(banner);
    AddChild(whiteBanner);
    AddChild(header);
    AddChild(labelRight);
    AddChild(labelLeft);
    AddChild(playWrapper);
    AddChild(playButton);
    AddChild(stopButton);
    AddChild(labelMain);
    AddChild(facebook);
    AddChild(twitter);
    
    stopButton->m_X = IwGxGetScreenWidth() * 2.0;
    currentPage = 0;
    
    
}
示例#27
0
void 
PasswordWindow::_Setup()
{
	BRect bounds = Bounds();
	BView* topView = new BView(bounds, "topView", B_FOLLOW_ALL, B_WILL_DRAW);
	topView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	AddChild(topView);

	bounds.InsetBy(10.0, 10.0);
	fUseNetwork = new BRadioButton(bounds, "useNetwork", "Use network password",
		new BMessage(kMsgPasswordTypeChanged), B_FOLLOW_NONE);
	topView->AddChild(fUseNetwork);
	fUseNetwork->ResizeToPreferred();
	fUseNetwork->MoveBy(10.0, 0.0);

	bounds.OffsetBy(0.0, fUseNetwork->Bounds().Height());
	BBox *customBox = new BBox(bounds, "customBox", B_FOLLOW_NONE);
	topView->AddChild(customBox);

	fUseCustom = new BRadioButton(BRect(), "useCustom", "Use custom password",
		new BMessage(kMsgPasswordTypeChanged), B_FOLLOW_NONE);
	customBox->SetLabel(fUseCustom);
	fUseCustom->ResizeToPreferred();

	fPasswordControl = new BTextControl(bounds, "passwordControl", "Password:"******"confirmControl", 
		"Confirm password:"******"VeryLongPasswordPossible", B_FOLLOW_NONE);
	customBox->AddChild(fConfirmControl);
	fConfirmControl->TextView()->HideTyping(true);
	fConfirmControl->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);

	float width, height;
	fConfirmControl->GetPreferredSize(&width, &height);
	fPasswordControl->ResizeTo(width, height);
	fConfirmControl->ResizeTo(width, height);
	
	float divider = be_plain_font->StringWidth("Confirm password:"******"done", "Done", new BMessage(kMsgDone));
	topView->AddChild(button);
	button->ResizeToPreferred();

	BRect frame = customBox->Frame();
	button->MoveTo(frame.right - button->Bounds().Width(), frame.bottom + 10.0);

	frame = button->Frame();
	button->MakeDefault(true);

	button = new BButton(frame, "cancel", "Cancel", new BMessage(B_CANCEL));
	topView->AddChild(button);
	button->ResizeToPreferred();
	button->MoveBy(-(button->Bounds().Width() + 10.0), 0.0);

	ResizeTo(customBox->Frame().right + 10.0, frame.bottom + 10.0);
}
示例#28
0
void BGAnimation::LoadFromAniDir( CString sAniDir )
{
	Unload();

	if( sAniDir.empty() )
		 return;

	if( sAniDir.Right(1) != "/" )
		sAniDir += "/";

	ASSERT_M( IsADirectory(sAniDir), sAniDir + " isn't a directory" );

	CString sPathToIni = sAniDir + "BGAnimation.ini";

	if( DoesFileExist(sPathToIni) )
	{
		// This is a new style BGAnimation (using .ini)
		AddLayersFromAniDir( sAniDir, m_SubActors, m_bGeneric );	// TODO: Check for circular load

		IniFile ini;
		ini.ReadFile( sPathToIni );
		if( !ini.GetValue( "BGAnimation", "LengthSeconds", m_fLengthSeconds ) )
		{
			/* XXX: if m_bGeneric, simply constructing the BG layer won't run "On",
			 * so at this point GetMaxTweenTimeLeft is probably 0 */
			m_fLengthSeconds = this->GetTweenTimeLeft();
		}

		bool bUseScroller;
		if( ini.GetValue( "BGAnimation", "UseScroller", bUseScroller ) && bUseScroller )
		{
			// TODO: Move this into ActorScroller
			
#define REQUIRED_GET_VALUE( szName, valueOut ) \
	if( !ini.GetValue( "Scroller", szName, valueOut ) ) \
		Dialog::OK( ssprintf("File '%s' is missing the value Scroller::%s", sPathToIni.c_str(), szName) );

			float fSecondsPerItem = 1;
			int iNumItemsToDraw = 7;
			RageVector3	vRotationDegrees = RageVector3(0,0,0);
			RageVector3	vTranslateTerm0 = RageVector3(0,0,0);
			RageVector3	vTranslateTerm1 = RageVector3(0,0,0);
			RageVector3	vTranslateTerm2 = RageVector3(0,0,0);
			float fItemPaddingStart = 0;
			float fItemPaddingEnd = 0;

			REQUIRED_GET_VALUE( "SecondsPerItem", fSecondsPerItem );
			REQUIRED_GET_VALUE( "NumItemsToDraw", iNumItemsToDraw );
			REQUIRED_GET_VALUE( "RotationDegreesX", vRotationDegrees[0] );
			REQUIRED_GET_VALUE( "RotationDegreesY", vRotationDegrees[1] );
			REQUIRED_GET_VALUE( "RotationDegreesZ", vRotationDegrees[2] );
			REQUIRED_GET_VALUE( "TranslateTerm0X", vTranslateTerm0[0] );
			REQUIRED_GET_VALUE( "TranslateTerm0Y", vTranslateTerm0[1] );
			REQUIRED_GET_VALUE( "TranslateTerm0Z", vTranslateTerm0[2] );
			REQUIRED_GET_VALUE( "TranslateTerm1X", vTranslateTerm1[0] );
			REQUIRED_GET_VALUE( "TranslateTerm1Y", vTranslateTerm1[1] );
			REQUIRED_GET_VALUE( "TranslateTerm1Z", vTranslateTerm1[2] );
			REQUIRED_GET_VALUE( "TranslateTerm2X", vTranslateTerm2[0] );
			REQUIRED_GET_VALUE( "TranslateTerm2Y", vTranslateTerm2[1] );
			REQUIRED_GET_VALUE( "TranslateTerm2Z", vTranslateTerm2[2] );
			REQUIRED_GET_VALUE( "ItemPaddingStart", fItemPaddingStart );
			REQUIRED_GET_VALUE( "ItemPaddingEnd", fItemPaddingEnd );
#undef REQUIRED_GET_VALUE

			ActorScroller::Load( 
				fSecondsPerItem,
				iNumItemsToDraw,
				vRotationDegrees,
				vTranslateTerm0,
				vTranslateTerm1,
				vTranslateTerm2 );
			ActorScroller::SetCurrentAndDestinationItem( int(-fItemPaddingStart) );
			ActorScroller::SetDestinationItem( int(m_SubActors.size()-1+fItemPaddingEnd) );
		}

		CString InitCommand;
		if( ini.GetValue( "BGAnimation", "InitCommand", InitCommand ) )
		{
			/* There's an InitCommand.  Run it now.  This can be used to eg. change Z to
			 * modify draw order between BGAs in a Foreground.  Most things should be done
			 * in metrics.ini commands, not here. */
			this->Command( InitCommand );
		}
	}
	else
	{
		// This is an old style BGAnimation (not using .ini)

		// loading a directory of layers
		CStringArray asImagePaths;
		ASSERT( sAniDir != "" );

		GetDirListing( sAniDir+"*.png", asImagePaths, false, true );
		GetDirListing( sAniDir+"*.jpg", asImagePaths, false, true );
		GetDirListing( sAniDir+"*.gif", asImagePaths, false, true );
		GetDirListing( sAniDir+"*.avi", asImagePaths, false, true );
		GetDirListing( sAniDir+"*.mpg", asImagePaths, false, true );
		GetDirListing( sAniDir+"*.mpeg", asImagePaths, false, true );
		GetDirListing( sAniDir+"*.sprite", asImagePaths, false, true );

		SortCStringArray( asImagePaths );

		for( unsigned i=0; i<asImagePaths.size(); i++ )
		{
			const CString sPath = asImagePaths[i];
			if( Basename(sPath).Left(1) == "_" )
				continue;	// don't directly load files starting with an underscore
			BGAnimationLayer* pLayer = new BGAnimationLayer( m_bGeneric );
			pLayer->LoadFromAniLayerFile( asImagePaths[i] );
			AddChild( pLayer );
		}
	}
}
示例#29
0
AppView::AppView(BRect r)
			: BView(r, "TimeBombView", B_FOLLOW_ALL, B_WILL_DRAW | B_PULSE_NEEDED)
{			

	time_t  	now;
	struct 		tm *ptr;
	int			loop=0;
	
	cd = new D_CD();
	cd->Init(settings.CDdevice);

	//Set up program settings
	FirstRun		= true;
	min	= hour = ampm = 90;
	TimeUp      	= false;
	CDPlaying		= false;
	LastMin     	= 90;
	LastHour		= 90;
	RingCount		= 0;
	WhichAlarm		= 0;
	

	//Set up and add the string view used to display the current time
	appSV = new BStringView(BRect(r.left,r.top+24,r.right,r.top+48), "TimeString", "", B_FOLLOW_NONE, B_WILL_DRAW);
	appSV->SetHighColor(settings.FontColor);
	appSV->SetFontSize(24);
	appSV->SetAlignment(B_ALIGN_CENTER);
	AddChild(appSV);
	
	//Now get the current time and display it
	time(&now);
	ptr = localtime(&now);

	strftime(buf1,3,"%I",ptr);
	hour = atoi(buf1);
	
	strftime(buf1,3,"%M",ptr);
	min = atoi(buf1);
	
	strftime(buf1,3,"%p",ptr);
	if(strcmp(buf1,"AM") == 0)
		ampm = 0;
	else
		ampm = 1;
		
	for(loop=0;loop<(signed)strlen(buf1);loop++)
	{
		buf1[loop]=tolower(buf1[loop]);
					
	}//end for loop convert to lowercase
		
	if(min<10)
		sprintf(totaltime,"%d:%d%d %s",hour,0,min,buf1);
	else
		sprintf(totaltime,"%d:%d %s",hour,min,buf1);
			
	LastMin = min;
	LastHour = hour;
	appSV->SetText(totaltime);
	
	//Set up and add the string view used to display the current time
	messageSV = new BStringView(BRect(r.left,r.top+44,r.right,r.top+65), "MessageString", "", B_FOLLOW_NONE, B_WILL_DRAW);
	messageSV->SetHighColor(settings.FontColor);
	messageSV->SetFontSize(14);
	messageSV->SetAlignment(B_ALIGN_CENTER);
	AddChild(messageSV);

	
	Invalidate();				//Re-Draw view
	
}// end AppView
示例#30
0
ConfigView::ConfigView(TranslatorSettings *settings)
	: BGroupView("ICNSTranslator Settings", B_VERTICAL, 0)
{
	fSettings = settings;
	
	BAlignment leftAlignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_UNSET);

	BStringView *stringView = new BStringView("title", "OptiPNG Translator");
	stringView->SetFont(be_bold_font);
	stringView->SetExplicitAlignment(leftAlignment);
	AddChild(stringView);

	float spacing = be_control_look->DefaultItemSpacing();
	AddChild(BSpaceLayoutItem::CreateVerticalStrut(spacing));

	char version[256];
	sprintf(version, "Version %d.%d.%d, %s",
		int(B_TRANSLATION_MAJOR_VERSION(OPTIPNG_TRANSLATOR_VERSION)),
		int(B_TRANSLATION_MINOR_VERSION(OPTIPNG_TRANSLATOR_VERSION)),
		int(B_TRANSLATION_REVISION_VERSION(OPTIPNG_TRANSLATOR_VERSION)),
		__DATE__);
	stringView = new BStringView("version", version);
	stringView->SetExplicitAlignment(leftAlignment);
	AddChild(stringView);

	stringView = new BStringView("my_copyright",
		B_UTF8_COPYRIGHT "2013 Luke <*****@*****.**>.");
	stringView->SetExplicitAlignment(leftAlignment);
	AddChild(stringView);

	AddChild(BSpaceLayoutItem::CreateVerticalStrut(spacing));
	
	fOptimizationLevel = new BSlider(
		"optimization",
		"Optimization level:", new BMessage(kMsgOptim),
		0, 7, B_HORIZONTAL, B_BLOCK_THUMB);
	fOptimizationLevel->SetHashMarks(B_HASH_MARKS_BOTTOM);
	fOptimizationLevel->SetHashMarkCount(8);
	fOptimizationLevel->SetLimitLabels("Low", "High");
	fOptimizationLevel->SetValue(
		fSettings->SetGetInt32(OPTIPNG_SETTING_OPTIMIZATION_LEVEL));
	AddChild(fOptimizationLevel);
	
	fBitDepthCheckBox = new BCheckBox((char*)OPTIPNG_SETTING_BIT_DEPTH_REDUCTION,
		"Reduce bit depth:", new BMessage(kMsgBitDepth));
	if (fSettings->SetGetBool(OPTIPNG_SETTING_BIT_DEPTH_REDUCTION))
		fBitDepthCheckBox->SetValue(B_CONTROL_ON);
	AddChild(fBitDepthCheckBox);
	
	fColorTypeCheckBox = new BCheckBox((char*)OPTIPNG_SETTING_COLOR_TYPE_REDUCTION,
		"Reduce color type:", new BMessage(kMsgColorType));
	if (fSettings->SetGetBool(OPTIPNG_SETTING_COLOR_TYPE_REDUCTION))
		fColorTypeCheckBox->SetValue(B_CONTROL_ON);
	AddChild(fColorTypeCheckBox);
	
	fPaletteCheckBox = new BCheckBox((char*)OPTIPNG_SETTING_PALETTE_REDUCTION,
		"Reduce palette size:", new BMessage(kMsgPaletteReduc));
	if (fSettings->SetGetBool(OPTIPNG_SETTING_PALETTE_REDUCTION))
		fPaletteCheckBox->SetValue(B_CONTROL_ON);
	AddChild(fPaletteCheckBox);
	
	AddChild(BSpaceLayoutItem::CreateGlue());
	GroupLayout()->SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING, 
		B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING);

	SetExplicitPreferredSize(GroupLayout()->MinSize());		
}