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


C++ AddWidget函数代码示例

本文整理汇总了C++中AddWidget函数的典型用法代码示例。如果您正苦于以下问题:C++ AddWidget函数的具体用法?C++ AddWidget怎么用?C++ AddWidget使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: CLabelWidget

//*****************************************************************************
bool CLevelSelectDialogWidget::Load()
//Load resources for the widget.
//
//Returns:
//True if successful, false if not.
{
	this->pPromptLabel = new CLabelWidget(0L, 25, 10, 290, 30, F_Small, wszEmpty);
	AddWidget(this->pPromptLabel);

   //OK button gets default focus
	CButtonWidget *pOKButton = new CButtonWidget(
			TAG_OK, 100, 205, 60, CY_STANDARD_BUTTON,
			g_pTheDB->GetMessageText(MID_Okay));
	AddWidget(pOKButton);
	CButtonWidget *pCancelButton = new CButtonWidget(
			TAG_CANCEL, 170, 205, 60, CY_STANDARD_BUTTON,
			g_pTheDB->GetMessageText(MID_Cancel));
	AddWidget(pCancelButton);

	this->pLevelListBoxWidget = new CListBoxWidget(TAG_LEVELS_LISTBOX,
			15, 45, 300, 130);
	AddWidget(this->pLevelListBoxWidget);

//We're disallowing exits to point to levels in other holds for this release.
#ifdef AFTERVERSION1_6
   COptionButtonWidget *pAllLevelsOptionButton = new COptionButtonWidget(
			TAG_ALL_LEVELS_OPTIONBOX, 20, 180, 300, CY_STANDARD_OPTIONBUTTON,
			g_pTheDB->GetMessageText(MID_ShowAllLevels), false);
	AddWidget(pAllLevelsOptionButton);
#endif

   return CWidget::Load();
}
开发者ID:anderssonn,项目名称:drod,代码行数:34,代码来源:LevelSelectDialogWidget.cpp

示例2: SG_Compound

SG_BasicCompound::SG_BasicCompound() : SG_Compound(8, 5, 0.1, 0.1) {
  background = new SG_Panel(SG_COL_FG);
  okb = new SG_Button("Ok", SG_COL_RAISED, SG_COL_LOW);
  AddWidget(okb, 7, 4, 1, 1);
  SG_Widget *labelb = new SG_TextArea("SG_BasicCompound", SG_COL_LOW);
  AddWidget(labelb, 1, 2, 6, 1);
}
开发者ID:steaphangreene,项目名称:simple,代码行数:7,代码来源:sg_basiccompound.cpp

示例3: SG_Compound

SG_ComboBox::SG_ComboBox(const vector<string> &options, bool edit,
                         SimpleTexture btex, SimpleTexture btex_dis,
                         SimpleTexture btex_click, SimpleTexture ttex,
                         SimpleTexture ttex_dis, SimpleTexture ttex_fg,
                         SimpleTexture mtex, SimpleTexture mtex_dis,
                         SimpleTexture mtex_sel)
    : SG_Compound(binvpro, 1, 0.0, 0.0) {
  opb = new SG_StickyButton("", btex, btex_dis, btex_click);
  opb->SetAlignment(SG_ALIGN_CENTER);
  opb->SetTexturator(stt_dnbutt_up, 0);
  opb->SetTexturator(stt_dnbutt_dn, 2);
  AddWidget(opb, binvpro - 1, 0, 1, 1);

  string message;
  if (options.size() > 0) message = options[0];
  if (edit)
    text = new SG_Editable(message, ttex, ttex_dis, ttex_fg);
  else
    text = new SG_TextArea(message, ttex, ttex_dis);
  //  text->SetVisibleSize(binvpro, 1.0); //FIXME: Don't Lock X Vis Size!
  AddWidget(text, 0, 0, binvpro - 1, 1);

  menu = new SG_Menu(options, mtex, mtex_dis, mtex_sel);
  AddWidget(menu, 0, 0, binvpro, 1);
  wgeom[2].ypos = 1;
  wgeom[2].ysize = 1;
}
开发者ID:steaphangreene,项目名称:simple,代码行数:27,代码来源:sg_combobox.cpp

示例4: Window

TreeViewWindow::TreeViewWindow()
: Window(0, 0, AUTOSIZE, AUTOSIZE)
{
  CppConsUI::TreeView *tree;
  CppConsUI::TreeView::NodeReference node;
  CppConsUI::TreeView::NodeReference node2;

  AddWidget(*(new CppConsUI::Label(20, 1, "Press F10 to quit.")), 1, 1);

  tree = new CppConsUI::TreeView(30, 12);
  AddWidget(*tree, 1, 3);
  SetInputChild(*tree);

  node = tree->AppendNode(tree->GetRootNode(),
      *(new CppConsUI::Button("Button node A")));
  node2 = tree->AppendNode(node, *(new CppConsUI::Button("Button node A-1")));
  tree->AppendNode(node2, *(new CppConsUI::Button("Button node A-1-a")));
  tree->AppendNode(node2, *(new CppConsUI::Button("Button node A-1-b")));
  tree->AppendNode(node2, *(new CppConsUI::Button("Button node A-1-c")));
  tree->AppendNode(node, *(new CppConsUI::Button("Button node A-2")));
  tree->AppendNode(node, *(new CppConsUI::Button("Button node A-3")));

  node = tree->AppendNode(tree->GetRootNode(),
      *(new CppConsUI::Label("Label node B")));
  tree->AppendNode(node, *(new CppConsUI::Label("Label node B-1")));
  tree->AppendNode(node, *(new CppConsUI::Label("Label node B-2")));
  tree->AppendNode(node, *(new CppConsUI::Label("Label node B-3")));

  node = tree->AppendNode(tree->GetRootNode(),
      *(new CppConsUI::Button("Button node C")));
  tree->AppendNode(node, *(new CppConsUI::Button("Button node C-1")));
  tree->AppendNode(node, *(new CppConsUI::Button("Button node C-2")));
  tree->AppendNode(node, *(new CppConsUI::Button("Button node C-3")));
}
开发者ID:transacid,项目名称:CenterIM5,代码行数:34,代码来源:treeview_test.cpp

示例5: AddWidget

GuiStateMain::GuiStateMain()
{
  AddWidget( boost::make_shared<Gui::Image>(
    Rect( Point(0, 0), Editor::GetScreenSizePx() ),
    boost::make_shared<Texture>( "./_data/backg_main.png" )
    ));
 
  const Texture::TPtr pBtnTex = boost::make_shared<Texture>( "./_data/button_01.png", 2 );
  const Font::TPtr pBtnFont = boost::make_shared<Font>( "./_data/gm.ttf", 20);

  AddWidget( boost::make_shared<Gui::Label>(
    Point(Editor::VisibleFieldSizePx().w / 2, 10),
    boost::make_shared<Font>( "./_data/gm.ttf", 60), 
    "Tag Game",
    Color::make_white(),
    Gui::Label::Center
  ));

  AddWidget( boost::make_shared<Gui::Label>(
    Point(Editor::VisibleFieldSizePx().w / 2, Editor::VisibleFieldSizePx().h - 35 ),
    boost::make_shared<Font>( "./_data/gm.ttf", 30), 
    "mango2d engine demo",
    Color::make_white(),
    Gui::Label::Center
  ));

  AddWidget( boost::make_shared<Gui::Button>(
    Rect( Point(Editor::VisibleFieldSizePx().w / 2 - 100, Editor::VisibleFieldSizePx().h / 2), Size(200, 40) ),
    pBtnFont, pBtnTex,
    [this](){ GetManager()->SetState( boost::make_shared<GuiStateTest>() ); },
    "Start Game"
  ));
}
开发者ID:black-square,项目名称:TagGame,代码行数:33,代码来源:StateMain.cpp

示例6: ScrollBox

TeamScrollBox::TeamScrollBox(const std::vector<TeamBox*>& teams, const Point2i &size)
  : ScrollBox(size)
  , teams(teams)
  , count(2)
{
  // SetNbTeams not called immediately
  AddWidget(teams[0]);
  AddWidget(teams[1]);
}
开发者ID:Arnaud474,项目名称:Warmux,代码行数:9,代码来源:teams_selection_box.cpp

示例7: CDialogWidget

//*****************************************************************************
CEntranceSelectDialogWidget::CEntranceSelectDialogWidget(
//Constructor.
//
//Params:
	const UINT dwSetTagNo,                //(in)   Required params for CWidget 
	const int nSetX, const int nSetY)         //    constructor.
	: CDialogWidget(dwSetTagNo, nSetX, nSetY, CX_DIALOG, CY_DIALOG, true)   //double-click on list box disables
	, pListBoxWidget(NULL)
	, pSourceHold(NULL), pCurrentGame(NULL)
	, pPromptLabel(NULL)
{
	static const UINT CX_SPACE = 15;
	static const UINT CY_SPACE = 10;

	static const int Y_LABEL = CY_SPACE;
	static const UINT CY_LABEL = 60;

	static const UINT CX_BUTTON = 70;
	static const int X_OKBUTTON = (CX_DIALOG - 2*CX_BUTTON) / 2;
	static const int Y_OKBUTTON = CY_DIALOG - CY_STANDARD_BUTTON - CY_SPACE;
	static const int X_DELETEBUTTON = X_OKBUTTON + CX_BUTTON + 2*CX_SPACE;
	static const int Y_DELETEBUTTON = Y_OKBUTTON;

	static const int X_LISTBOX = CX_SPACE;
	static const int Y_LISTBOX = Y_LABEL + CY_LABEL;
	static const UINT CX_LISTBOX = CX_DIALOG - X_LISTBOX - CX_SPACE;
	static const UINT CY_LISTBOX = Y_OKBUTTON - Y_LISTBOX - CY_SPACE;

	this->pPromptLabel = new CLabelWidget(0L, 0, Y_LABEL, this->w, CY_LABEL,
			F_Small, wszEmpty);
	this->pPromptLabel->SetAlign(CLabelWidget::TA_CenterGroup);
	AddWidget(this->pPromptLabel);

	//OK button gets default focus
	CButtonWidget *pButton = new CButtonWidget(
			TAG_OK, X_OKBUTTON, Y_OKBUTTON, CX_BUTTON, CY_STANDARD_BUTTON,
			g_pTheDB->GetMessageText(MID_Okay));
	AddWidget(pButton);

	pButton = new CButtonWidget(
			TAG_DONE, X_OKBUTTON, Y_OKBUTTON, CX_BUTTON, CY_STANDARD_BUTTON,
			g_pTheDB->GetMessageText(MID_Done));
	AddWidget(pButton);
	pButton->Hide();

	pButton = new CButtonWidget(
			TAG_DELETE, X_DELETEBUTTON, Y_DELETEBUTTON, CX_BUTTON, CY_STANDARD_BUTTON,
			g_pTheDB->GetMessageText(MID_Delete));
	pButton->Hide();
	AddWidget(pButton);

	this->pListBoxWidget = new CListBoxWidget(TAG_ENTRANCES_LISTBOX,
			X_LISTBOX, Y_LISTBOX, CX_LISTBOX, CY_LISTBOX);
	AddWidget(this->pListBoxWidget);
}
开发者ID:binji,项目名称:drod-nacl,代码行数:56,代码来源:EntranceSelectDialogWidget.cpp

示例8: AddWidget

void GMMManageBots::SetupLayout1()
{
	int i, rows, cols;
	const int max_rows=4;
	const int label_width = 40;
	const int start_width = 25;
	const int stop_width = 25;
	const int button_spacer = 2;

	rows = MAX_TEAM_TYPES-1;
	if(rows > max_rows) rows = max_rows;
	cols = (MAX_TEAM_TYPES-1)/max_rows;
	if((MAX_TEAM_TYPES-1)%max_rows) cols++;
	
	for(i=NULL_TEAM+1; i<MAX_TEAM_TYPES; i++)
	{
		int button_y;
		int button_x;

		button_x = GMM_SIDE_MARGIN + ((i-1)/max_rows)*(label_width + button_spacer + start_width + button_spacer + stop_width);
		button_y = GMM_TITLE_MARGIN + ((i-1)%max_rows)*(GMMWBUTTON_HEIGHT+1);

		//left
		{
			team_label[i].SetText(team_type_string[i]);
			team_label[i].SetCoords(button_x, button_y + ((GMMWBUTTON_HEIGHT-MMLABEL_HEIGHT)/2));
			team_label[i].SetDimensions(label_width, 0);
			team_label[i].SetJustification(MMLABEL_RIGHT);
			AddWidget(&team_label[i]);
			button_x += label_width + button_spacer;

			start_button[i].SetType(MMGENERIC_BUTTON);
			start_button[i].SetText("On");
			start_button[i].SetCoords(button_x, button_y);
			start_button[i].SetDimensions(start_width, GMMWBUTTON_HEIGHT);
			AddWidget(&start_button[i]);
			button_x += start_width + button_spacer;

			stop_button[i].SetType(MMGENERIC_BUTTON);
			stop_button[i].SetText("Off");
			stop_button[i].SetCoords(button_x, button_y);
			stop_button[i].SetDimensions(stop_width, GMMWBUTTON_HEIGHT);
			AddWidget(&stop_button[i]);
			button_x += stop_width;
		}
	}

	w = (GMM_SIDE_MARGIN * 2) + cols*(label_width + button_spacer + start_width + button_spacer + stop_width);
	h = GMM_TITLE_MARGIN + GMM_BOTTOM_MARGIN + (rows)*(GMMWBUTTON_HEIGHT+1);

	//needed if w is ever changed / set
	UpdateDimensions();
}
开发者ID:sebhd,项目名称:zod,代码行数:53,代码来源:gmm_manage_bots.cpp

示例9: Open

    void Open()
    {
      SetTitle(settings.GetTitle());

      // Every message box is modal for now
      //settings.IsModeless();

      // Icon
      {
        cWidget* pWidget = new cImage;

        cImage::STANDARD_IMAGE image = cImage::STANDARD_INFORMATION;

        const cMessageBoxSettings::TYPE type = settings.GetType();
        if (type == TYPE_INFORMATION) image = cImage::STANDARD_INFORMATION;
        else if (type == TYPE_WARNING) image = cImage::STANDARD_WARNING;
        else image = cImage::STANDARD_ERROR;

        pWidget->SetImage(image);

        AddWidget(pWidget);
      }

      // Static text
      {
        cWidget* pWidget = new cStaticText;
        pWidget->SetText(settings.GetText());
        AddWidget(pWidget);
      }

      // Yes button
      {
        pYesButton = new cDefaultButton;
        pYesButton->SetText(settings.GetYesButtonText());
        AddWidget(pYesButton);
      }

      // No button
      if (settings.HasNoButton()) {
        ASSERT(pNoButton == nullptr);
        pNoButton = new cButton;
        pNoButton->SetText(settings.GetNoButtonText());

        AddWidget(pNoButton);
      }

      // Cancel button
      if (settings.HasCancelButton()) {
        pCancelButton = new cCancelButton;
        AddWidget(pCancelButton);
      }
    }
开发者ID:pilkch,项目名称:library,代码行数:52,代码来源:cMessageBox.cpp

示例10: CFileDialogWidget

//*****************************************************************************
CDrodFileDialogWidget::CDrodFileDialogWidget(
//Constructor.
//
//Params:
	const UINT dwSetTagNo,                //(in)   Required params for CWidget
	const int nSetX, const int nSetY)         //    constructor.
	: CFileDialogWidget(dwSetTagNo, nSetX, nSetY)
{
	static const UINT CX_SPACE = 15;
	static const UINT CY_SPACE = 8;

	static const UINT CX_BUTTON = 90;
	static const int X_BUTTON = CX_FILEDIALOG - CX_BUTTON - CX_SPACE;
	static const int Y_CANCEL_BUTTON = CY_FILEDIALOG - CY_STANDARD_BUTTON - CY_SPACE * 2;
	static const int Y_OK_BUTTON = Y_CANCEL_BUTTON - CY_STANDARD_BUTTON - CY_SPACE;

#ifdef RUSSIAN_BUILD
	static const int X_DIR_TEXT_BOX = 110; //move over
	this->pDirNameTextBox->Move(X_DIR_TEXT_BOX, this->pDirNameTextBox->GetY());
	this->pDirNameTextBox->SetWidth(this->pDirNameTextBox->GetW() - (X_DIR_TEXT_BOX - 80));
	static const UINT CX_FILENAME = 90;
#else
	static const int X_DIR_TEXT_BOX = 80; //ref from CFileDialogWidget
	static const UINT CX_FILENAME = 85;
#endif
	static const UINT CX_CURDIR = X_DIR_TEXT_BOX - CX_SPACE;
	static const UINT CX_FILETYPE = 120;

	//Add labels (requiring DB text to access).
	AddWidget(new CLabelWidget(0L, CX_SPACE, 47, CX_CURDIR, 60, F_Small,
			g_pTheDB->GetMessageText(MID_CurrentDirectory)));
	AddWidget(new CLabelWidget(0L, CX_SPACE, 570, CX_FILENAME, 30, FONTLIB::F_Small,
			g_pTheDB->GetMessageText(MID_FileName)));
	AddWidget(new CLabelWidget(0L, CX_SPACE, 610, CX_FILETYPE, 30, FONTLIB::F_Small,
			g_pTheDB->GetMessageText(MID_FileType)));

	//Buttons.
	CButtonWidget *pOKButton = new CButtonWidget(
			TAG_OK, X_BUTTON, Y_OK_BUTTON, CX_BUTTON, CY_STANDARD_BUTTON,
			g_pTheDB->GetMessageText(MID_Okay));
	AddWidget(pOKButton);
	CButtonWidget *pCancelButton = new CButtonWidget(
			TAG_CANCEL, X_BUTTON, Y_CANCEL_BUTTON, CX_BUTTON, CY_STANDARD_BUTTON,
			g_pTheDB->GetMessageText(MID_Cancel));
	AddWidget(pCancelButton);

	COptionButtonWidget *pShowHidden = DYN_CAST(COptionButtonWidget*, CWidget*,
			GetWidget(TAG_SHOW_HIDDEN));
	pShowHidden->SetCaption(g_pTheDB->GetMessageText(MID_ShowHiddenFiles));
}
开发者ID:binji,项目名称:drod-nacl,代码行数:51,代码来源:DrodFileDialogWidget.cpp

示例11: Window

QuitWindow::QuitWindow()
: Window ( g_graphics->GetCenterX() - 136, g_graphics->GetCenterY() - 32, 256, 72 )
{
    SetWidgetClass ( "QuitWindow" );

    TextUI *text = new TextUI ( "Are you sure you want to leave ARC++?", false, 23, 16, 245, 9 );
    AddWidget ( text ); text = NULL;

    Button *button = new Button ( (InputCallback)QuitWindow_OnYesClick, this, BUTTON_TYPE_YES, 47, 36 );
    m_enterKeyDefault = button;
    AddWidget ( button ); button = NULL;

    button = new Button ( (InputCallback)QuitWindow_OnNoClick, this, BUTTON_TYPE_NO, 146, 36 );
    AddWidget ( button ); button = NULL;
}
开发者ID:brobits,项目名称:arc,代码行数:15,代码来源:quit_window.cpp

示例12: CBaseLuaProgressDialog

CLuaProgressDialog::CLuaProgressDialog(int r) : CBaseLuaProgressDialog(r)
{
    AddWidget(m_pTitle = new NNCurses::CLabel("", false));
    AddWidget(m_pProgBar = new NNCurses::CProgressBar(0.0f, 100.0f));
    AddWidget(m_pSecTitle = new NNCurses::CLabel("", false));
    AddWidget(m_pSecProgBar = new NNCurses::CProgressBar(0.0f, 100.0f));
    
    NNCurses::CBox *bbox = new NNCurses::CBox(NNCurses::CBox::HORIZONTAL, false);
    AddWidget(bbox);
    bbox->StartPack(m_pCancelButton = new NNCurses::CButton(GetTranslation("Cancel")), true, false, 0, 0);
    
    m_pCancelButton->Enable(false);
    m_pSecTitle->Enable(false);
    m_pSecProgBar->Enable(false);
}
开发者ID:BackupTheBerlios,项目名称:nixstaller-svn,代码行数:15,代码来源:luaprogressdialog.cpp

示例13: Window

ErrorWindow::ErrorWindow ( const char *_text, bool _critical )
: Window ( g_graphics->GetCenterX() - 136, g_graphics->GetCenterY() - 44, 256, 72 ),
  m_critical(_critical)
{
    SetWidgetClass ( "ErrorWindow" );

    m_caption = new TextUI ( "[null]", false, 35, 16, 600, 9 );
    AddWidget ( m_caption );

    Button *button = new Button ( (InputCallback)ErrorWindow_OnOKClick, this, BUTTON_TYPE_OK, (m_position.w / 2) - (58 / 2), 40 );
    m_enterKeyDefault = button;
    AddWidget ( button ); button = NULL;

    SetCaption ( _text );
}
开发者ID:brobits,项目名称:arc,代码行数:15,代码来源:error_window.cpp

示例14: Container

List::List(Context *context) : Container(context), m_selected(-1)
{
	Context *c = GetContext();
	m_container = c->Background();
	m_container->SetInnerWidget(c->VBox());
	AddWidget(m_container);
}
开发者ID:Luomu,项目名称:pioneer,代码行数:7,代码来源:List.cpp

示例15: ASSERT

void UIScreenEldBindInputs::CreateCompositeWidget()
{
	UIWidget* const pCompositeWidget = UIFactory::CreateWidget( m_CompositeWidgetDefinitionName, this );
	ASSERT( pCompositeWidget );

	AddWidget( pCompositeWidget );
}
开发者ID:MinorKeyGames,项目名称:Eldritch,代码行数:7,代码来源:uiscreen-eldbindinputs.cpp


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