• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ Widget类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: load

void HUD::update(int width, int height) {
	std::set<Resolution> availableRes;

	for (size_t i = 0; i < ARRAYSIZE(kResolution); i++)
		if (ResMan.hasResource(kResolution[i].gui, Aurora::kFileTypeGUI))
			availableRes.insert(kResolution[i]);

	const int wWidth  = width;
	const int wHeight = height;

	const Resolution *foundRes = 0;
	for (std::set<Resolution>::const_iterator it = availableRes.begin(); it != availableRes.end(); ++it)
		if (it->width == wWidth && it->height == wHeight)
			foundRes = &*it;

	bool scale = false;
	if (!foundRes) {
		for (std::set<Resolution>::const_iterator it = availableRes.begin(); it != availableRes.end(); ++it) {
			if ((it->width == 800) && (it->height == 600)) {
				foundRes = &*it;
				break;
			}
		}
		if (!foundRes)
			throw Common::Exception("No gui with 800x600 resolution found.");
		scale = true;
	}

	load(foundRes->gui);

	// Make all the widgets invisible and scale them if needed.
	for (size_t i = 0; i < ARRAYSIZE(kKnownWidgets); i++) {
		Widget *widget = getWidget(kKnownWidgets[i].name);
		if (!widget)
			continue;

		widget->setInvisible(!kKnownWidgets[i].visible);

		float x, y, z;
		if (scale) {
			switch (kKnownWidgets[i].position) {
				case kPositionUpperLeft:
					widget->getPosition(x, y, z);
					widget->setPosition(-wWidth/2 + (400 + x), wHeight/2 - (300 - y), z);
					break;
				case kPositionUpperRight:
					widget->getPosition(x, y, z);
					widget->setPosition(wWidth/2 - (400 - x), wHeight/2 - (300 - y), z);
					break;
				case kPositionUpperMid:
					widget->getPosition(x, y, z);
					widget->setPosition(x, wHeight/2 - (300 - y), z);
					break;
				case kPositionLowerLeft:
					widget->getPosition(x, y, z);
					widget->setPosition(-wWidth/2 + (400 + x), -wHeight/2 + (300 + y), z);
					break;
				case kPositionLowerRight:
					widget->getPosition(x, y, z);
					widget->setPosition(wWidth/2 - (400 - x), -wHeight/2 + (300 + y), z);
					break;
				case kPositionLowerMid:
					widget->getPosition(x, y, z);
					widget->setPosition(x, -wHeight/2 + (300 + y), z);
					break;
				default:
					break;
			}
		}
	}
}
开发者ID:Supermanu,项目名称:xoreos,代码行数:71,代码来源:hud.cpp


示例2: workingWindow

void GlassWindow::workingWindow(bool w) {
	Widget *working = titleBarContainer.findWidgetById("working");
	working->setVisible(w);
}
开发者ID:newerthcom,项目名称:savagerebirth,代码行数:4,代码来源:GlassWindow.cpp


示例3: Widget

void engine_display::on_pushButton_released()
{
    Widget *mainwindow = new Widget();
    mainwindow->show();
    this->close();
}
开发者ID:MicrowattAthena,项目名称:Lena_Modbus,代码行数:6,代码来源:engine_display.cpp


示例4: fgFrame

void Gui::mouseMove( int x, int y, MouseButtons mb )
{
//  cout << "Ui::Gui::mouseMove(  )"  << endl;

	if ( pChannelPopup != NULL ) {
		pChannelPopup->mouseMove( x, y, mb );
		if ( pChannelPopup != NULL ) {
			if ( !pChannelPopup->passEvents() )
				return;
		}
	}

  if ( pMouseChannelWidget != NULL ) {

		Widget* o =  pMouseChannelWidget->mouseMove( x - pMouseChannelWidget->absoluteXPos(), y - pMouseChannelWidget->absoluteYPos(), mb );

    if ( pLastMouseOver != o ) {

      if ( (pLastMouseOver == pMouseChannelWidget) || (o == pMouseChannelWidget) ) {
        if ( o == pMouseChannelWidget ) {
          pMouseChannelWidget->mouseIn( mb );
        } else {
          pMouseChannelWidget->mouseOut( mb );
          pMouseChannelWidget->onDestroy.disconnect( this );
        }
      } else {
        pLastMouseOver->onDestroy.disconnect( this );
      }
      pLastMouseOver = o;
      pLastMouseOver->onDestroy.connect( this, &Gui::objectDestroyed );

    }

  } else {

    for( int i = 0; i < pPopups.count(); i++ ) {
      Popup* p = pPopups.get( i );
      Rect r = p->getRect();
      if ( r.pointInside( x, y ) ) {
        p->mouseMove( x, y, mb );
				if ( !p->passEvents() )
					return;
      }
    }

    Widget* o = fgFrame().mouseMove( x, y, mb );

    if ( o != NULL ) {
      if ( o != pLastMouseOver ) {

        if ( pLastMouseOver != NULL ) {
          pLastMouseOver->onDestroy.disconnect( this );
          pLastMouseOver->mouseOut( mb );
          pLastMouseOver = NULL;
        }

//        if ( o != &frame )
        o->mouseIn( mb );

        pLastMouseOver = o;
        pLastMouseOver->onDestroy.connect( this, &Gui::objectDestroyed );

      }
      //o->mouseMove( x, y, mb );

    } else {
      pLastMouseOver->onDestroy.disconnect( this );
      pLastMouseOver = NULL;
    }

  }
	if ( pMouseDragWidget != NULL ) {
		if ( ( Utils::max(x, pPressedX) - Utils::min(x, pPressedX) > 5 ) || ( Utils::max(y, pPressedY) - Utils::min(y, pPressedY) > 5 ) ) {
			DragObject* d = NULL;
			pMouseDragWidget->onDrag( pMouseDragWidget, x - pMouseDragWidget->absoluteXPos(), y - pMouseDragWidget->absoluteYPos(), &d );
			if ( d != NULL ) {
				pMouseDragWidget->mouseReleased( x - pMouseDragWidget->absoluteXPos(), y - pMouseDragWidget->absoluteYPos(), mb );
				d->popup( x - (d->width() / 2), y - (d->height() / 2), *this );
				if ( mouseChannelWidget() != NULL )
					unsetMouseChannelWidget( *mouseChannelWidget() );

				d->mousePressed( x, y, mb );
			}
			pMouseDragWidget->onDestroy.disconnect( this );
			pMouseDragWidget = NULL;
		}
	}
}
开发者ID:tc-,项目名称:GameUI,代码行数:88,代码来源:uigui.cpp


示例5: switch

/**
*  @brief
*    Send and process a message directly
*/
void Gui::SendMessage(const GuiMessage &cMessage)
{
	// Pass message to message filters
	for (uint32 i=0; i<m_lstMessageFilters.GetNumOfElements(); i++) {
		// Pass message to filter
		m_lstMessageFilters[i]->AddMessage(cMessage);
	}

	// Get widget
	Widget *pWidget = cMessage.GetWidget();

	// Process message
	switch (cMessage.GetType()) {
		// Exit application
		case MessageOnExit:
			// Set flag to leave application
			m_bActive = false;

			// Skip passing message to widget
			return;

		// Timer fired
		case MessageOnTimer:
		{
			// Get timer
			Timer *pTimer = cMessage.GetTimer();

			// Discard message, if the timer has already been destroyed
			if (pTimer && m_lstTimers.IsElement(pTimer)) {
				// Fire timer
				pTimer->Fire();
			}

			// Skip passing message to widget
			return;
		}

		// Widget has been destroyed
		case MessageOnDestroy:
			// Remove from parent widget
			if (pWidget->GetParent()) {
				pWidget->GetParent()->RemoveChild(pWidget);
			}

			// Remove from list of top-level widgets
			if (m_lstTopLevelWidgets.IsElement(pWidget)) {
				m_lstTopLevelWidgets.Remove(pWidget);
			}

			// Add widget to list of destroyed widgets
			m_lstDestroyedWidgets.Add(pWidget);

			// Pass message on to widget
			break;

		// Mouse has entered a widget
		case MessageOnMouseEnter:
			// Set new mouse-over widget
			if (m_pMouseOverWidget != pWidget) {
				// Update mouse-over widget
				m_pMouseOverWidgetNew = pWidget;
				UpdateMouseOverWidget();
			}
			break;

		// Mouse has left a widget
		case MessageOnMouseLeave:
			// Reset mouse-over widget
			if (m_pMouseOverWidget == pWidget) {
				// Update mouse-over widget
				m_pMouseOverWidgetNew = nullptr;
				UpdateMouseOverWidget();
			}
			break;

		// Widget has got the focus
		case MessageOnGetFocus:
			// Set focus widget
			if (m_pFocusWidget != pWidget) {
				// Update focus widget
				m_pFocusWidgetNew = pWidget;
				UpdateFocusWidget();
			}
			break;

		// Widget has lost the focus
		case MessageOnLooseFocus:
			// Set focus widget
			if (m_pFocusWidget == pWidget) {
				// Update focus widget
				m_pFocusWidgetNew = nullptr;
				UpdateFocusWidget();
			}
			break;

		case MessageOnUnknown:
//.........这里部分代码省略.........
开发者ID:G-Ray,项目名称:pixellight,代码行数:101,代码来源:Gui.cpp


示例6: begin

void Window::attach(Widget& w)
{
    begin();         // FTLK: begin attaching new Fl_Wigets to this window
    w.attach(*this); // let the Widget create its Fl_Wigits
    end();           // FTLK: stop attaching new Fl_Wigets to this window
}
开发者ID:quoji,项目名称:FlipFlaps,代码行数:6,代码来源:Window.cpp


示例7: listView

void
EditorItem::paintCell(QPainter *p, const QColorGroup & cg, int column, int width, int align)
{
	//int margin = static_cast<Editor*>(listView())->itemMargin();
	if(!d->property)
		return;

	if(column == 0)
	{
		QFont font = listView()->font();
		if(d->property->isModified())
			font.setBold(true);
		p->setFont(font);
		p->setBrush(cg.highlight());
		p->setPen(cg.highlightedText());
		KListViewItem::paintCell(p, cg, column, width, align);
		p->fillRect(parent() ? 0 : 50, 0, width, height()-1,
			QBrush(isSelected() ? cg.highlight() : backgroundColor()));
		p->setPen(isSelected() ? cg.highlightedText() : cg.text());
		int delta = -20+KPROPEDITOR_ITEM_MARGIN;
		if ((firstChild() && dynamic_cast<EditorGroupItem*>(parent()))) {
			delta = -KPROPEDITOR_ITEM_MARGIN-1;
		}
		if (dynamic_cast<EditorDummyItem*>(parent())) {
			delta = KPROPEDITOR_ITEM_MARGIN*2;
		}
		else if (parent() && dynamic_cast<EditorDummyItem*>(parent()->parent())) {
			if (dynamic_cast<EditorGroupItem*>(parent()))
				delta += KPROPEDITOR_ITEM_MARGIN*2;
			else
				delta += KPROPEDITOR_ITEM_MARGIN*5;
		}
		p->drawText(
			QRect(delta,2, width+listView()->columnWidth(1)-KPROPEDITOR_ITEM_MARGIN*2, height()),
			Qt::AlignLeft | Qt::AlignTop /*| Qt::SingleLine*/, text(0));

		p->setPen( KPROPEDITOR_ITEM_BORDER_COLOR );
		p->drawLine(width-1, 0, width-1, height()-1);
		p->drawLine(0, -1, width-1, -1);

		p->setPen( KPROPEDITOR_ITEM_BORDER_COLOR ); //! \todo custom color?
		if (dynamic_cast<EditorDummyItem*>(parent()))
			p->drawLine(0, 0, 0, height()-1 );
	}
	else if(column == 1)
	{
		QColorGroup icg(cg);
		icg.setColor(QColorGroup::Background, backgroundColor());
		p->setBackgroundColor(backgroundColor());
		Widget *widget = d->editor->createWidgetForProperty(d->property, false /*don't change Widget::property() */);
		if(widget) {
			QRect r(0, 0, d->editor->header()->sectionSize(1), height() - (widget->hasBorders() ? 0 : 1));
			p->setClipRect(r, QPainter::CoordPainter);
			p->setClipping(true);
			widget->drawViewer(p, icg, r, d->property->value());
			p->setClipping(false);
		}
	}
	p->setPen( KPROPEDITOR_ITEM_BORDER_COLOR ); //! \todo custom color?
	p->drawLine(0, height()-1, width, height()-1 );
}
开发者ID:,项目名称:,代码行数:61,代码来源:


示例8: getTopDialog

void GuiManager::runLoop() {
	Dialog * const activeDialog = getTopDialog();
	bool didSaveState = false;

	if (activeDialog == 0)
		return;

#ifdef ENABLE_EVENTRECORDER
	// Suspend recording while GUI is shown
	g_eventRec.suspendRecording();
#endif

	if (!_stateIsSaved) {
		saveState();
		_theme->enable();
		didSaveState = true;

		_useStdCursor = !_theme->ownCursor();
		if (_useStdCursor)
			setupCursor();

//		_theme->refresh();

		_redrawStatus = kRedrawFull;
		redraw();
	}

	_lastMousePosition.x = _lastMousePosition.y = -1;
	_lastMousePosition.time = 0;

	Common::EventManager *eventMan = _system->getEventManager();
	uint32 lastRedraw = 0;
	const uint32 waitTime = 1000 / 45;

	bool tooltipCheck = false;

	while (!_dialogStack.empty() && activeDialog == getTopDialog() && !eventMan->shouldQuit()) {
		redraw();

		// Don't "tickle" the dialog until the theme has had a chance
		// to re-allocate buffers in case of a scaler change.

		activeDialog->handleTickle();

		if (_useStdCursor)
			animateCursor();
//		_theme->updateScreen();
//		_system->updateScreen();

		if (lastRedraw + waitTime < _system->getMillis(true)) {
			_theme->updateScreen();
			_system->updateScreen();
			lastRedraw = _system->getMillis(true);
		}

		Common::Event event;

		while (eventMan->pollEvent(event)) {
			// We will need to check whether the screen changed while polling
			// for an event here. While we do send EVENT_SCREEN_CHANGED
			// whenever this happens we still cannot be sure that we get such
			// an event immediately. For example, we might have an mouse move
			// event queued before an screen changed event. In some rare cases
			// this would make the GUI redraw (with the code a few lines
			// below) when it is not yet updated for new overlay dimensions.
			// As a result ScummVM would crash because it tries to copy data
			// outside the actual overlay screen.
			if (event.type != Common::EVENT_SCREEN_CHANGED) {
				checkScreenChange();
			}

			// The top dialog can change during the event loop. In that case, flush all the
			// dialog-related events since they were probably generated while the old dialog
			// was still visible, and therefore not intended for the new one.
			//
			// This hopefully fixes strange behavior/crashes with pop-up widgets. (Most easily
			// triggered in 3x mode or when running ScummVM under Valgrind.)
			if (activeDialog != getTopDialog() && event.type != Common::EVENT_SCREEN_CHANGED)
				continue;

			processEvent(event, activeDialog);

			if (event.type == Common::EVENT_MOUSEMOVE) {
				tooltipCheck = true;
			}


			if (lastRedraw + waitTime < _system->getMillis(true)) {
				_theme->updateScreen();
				_system->updateScreen();
				lastRedraw = _system->getMillis(true);
			}
		}

		if (tooltipCheck && _lastMousePosition.time + kTooltipDelay < _system->getMillis(true)) {
			Widget *wdg = activeDialog->findWidget(_lastMousePosition.x, _lastMousePosition.y);
			if (wdg && wdg->hasTooltip() && !(wdg->getFlags() & WIDGET_PRESSED)) {
				Tooltip *tooltip = new Tooltip();
				tooltip->setup(activeDialog, wdg, _lastMousePosition.x, _lastMousePosition.y);
				tooltip->runModal();
//.........这里部分代码省略.........
开发者ID:ComputeLinux,项目名称:residualvm,代码行数:101,代码来源:gui-manager.cpp


示例9: window

void OptionsCommand::onExecute(Context* context)
{
  // Load the window widget
  base::UniquePtr<Window> window(app::load_widget<Window>("options.xml", "options"));
  Widget* check_smooth = app::find_widget<Widget>(window, "smooth");
  Widget* check_autotimeline = app::find_widget<Widget>(window, "autotimeline");
  Widget* move_click2 = app::find_widget<Widget>(window, "move_click2");
  Widget* draw_click2 = app::find_widget<Widget>(window, "draw_click2");
  Widget* cursor_color_box = app::find_widget<Widget>(window, "cursor_color_box");
  Widget* grid_color_box = app::find_widget<Widget>(window, "grid_color_box");
  Widget* pixel_grid_color_box = app::find_widget<Widget>(window, "pixel_grid_color_box");
  m_checked_bg = app::find_widget<ComboBox>(window, "checked_bg_size");
  m_checked_bg_zoom = app::find_widget<Widget>(window, "checked_bg_zoom");
  Widget* checked_bg_color1_box = app::find_widget<Widget>(window, "checked_bg_color1_box");
  Widget* checked_bg_color2_box = app::find_widget<Widget>(window, "checked_bg_color2_box");
  Button* checked_bg_reset = app::find_widget<Button>(window, "checked_bg_reset");
  Widget* undo_size_limit = app::find_widget<Widget>(window, "undo_size_limit");
  Widget* undo_goto_modified = app::find_widget<Widget>(window, "undo_goto_modified");
  Widget* button_ok = app::find_widget<Widget>(window, "button_ok");

  // Cursor color
  ColorButton* cursor_color = new ColorButton(Editor::get_cursor_color(), IMAGE_RGB);
  cursor_color->setId("cursor_color");
  cursor_color_box->addChild(cursor_color);

  // Get global settings for documents
  IDocumentSettings* docSettings = context->getSettings()->getDocumentSettings(NULL);

  // Grid color
  ColorButton* grid_color = new ColorButton(docSettings->getGridColor(), IMAGE_RGB);
  grid_color->setId("grid_color");
  grid_color_box->addChild(grid_color);

  // Pixel grid color
  ColorButton* pixel_grid_color = new ColorButton(docSettings->getPixelGridColor(), IMAGE_RGB);
  pixel_grid_color->setId("pixel_grid_color");
  pixel_grid_color_box->addChild(pixel_grid_color);

  // Others
  if (get_config_bool("Options", "MoveClick2", false))
    move_click2->setSelected(true);

  if (get_config_bool("Options", "DrawClick2", false))
    draw_click2->setSelected(true);

  if (get_config_bool("Options", "MoveSmooth", true))
    check_smooth->setSelected(true);

  if (get_config_bool("Options", "AutoShowTimeline", true))
    check_autotimeline->setSelected(true);

  // Checked background size
  m_checked_bg->addItem("16x16");
  m_checked_bg->addItem("8x8");
  m_checked_bg->addItem("4x4");
  m_checked_bg->addItem("2x2");
  m_checked_bg->setSelectedItemIndex((int)RenderEngine::getCheckedBgType());

  // Zoom checked background
  if (RenderEngine::getCheckedBgZoom())
    m_checked_bg_zoom->setSelected(true);

  // Checked background colors
  m_checked_bg_color1 = new ColorButton(RenderEngine::getCheckedBgColor1(), IMAGE_RGB);
  m_checked_bg_color2 = new ColorButton(RenderEngine::getCheckedBgColor2(), IMAGE_RGB);

  checked_bg_color1_box->addChild(m_checked_bg_color1);
  checked_bg_color2_box->addChild(m_checked_bg_color2);

  // Reset button
  checked_bg_reset->Click.connect(Bind<void>(&OptionsCommand::onResetCheckedBg, this));

  // Undo limit
  undo_size_limit->setTextf("%d", get_config_int("Options", "UndoSizeLimit", 8));

  // Goto modified frame/layer on undo/redo
  if (get_config_bool("Options", "UndoGotoModified", true))
    undo_goto_modified->setSelected(true);

  // Show the window and wait the user to close it
  window->openWindowInForeground();

  if (window->getKiller() == button_ok) {
    int undo_size_limit_value;

    Editor::set_cursor_color(cursor_color->getColor());
    docSettings->setGridColor(grid_color->getColor());
    docSettings->setPixelGridColor(pixel_grid_color->getColor());

    set_config_bool("Options", "MoveSmooth", check_smooth->isSelected());
    set_config_bool("Options", "AutoShowTimeline", check_autotimeline->isSelected());
    set_config_bool("Options", "MoveClick2", move_click2->isSelected());
    set_config_bool("Options", "DrawClick2", draw_click2->isSelected());

    RenderEngine::setCheckedBgType((RenderEngine::CheckedBgType)m_checked_bg->getSelectedItemIndex());
    RenderEngine::setCheckedBgZoom(m_checked_bg_zoom->isSelected());
    RenderEngine::setCheckedBgColor1(m_checked_bg_color1->getColor());
    RenderEngine::setCheckedBgColor2(m_checked_bg_color2->getColor());

    undo_size_limit_value = undo_size_limit->getTextInt();
//.........这里部分代码省略.........
开发者ID:richardlalancette,项目名称:aseprite,代码行数:101,代码来源:cmd_options.cpp


示例10: assert

void FileSystemActor::onLaunch()
{
	assert(!filePath.isNull());

	if (!_onLaunchHandler.empty())
		_onLaunchHandler(this);

	// override for widgets
	Widget * w = widgetManager->getActiveWidgetForFile(getFullPath());
	if (w && w->isWidgetOverrideActor(this))
	{
		w->launchWidgetOverride(this);
		return;
	}
	
	// Do a quick pass to determine what needs to be created or not
	bool isWatchingHighlighted = cam->isWatchedActorHighlighted(this);
	bool zoomIntoImage = isFileSystemType(Image) && !isWatchingHighlighted && texMgr->isTextureState(thumbnailID, TextureLoaded);
	bool launchImage = (isFileSystemType(Image) && isWatchingHighlighted) && !texMgr->isTextureState(thumbnailID, TextureLoaded);
	bool createTemporaryActor = !zoomIntoImage && !launchImage;
	bool createRandomAnimPath = createTemporaryActor;

	Actor * obj = NULL;
	if (createTemporaryActor)
	{
		obj = new Actor();
		Vec3 startPosition;

		// Set up the state of the Actor
		obj->pushActorType(Temporary);
		obj->setDims(getDims());
		obj->setGravity(false);
		obj->setCollisions(false);
		obj->setAlphaAnim(getAlpha(), 0.2f, 40);
		obj->setGlobalPose(getGlobalPose());
		obj->setObjectToMimic(this);
	}

	// Special case for launching a pileized actor
	Vec3 startPosition;
	if (isPileized())
	{
		startPosition = pileizedPile->getGlobalPosition();
	}else{
		startPosition = getGlobalPosition();
	}

	// create random animation path from the icon up to the camera eye
	if (createRandomAnimPath)
	{
		// Set an animation that moves the icon into the camera
 		CreateRandomAnimPath(obj, startPosition, cam->getEye(), 40);

		// Delete the object after the random animation is over.
		animManager->removeAnimation(obj);
		animManager->addAnimation(AnimationEntry(obj, (FinishedCallBack) DeleteActorAfterAnim));
	}

	// handle the launch override if there is one
	if (!getLaunchOverride().isEmpty())
	{
		fsManager->launchFileAsync(getLaunchOverride());
		return;
	}

	// Execute this Icon
	if (!isFileSystemType(Virtual))
	{
		// If this is a folder, then try and browse to it
		if (scnManager->isShellExtension && isFileSystemType(Folder))
		{			
			// try and send a custom message to the proxy window to move to the child
			incrementNumTimesLaunched();
			animManager->finishAnimation(this);
			SaveSceneToFile();
			winOS->ShellExtBrowseToChild(filePath);
			return;
		}
		// This is an image, so zoom to it if we are not already watching it
		else if (zoomIntoImage && isFileSystemType(Image) && texMgr->isTextureState(thumbnailID, TextureLoaded))
		{
			Key_EnableSlideShow();
			this->putToSleep();

			// record this zoom interaction
			statsManager->getStats().bt.interaction.actors.highlightedImage++;
			return;
		}

		// Execute it as normal
		// QString lnkTarget, lnkArgs, lnkWorkingDir;
		bool fileLaunched = false;
		/*
		if (isFileSystemType(Link))
		{
			fsManager->getShortcutTarget(getFullPath(), &lnkTarget, &lnkArgs, &lnkWorkingDir);
			fileLaunched = fsManager->launchFileAsync(lnkTarget, lnkArgs, lnkWorkingDir);
		}
		else
		*/
//.........这里部分代码省略.........
开发者ID:DX94,项目名称:BumpTop,代码行数:101,代码来源:BT_FileSystemActor.cpp


示例11: assert

void RaceSetupScreen::init()
{
    Screen::init();
    input_manager->setMasterPlayerOnly(true);
    RibbonWidget* w = getWidget<RibbonWidget>("difficulty");
    assert( w != NULL );

    race_manager->setMajorMode(RaceManager::MAJOR_MODE_SINGLE);
    if (UserConfigParams::m_difficulty == RaceManager::DIFFICULTY_BEST &&
        PlayerManager::getCurrentPlayer()->isLocked("difficulty_best"))
    {
        w->setSelection(RaceManager::DIFFICULTY_HARD, PLAYER_ID_GAME_MASTER);
    }
    else
    {
        w->setSelection( UserConfigParams::m_difficulty, PLAYER_ID_GAME_MASTER );
    }

    DynamicRibbonWidget* w2 = getWidget<DynamicRibbonWidget>("gamemode");
    assert( w2 != NULL );
    w2->clearItems();

    // ---- Add game modes
    irr::core::stringw name1 = irr::core::stringw(
        RaceManager::getNameOf(RaceManager::MINOR_MODE_NORMAL_RACE)) + L"\n";
    //FIXME: avoid duplicating descriptions from the help menu!
    name1 +=  _("All blows allowed, so catch weapons and make clever use of them!");

    w2->addItem( name1, IDENT_STD, RaceManager::getIconOf(RaceManager::MINOR_MODE_NORMAL_RACE));

    irr::core::stringw name2 = irr::core::stringw(
        RaceManager::getNameOf(RaceManager::MINOR_MODE_TIME_TRIAL)) + L"\n";
    //FIXME: avoid duplicating descriptions from the help menu!
    name2 += _("Contains no powerups, so only your driving skills matter!");
    w2->addItem( name2, IDENT_TTRIAL, RaceManager::getIconOf(RaceManager::MINOR_MODE_TIME_TRIAL));

    if (PlayerManager::getCurrentPlayer()->isLocked(IDENT_FTL))
    {
        w2->addItem( _("Locked : solve active challenges to gain access to more!"),
            "locked", RaceManager::getIconOf(RaceManager::MINOR_MODE_FOLLOW_LEADER), true);
    }
    else
    {
        irr::core::stringw name3 = irr::core::stringw(
            RaceManager::getNameOf(RaceManager::MINOR_MODE_FOLLOW_LEADER)) + L"\n";
        //I18N: short definition for follow-the-leader game mode
        name3 += _("Keep up with the leader kart but don't overtake it!");
        w2->addItem(name3, IDENT_FTL, RaceManager::getIconOf(RaceManager::MINOR_MODE_FOLLOW_LEADER), false);
    }

    irr::core::stringw name4 = irr::core::stringw(_("Battle")) + L"\n";
    //FIXME: avoid duplicating descriptions from the help menu!
    name4 += _("Hit others with weapons until they lose all their lives.");
    w2->addItem( name4, IDENT_STRIKES, RaceManager::getIconOf(RaceManager::MINOR_MODE_FREE_FOR_ALL));

    irr::core::stringw name5 = irr::core::stringw(
        RaceManager::getNameOf(RaceManager::MINOR_MODE_SOCCER)) + L"\n";
    name5 += _("Push the ball into the opposite cage to score goals.");
    w2->addItem( name5, IDENT_SOCCER, RaceManager::getIconOf(RaceManager::MINOR_MODE_SOCCER));

#define ENABLE_EASTER_EGG_MODE
#ifdef ENABLE_EASTER_EGG_MODE
    if(race_manager->getNumLocalPlayers() == 1)
    {
        irr::core::stringw name1 = irr::core::stringw(
            RaceManager::getNameOf(RaceManager::MINOR_MODE_EASTER_EGG)) + L"\n";
        //FIXME: avoid duplicating descriptions from the help menu!
        name1 +=  _("Explore tracks to find all hidden eggs");

        w2->addItem( name1, IDENT_EASTER,
            RaceManager::getIconOf(RaceManager::MINOR_MODE_EASTER_EGG));
    }
#endif

    irr::core::stringw name6 = irr::core::stringw( _("Ghost replay race")) + L"\n";
    name6 += _("Race against ghost karts and try to beat them!");
    w2->addItem( name6, IDENT_GHOST, "/gui/icons/mode_ghost.png");

    w2->updateItemDisplay();

    // restore saved game mode
    switch (UserConfigParams::m_game_mode)
    {
    case CONFIG_CODE_NORMAL :
        w2->setSelection(IDENT_STD, PLAYER_ID_GAME_MASTER, true);
        break;
    case CONFIG_CODE_TIMETRIAL :
        w2->setSelection(IDENT_TTRIAL, PLAYER_ID_GAME_MASTER, true);
        break;
    case CONFIG_CODE_FTL :
        w2->setSelection(IDENT_FTL, PLAYER_ID_GAME_MASTER, true);
        break;
    case CONFIG_CODE_3STRIKES :
        w2->setSelection(IDENT_STRIKES, PLAYER_ID_GAME_MASTER, true);
        break;
    case CONFIG_CODE_EASTER :
        w2->setSelection(IDENT_EASTER, PLAYER_ID_GAME_MASTER, true);
        break;
    case CONFIG_CODE_SOCCER :
        w2->setSelection(IDENT_SOCCER, PLAYER_ID_GAME_MASTER, true);
//.........这里部分代码省略.........
开发者ID:devnexen,项目名称:stk-code,代码行数:101,代码来源:race_setup_screen.cpp


示例12: GLOBAL


//.........这里部分代码省略.........
			// normal file
			pushFileSystemType(File);
			hasExtension(true); //only files have extension, so the nameable extension hide only applies here

			// resolve some information about the file
			if (ext.size() > 0)
			{
				if (ext == ".exe")
					pushFileSystemType(Executable);
				else
				{
					// XXX: check if it's a document
					// pushFileSystemType(Document);

					if (overrideSystemTextures)
					{
						QString potentialOverrideTex = QString(QT_NT("override.ext")) + ext;
						if (texMgr->hasTexture(potentialOverrideTex))
						{
							texId = potentialOverrideTex;
							detail = HiResImage;
						}
					}
				}

				// load the thumbnail if this is an image
				// NOTE: we append the period because if the extension is empty
				// the search is always true
				if (GLOBAL(supportedExtensions).contains(ext + "."))
				{
					if (!isThumbnailized())
						enableThumbnail(true, !winOS->IsFileInUse(fullPath));
					pushFileSystemType(Image);
					pushFileSystemType(Thumbnail);
					hideText(true);
				}
			}
		}
	}

	// at this point, resolve the file icon texture id if there was no override
	if (texId.isEmpty())
	{
		texId = winOS->GetSystemIconInfo(fullPath);

		// mark the texture for loading
		loadThumbnailTexture(GLTextureObject(Load, texId, texId, detail, priority,false));
	}
	setTextureID(texId);

	// we also want to try and load thumbnails for normal files if they exist
	// (as long as it's not a widget file)
	Widget * w = widgetManager->getActiveWidgetForFile(fullPath);
	if (!isThumbnailized() && (detail == FileIcon) && !w)
	{
		FileSystemActorType typesToIgnore = FileSystemActorType(Executable | Virtual);
		// on vista, just queue the thumbnail for loading
		if (isVista && !isFileSystemType(typesToIgnore))
		{
			QString ext = fsManager->getFileExtension(getTargetPath());
			loadThumbnailTexture(GLTextureObject(Load|Reload, _alternateThumbnailId, getTargetPath(), SampledImage, IdlePriority));
		}
		// on windows xp, check if the thumbs db has a record first
		else if (winOS->IsWindowsVersion(WindowsXP))
		{
			if (texMgr->hasWinThumbnail(getTargetPath()))
			{
				loadThumbnailTexture(GLTextureObject(Load|Reload, _alternateThumbnailId, getTargetPath(), SampledImage, IdlePriority));
			}
		}
	}

	// XXX: (disabled) set the initial dimensions and weight of this file based on it's size
	// setDimsFromFileSize(this);

	// set the text
	if(!isFileSystemType(PhotoFrame)) {
		if (w && w->isWidgetOverrideActor(this))
		{
			setText(w->getWidgetOverrideLabel(this));
			Vec3 actorDims = getDims();
			float aspect = (actorDims.x / actorDims.y);
			Vec3 dims(GLOBAL(settings).xDist, GLOBAL(settings).zDist / aspect, GLOBAL(settings).yDist);
			float scale = w->getWidgetOverrideScale(this);
			if (scale > 0.0f)
			{
				dims *= scale;
				setSizeAnim(getDims(), dims, 25);
			}
		}
		else
			setText(getFileName(isFileSystemType(Link) || isFileSystemType(DeadLink)));
	}
	setRespectIconExtensionVisibility(!isFileSystemType(Folder));


	// New name was set, invalidate text
	textManager->invalidate();
	rndrManager->invalidateRenderer();
}
开发者ID:DX94,项目名称:BumpTop,代码行数:101,代码来源:BT_FileSystemActor.cpp


示例13: if

	Widget* ResourceLayout::createWidget(const WidgetInfo& _widgetInfo, const std::string& _prefix, Widget* _parent, bool _template)
	{
		std::string widgetName = _widgetInfo.name;
		WidgetStyle style = _widgetInfo.style;
		std::string widgetLayer = _widgetInfo.layer;

		if (!widgetName.empty()) widgetName = _prefix + widgetName;

		if (_parent != nullptr && style != WidgetStyle::Popup) widgetLayer.clear();

		IntCoord coord;
		if (_widgetInfo.positionType == WidgetInfo::Pixels) coord = _widgetInfo.intCoord;
		else if (_widgetInfo.positionType == WidgetInfo::Relative)
		{
			if (_parent == nullptr || style == WidgetStyle::Popup)
				coord = CoordConverter::convertFromRelative(_widgetInfo.floatCoord, RenderManager::getInstance().getViewSize());
			else
				coord = CoordConverter::convertFromRelative(_widgetInfo.floatCoord, _parent->getClientCoord().size());
		}

		Widget* wid;
		if (nullptr == _parent)
			wid = Gui::getInstance().createWidgetT(_widgetInfo.type, _widgetInfo.skin, coord, _widgetInfo.align, widgetLayer, widgetName);
		else if (_template)
			wid = _parent->_createSkinWidget(style, _widgetInfo.type, _widgetInfo.skin, coord, _widgetInfo.align, widgetLayer, widgetName);
		else
			wid = _parent->createWidgetT(style, _widgetInfo.type, _widgetInfo.skin, coord, _widgetInfo.align, widgetLayer, widgetName);

		for (VectorStringPairs::const_iterator iter = _widgetInfo.properties.begin(); iter != _widgetInfo.properties.end(); ++iter)
		{
			wid->setProperty(iter->first, iter->second);
		}

		for (MapString::const_iterator iter = _widgetInfo.userStrings.begin(); iter != _widgetInfo.userStrings.end(); ++iter)
		{
			wid->setUserString(iter->first, iter->second);
			if (!_template)
				LayoutManager::getInstance().eventAddUserString(wid, iter->first, iter->second);
		}

		for (VectorWidgetInfo::const_iterator iter = _widgetInfo.childWidgetsInfo.begin(); iter != _widgetInfo.childWidgetsInfo.end(); ++iter)
		{
			createWidget(*iter, _prefix, wid);
		}

		for (std::vector<ControllerInfo>::const_iterator iter = _widgetInfo.controllers.begin(); iter != _widgetInfo.controllers.end(); ++iter)
		{
			MyGUI::ControllerItem* item = MyGUI::ControllerManager::getInstance().createItem(iter->type);
			if (item)
			{
				for (MapString::const_iterator iterProp = iter->properties.begin(); iterProp != iter->properties.end(); ++iterProp)
				{
					item->setProperty(iterProp->first, iterProp->second);
				}
				MyGUI::ControllerManager::getInstance().addItem(wid, item);
			}
			else
			{
				MYGUI_LOG(Warning, "Controller '" << iter->type << "' not found");
			}
		}

		return wid;
	}
开发者ID:alexis-,项目名称:iwe,代码行数:64,代码来源:MyGUI_ResourceLayout.cpp


示例14: doMenu

static void doMenu()
{
	Widget *w;
	int left, right, up, down, attack, xAxisMoved, yAxisMoved;

	left = FALSE;
	right = FALSE;
	up = FALSE;
	down = FALSE;
	attack = FALSE;

	if (menuInput.left == TRUE)
	{
		left = TRUE;
	}

	else if (menuInput.right == TRUE)
	{
		right = TRUE;
	}

	else if (menuInput.up == TRUE)
	{
		up = TRUE;
	}

	else if (menuInput.down == TRUE)
	{
		down = TRUE;
	}

	else if (menuInput.attack == TRUE)
	{
		attack = TRUE;
	}

	else if (input.left == TRUE)
	{
		left = TRUE;
	}

	else if (input.right == TRUE)
	{
		right = TRUE;
	}

	else if (input.up == TRUE)
	{
		up = TRUE;
	}

	else if (input.down == TRUE)
	{
		down = TRUE;
	}

	else if (input.attack == TRUE)
	{
		attack = TRUE;
	}

	if (down == TRUE)
	{
		menu.index++;

		if (menu.index == menu.widgetCount)
		{
			menu.index = 0;
		}

		playSound("sound/common/click");
	}

	else if (up == TRUE)
	{
		menu.index--;

		if (menu.index < 0)
		{
			menu.index = menu.widgetCount - 1;
		}

		playSound("sound/common/click");
	}

	else if (attack == TRUE)
	{
		w = menu.widgets[menu.index];

		if (w->clickAction != NULL)
		{
			w->clickAction();
		}

		playSound("sound/common/click");
	}

	else if (left == TRUE)
	{
		w = menu.widgets[menu.index];
//.........这里部分代码省略.........
开发者ID:revcozmo,项目名称:edgar,代码行数:101,代码来源:cheat_menu.c


示例15: dispose

void Window::dispose() {
    Widget *widget = this;
    while (widget->parent())
        widget = widget->parent();
    ((Screen *) widget)->disposeWindow(this);
}
开发者ID:devmiyax,项目名称:yabause,代码行数:6,代码来源:window.cpp


示例16: center

void Window::center() {
    Widget *widget = this;
    while (widget->parent())
        widget = widget->parent();
    ((Screen *) widget)->centerWindow(this);
}
开发者ID:devmiyax,项目名称:yabause,代码行数:6,代码来源:window.cpp


示例17: detach

void Window::detach(Widget& b)
{
    b.hide();
}
开发者ID:quoji,项目名称:FlipFlaps,代码行数:4,代码来源:Window.cpp


示例18: while

void Gui::render(  )
{
  List<UpdateWidget*>& l = Widget::updatedWidgets();
  if ( l.count() <= 0 ) return;
  int i = l.count() - 1;
  Widget* o = NULL;
  List<Widget*> tmpL;
  l.sort( &objectsListSortCallback );
  while( i >= 0 ){

    o = l.get( i )->o;
    Rect r = l.get( i )->r;

    if ( pFgFrame != NULL )
      fgFrame().getWidgetsInRect( tmpL, r );
    if ( pTopFrame != NULL )
      topFrame().getWidgetsInRect( tmpL, r );

    tmpL.sort( &objectListSortCallback );

    int i2 = 0;
    bool skip = false;
//    int before = tmpL.count();

    while ( (i2 < tmpL.count()) && ( o != NULL ) ) {

      Widget* o2 = tmpL.get( i2 );
			Rect r2( o2->absoluteXPos(), o2->absoluteYPos(), o2->width(), o2->height() );
      if ( o2->border() != NULL ) {
        if ( o2->border()->drawmode() != drawOpaque )
          r2.applyBorder( o2->border() );
      }
			if ( (r2.encloses( r )) && ( o2->drawmode() == drawOpaque ) && ( o2->visible() ) ) {
        if ( o2->zIndex() > o->zIndex() ) {

          skip = true;
          break;
        } else {
          while ( i2+1 < tmpL.count() ) {

            tmpL.remove( i2+1 );
          }
          break;
        }
      }
      i2++;
    }


    if ( !skip ) {

      for( int i2 = tmpL.count() - 1; i2 >= 0; i2-- ){

        Rect r2 = Rect( tmpL.get( i2 )->absoluteXPos(),
                        tmpL.get( i2 )->absoluteYPos(),
                        tmpL.get( i2 )->width(), tmpL.get( i2 )->height() );
        r2.crop( r );

        screen().pushClipRect( r2 );
        screen().pushClipRect( tmpL.get( i2 )->getClipRect() );
        screen().setRelativePoint( tmpL.get( i2 )->absoluteXPos(), tmpL.get( i2 )->absoluteYPos() );

        tmpL.get( i2 )->renderBorder( screen() );

        screen().setRelativePoint( tmpL.get( i2 )->absoluteXPos() + tmpL.get( i2 )->borderLeft(),
                                  tmpL.get( i2 )->absoluteYPos() + tmpL.get( i2 )->borderTop() );
        Rect r3( r2.left - tmpL.get( i2 )->absoluteXPos() - tmpL.get( i2 )->borderLeft(), r2.top - tmpL.get( i2 )->absoluteYPos() - tmpL.get( i2 )->borderTop(), r2.width, r2.height );
        tmpL.get( i2 )->render( screen(), r3 );

        screen().popClipRect();
        screen().popClipRect();
        screen().setRelativePoint( 0, 0 );

      }

      for( int i = 0; i < pPopups.count(); i++ ) {
        Popup* p = pPopups.get( i );
        r.crop( p->getRect() );
        if ( r.area() > 0 ) {
          Rect r = p->getRect();
          r.crop( r );
          p->render( r );
        }
      }
    } else {

    }
    tmpL.clear();
    i--;
  }

  Widget::clearUpdatedWidgets();

}
开发者ID:tc-,项目名称:GameUI,代码行数:94,代码来源:uigui.cpp


示例19: resetKeyFocusWidget

	bool InputManager::injectMousePress(int _absx, int _absy, MouseButton _id)
	{
		Widget* old_key_focus = mWidgetKeyFocus;

		// если мы щелкнули не на гуй
		if (!isFocusMouse())
		{
			resetKeyFocusWidget();

			if (old_key_focus != mWidgetKeyFocus)
				eventChangeKeyFocus(mWidgetKeyFocus);

			return false;
		}

		// если активный элемент заблокирован
		//FIXME
		if (!mWidgetMouseFocus->getEnabled())
			return true;

		if (MouseButton::Left == _id)
		{
			// захват окна
			mLeftMouseCapture = true;
			// запоминаем место нажатия
			if (mLayerMouseFocus != nullptr)
			{
				IntPoint point = mLayerMouseFocus->getPosition(_absx, _absy);
				mLastLeftPressed = point;
			}
		}

		if (MouseButton::Right == _id)
		{
			// захват окна
			mRightMouseCapture = true;
			// запоминаем место нажатия
			if (mLayerMouseFocus != nullptr)
			{
				IntPoint point = mLayerMouseFocus->getPosition(_absx, _absy);
				mLastRightPressed = point;
			}
		}

		// ищем вверх тот виджет который может принимать фокус
		Widget* item = mWidgetMouseFocus;
		while ((item != nullptr) && (!item->getNeedKeyFocus()))
			item = item->getParent();

		// устанавливаем перед вызовом т.к. возможно внутри ктонить п 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ WidgetContainer类代码示例发布时间:2022-05-31
下一篇:
C++ WideString类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap