void TextEditorWindow::InitializeComponents()
{
	shortcutKeyManager=new GuiShortcutKeyManager();
	this->SetShortcutKeyManager(shortcutKeyManager);

	InitializeCommand();
	// create a table to place a menu bar and a text box
	GuiTableComposition* table=new GuiTableComposition;
	table->SetCellPadding(0);
	table->SetAlignmentToParent(Margin(0, 0, 0, 0));
	table->SetRowsAndColumns(3, 1);
	table->SetRowOption(0, GuiCellOption::MinSizeOption());
	table->SetRowOption(1, GuiCellOption::MinSizeOption());
	table->SetRowOption(2, GuiCellOption::PercentageOption(1.0));
	table->SetColumnOption(0, GuiCellOption::PercentageOption(1.0));
	this->GetContainerComposition()->AddChild(table);

	// create the menu bar
	{
		GuiCellComposition* cell=new GuiCellComposition;
		table->AddChild(cell);
		cell->SetSite(0, 0, 1, 1);
		
		InitializeMenuBar();
		cell->AddChild(menuBar->GetBoundsComposition());
	}

	// create the tool bar
	{
		GuiCellComposition* cell=new GuiCellComposition;
		table->AddChild(cell);
		cell->SetSite(1, 0, 1, 1);
		cell->SetInternalMargin(Margin(2, 2, 2, 0));
		
		InitializeToolBar();
		cell->AddChild(toolbar->GetBoundsComposition());
	}

	// create the text box
	{
		GuiCellComposition* cell=new GuiCellComposition;
		table->AddChild(cell);
		cell->SetSite(2, 0, 1, 1);
		cell->SetInternalMargin(Margin(2, 2, 2, 2));

		// create the menu bar
		textBox=g::NewMultilineTextBox();
		textBox->GetBoundsComposition()->SetAlignmentToParent(Margin(0, 0, 0, 0));
		cell->AddChild(textBox->GetBoundsComposition());
	}

	// set the preferred minimum client size
	this->GetBoundsComposition()->SetPreferredMinSize(Size(640, 480));
	// call this to calculate the size immediately if any indirect content in the table changes
	// so that the window can calcaulte its correct size before calling the MoveToScreenCenter()
	this->ForceCalculateSizeImmediately();
	// move to the screen center
	this->MoveToScreenCenter();
}
Esempio n. 2
0
void Query::DoCommand() {
	doubleValue = 0;
	stringValue.clear();
	intValue = 0;
	positionValue.x = 0;
	positionValue.y = 0;
	vectorValue.clear();

	InitializeCommand(requestCommand);
	SendRequestAndReceiveResponse(requestCommand);
	if (ValidateResponse(responseStream)) {
		ReadResponse(responseStream);
	}
	else {
		stringstream ss;
		ss << "Wrong response to command " << commandId << ", variable " << variableId << " " << responseStatus.getDescription();
		string msg = ss.str();
//		cout << msg << endl;
		throw TraciException(msg);
	}
}