コード例 #1
0
WindowCreateCharacter::WindowCreateCharacter()
{
	this->window = sfg::Window::Create();
	this->window->SetTitle("Create Character");
	this->window->SetStyle(sfg::Window::Style::TITLEBAR | sfg::Window::Style::SHADOW | sfg::Window::Style::BACKGROUND);

	auto vbox = sfg::Box::Create(sfg::Box::Orientation::VERTICAL, 5.f);
	auto lblCharacterName = sfg::Label::Create(L"Character Name:");
	lblCharacterName->SetAlignment(sf::Vector2f(0.f, 0.5f));
	vbox->Pack(lblCharacterName);
	this->tbCharacterName = sfg::Entry::Create();
	this->tbCharacterName->SetMaximumLength(32);
	this->tbCharacterName->SetRequisition(sf::Vector2f(200.f, 0.f));
	this->tbCharacterName->SetText(L"Player");
	vbox->Pack(this->tbCharacterName);
	auto lblClass = sfg::Label::Create(L"Class:");
	lblClass->SetAlignment(sf::Vector2f(0.f, 0.5f));
	vbox->Pack(lblClass);
	this->cbxCharacterClass = sfg::ComboBox::Create();
	this->cbxCharacterClass->AppendItem(L"General");
	this->cbxCharacterClass->SelectItem(0);
	vbox->Pack(this->cbxCharacterClass);
	vbox->Pack(sfg::Separator::Create());
	auto hbox = sfg::Box::Create(sfg::Box::Orientation::HORIZONTAL);
	this->btnCancel = sfg::Button::Create(L"Cancel");
	hbox->Pack(this->btnCancel);
	this->btnPlay = sfg::Button::Create(L"Start!");
	hbox->Pack(btnPlay);

	vbox->Pack(hbox);
	this->window->Add(vbox);
}
コード例 #2
0
ファイル: Label.cpp プロジェクト: Chiranjivee/SFML-book
Label::Label( const sf::String& text ) :
	m_text( text ),
	m_wrap( false )
{
	SetAlignment( sf::Vector2f( .5f, .5f ) );
	Invalidate();
}
コード例 #3
0
ファイル: C4MainMenu.cpp プロジェクト: chrisweidya/openclonk
bool C4MainMenu::ActivateDisplay(int32_t iPlayer, int32_t selection)
{
	// Menu symbol/init
	InitRefSym(GfxR->fctMenu.GetPhase(8), LoadResStr("IDS_MENU_DISPLAY"), iPlayer, C4MN_Extra_None, 0, 0, C4MN_Style_Context);
	SetAlignment(C4MN_Align_Left | C4MN_Align_Bottom);
	SetPermanent(true);
	// Crew player names
	AddRefSym(LoadResStr("IDS_MNU_PLAYERNAMES"), GfxR->fctOptions.GetPhase(7 + Config.Graphics.ShowCrewNames), "Display:PlayerNames", C4MN_Item_NoCount, NULL, LoadResStr("IDS_MENU_PLAYERNAMES_DESC"));
	// Crew clonk names
	AddRefSym(LoadResStr("IDS_MNU_CLONKNAMES"), GfxR->fctOptions.GetPhase(9 + Config.Graphics.ShowCrewCNames), "Display:ClonkNames", C4MN_Item_NoCount, NULL, LoadResStr("IDS_MENU_CLONKNAMES_DESC"));
	// Upper Board
	if (!Application.isEditor)
	{
		AddRefSym(LoadResStr("IDS_MNU_UPPERBOARD"),GfxR->fctOptions.GetPhase(3 + Config.Graphics.UpperBoard),"Display:UpperBoard",C4MN_Item_NoCount);
	}
	// FPS
	if (!Application.isEditor)
		AddRefSym(LoadResStr("IDS_MNU_FPS"), GfxR->fctOptions.GetPhase(5 + Config.General.FPS), "Display:FPS", C4MN_Item_NoCount);
	// Clock
	if (!Application.isEditor)
		AddRefSym(LoadResStr("IDS_MNU_CLOCK"), GfxR->fctOptions.GetPhase(15 + Config.Graphics.ShowClock), "Display:Clock", C4MN_Item_NoCount);
	// Restore selection
	SetSelection(selection, false, true);
	// Go back to options menu on close
	SetCloseCommand("ActivateMenu:Options");
	// Done
	return true;
}
コード例 #4
0
//-----------------------------------------------------------------------------
//!
//-----------------------------------------------------------------------------
tWorkProfileSelectDialog::tWorkProfileSelectDialog( tPilotController& pilotDevice, QWidget* pParent )
: tDialog( tDialog::Partial, pParent, DarkenOff )
, m_pGridLayout()
, m_WorkProfileWidgets()
, m_pAddButton(0)
, m_PilotDevice(pilotDevice)
{
    SetCustomPos( tMedusaUiEnvironment::ModeAreaPos() );
    SetAlignment( AlignCustom );
    setFixedSize( tMedusaUiEnvironment::ModeAreaSize() );

    QString titleStr = tr( "Work" );
    setWindowTitle( titleStr );

    m_pGridLayout = new QGridLayout();
    m_pGridLayout->setContentsMargins( 4, 4, 4, 4 );
    m_pGridLayout->setSpacing( 4 );

    CreateWidgets();
    setLayout( m_pGridLayout );

    Connect( m_PilotDevice.GetMedusaInterface(),
             SIGNAL( WorkProfileSettingsChanged(unsigned char) ),
             this,
             SLOT( OnWorkProfileSettingsChanged() ) );

    Connect( tApOperation::Instance(), SIGNAL( ApModeChanged(tPilotCommandInterface::tPilotMode) ), this, SLOT( OnApModeChanged(tPilotCommandInterface::tPilotMode) ) );
    OnApModeChanged( tApOperation::Instance()->GetApMode() ); // Init text
}
コード例 #5
0
ファイル: TextControl.cpp プロジェクト: mmanley/Antares
BTextControl::BTextControl(BMessage* archive)
	: BControl(archive)
{
	_InitData(Label(), NULL, archive);

	int32 labelAlignment = B_ALIGN_LEFT;
	int32 textAlignment = B_ALIGN_LEFT;

	if (archive->HasInt32("_a_label"))
		archive->FindInt32("_a_label", &labelAlignment);

	if (archive->HasInt32("_a_text"))
		archive->FindInt32("_a_text", &textAlignment);

	SetAlignment((alignment)labelAlignment, (alignment)textAlignment);

	if (archive->HasFloat("_divide"))
		archive->FindFloat("_divide", &fDivider);

	if (archive->HasMessage("_mod_msg")) {
		BMessage* message = new BMessage;
		archive->FindMessage("_mod_msg", message);
		SetModificationMessage(message);
	}
}
コード例 #6
0
ファイル: Alignment.cpp プロジェクト: spacechase0/SFGUI
Alignment::Alignment() :
	Bin(),
	Misc(),
	m_scale( sf::Vector2f( 1.f, 1.f ) )
{
	SetAlignment( sf::Vector2f( 0.f, 0.f ) );
}
コード例 #7
0
ファイル: GameUi.cpp プロジェクト: TED-996/MinesweeperMp
	Alignment::Ptr createAlignment(Widget::Ptr widget, Vector2f alignment, Vector2f scale) {
		auto result = Alignment::Create();
		result->Add(widget);
		result->SetAlignment(alignment);
		result->SetScale(scale);
		return result;
	}
コード例 #8
0
ファイル: Label.cpp プロジェクト: tobiasthanos/SFML-testing
Label::Label( const sf::String& text ) :
	Misc(),
	m_text( text )
{
	SetAlignment( sf::Vector2f( .5f, .5f ) );
	Invalidate();
}
コード例 #9
0
ファイル: TextControl.cpp プロジェクト: Ithamar/cosmoe
BTextControl::BTextControl(BMessage *data)
	:	BControl(data)
{
	InitData(Label(), NULL, data);

	int32 _a_label = B_ALIGN_LEFT;
	int32 _a_text = B_ALIGN_LEFT;

	if (data->HasInt32("_a_label"))
		data->FindInt32("_a_label", &_a_label);

	if (data->HasInt32("_a_text"))
		data->FindInt32("_a_text", &_a_text);
	
	SetAlignment((alignment)_a_label, (alignment)_a_text);

	if (data->HasFloat("_divide"))
		data->FindFloat("_a_text", &fDivider);

	if (data->HasMessage("_mod_msg")) {
		BMessage *_mod_msg = new BMessage;
		data->FindMessage("_mod_msg", _mod_msg);
		SetModificationMessage(_mod_msg);
	}
}
コード例 #10
0
void CHelpContainer::IntroL()
	{
	SetAlignment(CParaFormat::ELeftAlign);

	//Set the text.
	iRtEd->SetTextL(iText);
	}
コード例 #11
0
void MpHostSetupUi::createServer() {
    string name = nameEntry->GetText();
    if (name.empty()) {
        return;
    }
    nameEntry = nullptr;

    nameFrame->RemoveAll();
    auto nameLabel = Label::Create(name);
    nameLabel->SetRequisition(Vector2f(0.0f, ct::WindowHeight * 0.05f));
    nameLabel->SetAlignment(Vector2f(0.5f, 0.5f));
    nameFrame->Add(createAlignment(nameLabel, Vector2f(0.5f, 0.5f), Vector2f(0.0f, 0.0f)));


    mainBox->Pack(Label::Create("Waiting for players..."), false, false);
    playerBox = Box::Create(Box::Orientation::VERTICAL, 5);

    auto playerFrame = Frame::Create("Currently connected:");
    playerFrame->SetRequisition(Vector2f(0.0f, ct::WindowHeight * 0.5f));
    playerFrame->Add(playerBox);

    mainBox->Pack(playerFrame, true, true);

    auto startButton = Button::Create("Start game!");
    startButton->GetSignal(Widget::OnLeftClick).Connect(startGameAction);

    mainBox->Pack(startButton, false, false);

    createServerAction(name);
}
コード例 #12
0
ファイル: tFilepathSelector.cpp プロジェクト: dulton/53_hero
//-----------------------------------------------------------------------------
//!
//-----------------------------------------------------------------------------
tFilepathSelector::tFilepathSelector(const QString& title,
                                     const QList<tPathAndDirname>& pathAndDirnameList,
                                     const QStringList& nameFilters,
                                     QDir::SortFlags sortFlags,
                                     QDir::Filters filters,
                                     const QString& currentFile,
                                     QWidget* pParent)
    : tDialog(tDialog::Partial, pParent, tDialog::DarkenOff)
    , m_PathAndDirNameList(pathAndDirnameList)
    , m_NameFilters(nameFilters)
    , m_SortFlags(sortFlags)
    , m_Filters(filters)
    , m_CurrentFile(currentFile)
    , m_pListWidget()
    , m_FilePathList()
    , m_FriendlyFilepathList()
    , m_DisplayList()
    , m_ShowFileSize(false)
{
    setWindowTitle(title);
    SetAlignment(AlignScreenCenter);

    m_pListWidget = new tListWidget(this);
    m_pListWidget->SetSoleFocus(true);
    Connect(m_pListWidget, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(accept()));

    UpdateList();

    QVBoxLayout* pLayout = new QVBoxLayout;
    pLayout->addWidget(m_pListWidget);
    this->setLayout(pLayout);

    // no softkeys for all models
    SoftKeyBar()->ExplicitHide();
}
コード例 #13
0
ファイル: HtmlFormatter.cpp プロジェクト: sambhare/sumatrapdf
void HtmlFormatter::HandleTagP(HtmlToken* t, bool isDiv) {
    if (!t->IsEndTag()) {
        AlignAttr align = CurrStyle()->align;
        float indent = 0;

        StyleRule rule = ComputeStyleRule(t);
        if (rule.textAlign != Align_NotFound)
            align = rule.textAlign;
        else if (!isDiv) {
            // prefer CSS styling to align attribute
            align = GetAlignAttr(t, align);
        }
        if (rule.textIndentUnit != StyleRule::inherit && rule.textIndent > 0) {
            float factor = rule.textIndentUnit == StyleRule::em
                               ? CurrFont()->GetSize()
                               : rule.textIndentUnit == StyleRule::pt ? 1 /* TODO: take DPI into account */ : 1;
            indent = rule.textIndent * factor;
        }

        SetAlignment(align);
        EmitParagraph(indent);
    } else {
        FlushCurrLine(true);
        RevertStyleChange();
    }
    EmitEmptyLine(0.4f * CurrFont()->GetSize());
}
コード例 #14
0
ファイル: ViewStubs.cpp プロジェクト: HaikuArchives/Sequitur
ArpTextControl::ArpTextControl(const char* name, const char* label,
								const char* text, BMessage* message)
	:BTextControl(InitFrame, name, label, text, message,
					B_FOLLOW_NONE)
{
	SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
	initialize();
}
コード例 #15
0
ファイル: TNumberTextView.cpp プロジェクト: ModeenF/UltraDV
TNumberTextView::TNumberTextView(BRect bounds, char *name, uint32 resizing) : 
			  BTextView(bounds, name, bounds, resizing, B_FRAME_EVENTS | B_PULSE_NEEDED)
{	
	// Perform default initialization
	//bounds.OffsetTo(0, 0);
	//SetTextRect(bounds);
	SetAlignment(B_ALIGN_CENTER);	
}
コード例 #16
0
void UCanvasPanelSlot::SynchronizeProperties()
{
	SetOffsets(LayoutData.Offsets);
	SetAnchors(LayoutData.Anchors);
	SetAlignment(LayoutData.Alignment);
	SetAutoSize(bAutoSize);
	SetZOrder(ZOrder);
}
コード例 #17
0
void PBTabPanel::Create(PBWindow *pParent)
{
	PBWindow::Create(pParent, -1, -1, -1, -1);
	m_TabsCount = 1;
	m_TabsCurrent = 1;
	SetAlignment(ALIGNMENT_BOTTOM);
	MarkAsChanged();
}
コード例 #18
0
ファイル: InfoStrView.cpp プロジェクト: puckipedia/FilWip
InfoStrView::InfoStrView (BRect bounds, const char *name, const char *text,
				uint32 resizeFlags = B_FOLLOW_LEFT, uint32 flags = B_WILL_DRAW)
	: BStringView (bounds, name, text, resizeFlags, flags),
		itemPath (NULL),
		trackerSignature ("application/x-vnd.Be-TRAK")
{
	SetAlignment (B_ALIGN_RIGHT);
}
コード例 #19
0
ファイル: Text.cpp プロジェクト: kolosov/libosmscout
  void Text::SetText(const std::wstring& text,
                     unsigned long style,
                     Alignment alignment)
  {
    Clear();

    SetAlignment(alignment);
    SetText(text,style);
  }
コード例 #20
0
ファイル: gui.cpp プロジェクト: darwin/pacwars2
GUI_LabelL::GUI_LabelL(PG_Widget* parent, const PG_Rect& r, char* text, GUI_LabelL** iselected, CSMapInfo* si, SDL_Color ic1, SDL_Color ic2, void (*cb)(GUI_LabelL*)) : PG_Label(parent,r,text) {
	c1 = ic1;
	c2 = ic2;
	selected = iselected;
	msi = si;
	callback = cb;

	SetAlignment(PG_TA_LEFT);
}
コード例 #21
0
void PBTabPanel::Create(PBWindow *pParent, int total, int current, int alignment)
{

	PBTabPanel::Create(pParent, total, current);

	SetAlignment(alignment);

	RecountViewTabs();

}
コード例 #22
0
ファイル: pglistboxbaseitem.cpp プロジェクト: UIKit0/paragui
PG_ListBoxBaseItem::PG_ListBoxBaseItem(PG_Widget* parent, Uint16 height, void* userdata) : PG_Label(parent, PG_Rect(0,0,0,height)) {
	my_userdata = userdata;
	my_selected = false;
	my_hover = false;
	//my_itemheight = height;

	if (parent != NULL) {
		SetIndent(GetParent()->GetIndent());
		SetAlignment(GetParent()->GetAlignment());
	}
}
コード例 #23
0
ファイル: Label.cpp プロジェクト: ChunHungLiu/gemrb
Label::Label(const Region& frame, Font* font, const String& string)
	: Control(frame)
{
	ControlType = IE_GUI_LABEL;
	this->font = font;
	useRGB = false;
	ResetEventHandler( LabelOnPress );
	palette = NULL;

	SetAlignment(IE_FONT_ALIGN_CENTER|IE_FONT_ALIGN_MIDDLE);
	SetText(string);
}
コード例 #24
0
ファイル: AttributeTextControl.cpp プロジェクト: DonCN/haiku
AttributeTextControl::AttributeTextControl(const char* label,
		const char* attribute)
	:
	BTextControl(NULL, "", NULL),
	fAttribute(attribute),
	fOriginalValue()
{
	if (label != NULL && label[0] != 0)
		SetLabel(BString(B_TRANSLATE("%attribute_label:"))
			.ReplaceFirst("%attribute_label", label));
	SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
}
コード例 #25
0
ファイル: C4MainMenu.cpp プロジェクト: chrisweidya/openclonk
bool C4MainMenu::ActivateSurrender(int32_t iPlayer)
{
	C4FacetSurface fctSymbol;
	InitRefSym(C4GUI::Icon::GetIconFacet(C4GUI::Ico_Surrender), LoadResStr("IDS_MENU_SURRENDER"), iPlayer, C4MN_Extra_None, 0, 0, C4MN_Style_Context);
	SetAlignment(C4MN_Align_Left | C4MN_Align_Bottom);
	fctSymbol.Create(C4SymbolSize, C4SymbolSize); GfxR->fctOKCancel.Draw(fctSymbol,true,3,0);
	Add(LoadResStr("IDS_BTN_YES"), fctSymbol, "Surrender");
	fctSymbol.Create(C4SymbolSize, C4SymbolSize); GfxR->fctOKCancel.Draw(fctSymbol,true,1,0);
	Add(LoadResStr("IDS_BTN_NO"), fctSymbol, "");
	SetCloseCommand("ActivateMenu:Main");
	return true;
}
コード例 #26
0
ファイル: TTimeTextView.cpp プロジェクト: ModeenF/UltraDV
void TTimeTextView::Init()
{		
	m_IsLocked = false;
	
	SetTextRect(Bounds());
	SetAlignment(B_ALIGN_CENTER);
	
	// Set up max number of character
	SetMaxBytes(11);
	
	// Set font and color	
	BFont theFont(be_plain_font);
	theFont.SetSize(10);
	SetViewColor(kWhite);
	SetFontAndColor(&theFont, B_FONT_ALL, &kBlack);
	
	// 	Set up time rects.  We divide the area up into four areas
	//	for hour, minutes, seconds and frames
	float 	numberWidth;
	float 	spaceWidth;

	BRect bounds = Bounds();
	
	numberWidth = StringWidth("00");
	spaceWidth = StringWidth(":");
	
	m_HoursRect.left 		= bounds.left;
	m_HoursRect.top 		= bounds.top;
	m_HoursRect.right 		= m_HoursRect.left + numberWidth;
	m_HoursRect.bottom 		= bounds.bottom;
	
	m_MinutesRect.left 		= m_HoursRect.right + spaceWidth;
	m_MinutesRect.top 		= bounds.top;
	m_MinutesRect.right 	= m_MinutesRect.left + numberWidth;
	m_MinutesRect.bottom 	= bounds.bottom;
	
	m_SecondsRect.left 		= m_MinutesRect.right + spaceWidth;
	m_SecondsRect.top 		= bounds.top;
	m_SecondsRect.right 	= m_SecondsRect.left + numberWidth;
	m_SecondsRect.bottom 	= bounds.bottom;
	
	m_FramesRect.left 		= m_SecondsRect.right + spaceWidth;
	m_FramesRect.top 		= bounds.top;
	m_FramesRect.right 		= bounds.right;
	m_FramesRect.bottom 	= bounds.bottom;
	
	// Select first cell
	//Select(0,2);
	//ScrollToSelection();
	m_CurrentCell = 1;

}
コード例 #27
0
ファイル: C4MainMenu.cpp プロジェクト: chrisweidya/openclonk
bool C4MainMenu::ActivateObserver()
{
	// Safety: Viewport lost?
	if (!::Viewports.GetViewport(NO_OWNER)) return false;
	// Menu symbol/init
	InitRefSym(C4GUI::Icon::GetIconFacet(C4GUI::Ico_View), LoadResStr("IDS_TEXT_VIEW"), NO_OWNER, C4MN_Extra_None, 0, C4MN_Observer, C4MN_Style_Context);
	SetAlignment(C4MN_Align_Left | C4MN_Align_Bottom);
	// Players added in Refill
	Refill();
	// Go back to main menu on close
	SetCloseCommand("ActivateMenu:Main");
	return true;
}
コード例 #28
0
ファイル: C4MainMenu.cpp プロジェクト: chrisweidya/openclonk
bool C4MainMenu::ActivateClient(int32_t iPlayer)
{
	// Menu symbol/init
	C4FacetSurface fctSymbol;
	InitRefSym(C4GUI::Icon::GetIconFacet(C4GUI::Ico_Disconnect), LoadResStr("IDS_MENU_DISCONNECTFROMSERVER"), iPlayer, C4MN_Extra_None, 0, 0, C4MN_Style_Context);
	SetAlignment(C4MN_Align_Left | C4MN_Align_Bottom);
	fctSymbol.Create(C4SymbolSize, C4SymbolSize); GfxR->fctOKCancel.Draw(fctSymbol,true,3,0);
	Add(LoadResStr("IDS_BTN_YES"), fctSymbol, "Part");
	fctSymbol.Create(C4SymbolSize, C4SymbolSize); GfxR->fctOKCancel.Draw(fctSymbol,true,1,0);
	Add(LoadResStr("IDS_BTN_NO"), fctSymbol, "");
	SetCloseCommand("ActivateMenu:Main");
	return true;
}
コード例 #29
0
ファイル: StringView.cpp プロジェクト: SummerSnail2014/haiku
void
BStringView::MessageReceived(BMessage* message)
{
	if (message->what == B_GET_PROPERTY || message->what == B_SET_PROPERTY) {
		int32 index;
		BMessage specifier;
		int32 form;
		const char* property;
		if (message->GetCurrentSpecifier(&index, &specifier, &form, &property)
				!= B_OK) {
			BView::MessageReceived(message);
			return;
		}

		BMessage reply(B_REPLY);
		bool handled = false;
		if (strcmp(property, "Text") == 0) {
			if (message->what == B_GET_PROPERTY) {
				reply.AddString("result", fText);
				handled = true;
			} else {
				const char* text;
				if (message->FindString("data", &text) == B_OK) {
					SetText(text);
					reply.AddInt32("error", B_OK);
					handled = true;
				}
			}
		} else if (strcmp(property, "Alignment") == 0) {
			if (message->what == B_GET_PROPERTY) {
				reply.AddInt32("result", (int32)fAlign);
				handled = true;
			} else {
				int32 align;
				if (message->FindInt32("data", &align) == B_OK) {
					SetAlignment((alignment)align);
					reply.AddInt32("error", B_OK);
					handled = true;
				}
			}
		}

		if (handled) {
			message->SendReply(&reply);
			return;
		}
	}

	BView::MessageReceived(message);
}
コード例 #30
0
ファイル: C4MainMenu.cpp プロジェクト: chrisweidya/openclonk
bool C4MainMenu::ActivateHostility(int32_t iPlayer)
{
	// Init menu
	C4FacetSurface fctSymbol;
	fctSymbol.Create(C4SymbolSize, C4SymbolSize);
	GfxR->fctMenu.GetPhase(7).Draw(fctSymbol);
	Init(fctSymbol, LoadResStr("IDS_MENU_CPATTACK"), iPlayer, C4MN_Extra_None, 0, C4MN_Hostility);
	SetAlignment(C4MN_Align_Left | C4MN_Align_Bottom);
	SetPermanent(true);
	Refill();
	// Go back to options menu on close
	SetCloseCommand("ActivateMenu:Main");
	return true;
}