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

C++ Tooltip类代码示例

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

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



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

示例1: KeyPlayer

void PlayerSlot::displayTooltip(const std::string &area, const std::string &message) {
	ControlMethod *cm = control_method;
	bool delete_cm = false;
	if (cm == NULL) {
		cm = new KeyPlayer("keys");
		delete_cm = true;
	}
	std::string text = I18n->get(area, message);
	
	REPLACE_MAGIC("$fire", fire);
	REPLACE_MAGIC("$altfire", alt_fire);
	REPLACE_MAGIC("$leave", leave);
	REPLACE_MAGIC("$hint_control", hint_control);
	REPLACE_MAGIC("$left", left);
	REPLACE_MAGIC("$right", right);
	REPLACE_MAGIC("$up", up);
	REPLACE_MAGIC("$down", down);
	
	if (delete_cm)
		delete cm;
	
	Tooltip *tooltip = new Tooltip(area, message, text, true);
	if (tooltips.empty()) {
		GameMonitor->onTooltip("show", PlayerManager->get_slot_id(id), area, message);	
	}
	tooltips.push(PlayerSlot::Tooltips::value_type(tooltip->getReadingTime(), tooltip));
}
开发者ID:sorokin,项目名称:btanks,代码行数:27,代码来源:player_slot.cpp


示例2: getItemAtPoint

/*************************************************************************
    Handler for mouse movement
*************************************************************************/
void Listbox::onMouseMove(MouseEventArgs& e)
{
    if (d_itemTooltips)
    {
        static ListboxItem* lastItem = 0;

        ListboxItem* item = getItemAtPoint(e.position);
        if (item != lastItem)
        {
            if (item)
            {
                setTooltipText(item->getTooltipText());
            }
            else
            {
                setTooltipText("");
            }
            lastItem = item;
        }

        // must check the result from getTooltip(), as the tooltip object could
        // be 0 at any time for various reasons.
        Tooltip* tooltip = getTooltip();

        if (tooltip)
        {
            if (tooltip->getTargetWindow() != this)
                tooltip->setTargetWindow(this);
            else
                tooltip->positionSelf();
        }
    }

    Window::onMouseMove(e);
}
开发者ID:AgresivD,项目名称:ivmultiplayer,代码行数:38,代码来源:CEGUIListbox.cpp


示例3: Tooltip_Hide

/**
  || Function
  || --------
  || static void Tooltip_Hide(void *p)
  ||
  || Description
  || -----------
  || sets the Tooltip to not showing (internal func)
  ||
  || Parameters
  || ----------
  || void *p: the Tooltip object
  ||
  || Returns
  || -------
  || nothing
  ||
  || Remarks
  || -------
  ||
  */
static void Tooltip_Hide(void *p)
{
    Tooltip *me = (Tooltip *)p;

    me->bShown = FALSE;

    me->pfnInvalidate(me->pInvalidateData);
}
开发者ID:virqin,项目名称:brew_code,代码行数:29,代码来源:tooltip.c


示例4: wndProc

LRESULT CALLBACK Tooltip::wndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
{
	Tooltip* pthis = NULL;

	pthis = (Tooltip*)GetWindowLongPtr( hwnd, GWLP_USERDATA );
	if( pthis )
		return pthis->wndProc(msg, wp, lp);
	return DefWindowProc(hwnd, msg, wp, lp );
}
开发者ID:HUANG-YI-CHEN,项目名称:windows-chewing,代码行数:9,代码来源:Tooltip.cpp


示例5: Tooltip_Show

/**
  || Function
  || --------
  || static void Tooltip_Show(void *p)
  ||
  || Description
  || -----------
  || sets the Tooltip to showing (internal func)
  ||
  || Parameters
  || ----------
  || void *p: the Tooltip
  ||
  || Returns
  || -------
  || nothing
  ||
  || Remarks
  || -------
  ||
  */
static void Tooltip_Show(void *p)
{
    Tooltip *me = (Tooltip *)p;

    me->bShown = TRUE;

    me->pfnInvalidate(me->pInvalidateData);

    CALLBACK_Init(&me->cb,Tooltip_Hide,me);
    ISHELL_SetTimerEx(me->piShell,me->ulExpires,&me->cb);
}
开发者ID:virqin,项目名称:brew_code,代码行数:32,代码来源:tooltip.c


示例6: getTextSize

    Sizef FalagardTooltip::getTextSize() const
    {
        Tooltip* w = (Tooltip*)d_window;
        Sizef sz(w->getTextSize_impl());

        // get WidgetLookFeel for the assigned look.
        const WidgetLookFeel& wlf = getLookNFeel();

        const Rectf textArea(wlf.getNamedArea("TextArea").getArea().getPixelRect(*w));
        const Rectf wndArea(CoordConverter::asAbsolute(w->getArea(), w->getParentPixelSize()));

        sz.d_width  = CoordConverter::alignToPixels(sz.d_width + wndArea.getWidth() - textArea.getWidth());
        sz.d_height = CoordConverter::alignToPixels(sz.d_height + wndArea.getHeight() - textArea.getHeight());
        return sz;
    }
开发者ID:AjaxWang1989,项目名称:cegui,代码行数:15,代码来源:Tooltip.cpp


示例7: tolua_app_open

bool GlobalClient::initUI()
{
#ifdef USE_UI

//  	char szUiDataDir[][24] = 
//  	{
// // 		"animal",
//  // 		"animationset",
// 		"font",
// 		"image",
// 		"imageset",
// 		"layout",
// 		"lua",
// 		"setting",
// 		"ui_effect"
//  	};

	tolua_app_open(mLuaEngine->GetLuaState());
	using namespace rktgui;
	PROFILE("initUI");
	IRenderSystem* renderSystem = mRenderEngine->getRenderSystem();
	mGuiRenderer = new TxGuiRenderer(renderSystem);
	new System(mGuiRenderer, mTimerAxis);
	System::getSingleton().setScriptingModule(mLuaEngine);	

// 	std::string strBaseUiDir = "Data\\UI\\";
// 	for(int i = 0 ; i< sizeof(szUiDataDir)/sizeof(szUiDataDir[0]); i++)
// 	{
// 		std::string strPath = strBaseUiDir;
// 		strPath += szUiDataDir[i];
// 		rkt::getFileSystem()->addFindPath(strPath.c_str());
// 	}

	//fire display size changed event.
	rktgui::EventArgs ea;
	rktgui::System::getSingletonPtr()->getRenderer()->fireEvent(rktgui::Renderer::EventDisplaySizeChanged,ea);


		System::getSingleton().executeScriptFile("init.lua");	
	
		Tooltip* tip = (Tooltip*) WindowManager::getSingleton().createWindow("UNLLook/HtmlTooltip","rocket-tooltip");
		System::getSingleton().setDefaultTooltip(tip);
		tip->setPosition(UVector2(UDim(0.0f,20.0f), UDim(0.0f,20.0f)));
		tip->setSize(UVector2(UDim(0.0f,20.0f), UDim(0.0f,20.0f)));
		tip->setFadeTime(0.0f);
		tip->setHoverTime(0.0f);
		tip->setAlwaysOnTop(true);
		tip->setTooltipText("<html><body></body></html>");
	
#endif
	return true;
}
开发者ID:lorichen,项目名称:xgame,代码行数:52,代码来源:GlobalClient.cpp


示例8: posi

/*************************************************************************
    Handler for mouse movement
*************************************************************************/
void Tree::onMouseMove(MouseEventArgs& e)
{
    if (d_itemTooltips)
    {
        static TreeItem* lastItem = 0;
        
        Vector2f posi(CoordConverter::screenToWindow(*this, e.position));
        //      Point posi = relativeToAbsolute(CoordConverter::screenToWindow(*this, e.position));
        TreeItem* item = getItemAtPoint(posi);
        if (item != lastItem)
        {
            if (item != 0)
            {
                setTooltipText(item->getTooltipText());
            }
            else
            {
                setTooltipText("");
            }
            lastItem = item;
        }
        
        // must check the result from getTooltip(), as the tooltip object could
        // be 0 at any time for various reasons.
        Tooltip* tooltip = getTooltip();
        
        if (tooltip)
        {
            if (tooltip->getTargetWindow() != this)
                tooltip->setTargetWindow(this);
            else
                tooltip->positionSelf();
        }
    }
    
    Window::onMouseMove(e);
}
开发者ID:respu,项目名称:xsilium-engine,代码行数:40,代码来源:Tree.cpp


示例9: 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();
	}

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

	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)) {
			lastRedraw = _system->getMillis(true);
			_theme->updateScreen();
			_system->updateScreen();
		}

		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) {
				processEvent(event, getTopDialog());
				continue;		
			}
			
			processEvent(event, activeDialog);
			

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

		if (_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();
				delete tooltip;
			}
		}

		// Delay for a moment
		_system->delayMillis(10);
	}
//.........这里部分代码省略.........
开发者ID:OmerMor,项目名称:scummvm,代码行数:101,代码来源:gui-manager.cpp


示例10: main

int main() {
    srand(time(0));
    map<sf::Keyboard::Key, bool> keys;
    bool running = true;
    sf::RenderWindow window;
    Vec2i mouse;

    initializeGame();
    if(Game::map.size()==0)
        Game::map.push_back(vector<Game::TileType>(1, Game::TileType::EmptyTile));


    sf::IntRect towersPanel(sf::Vector2i(Game::map.size()*Game::pixelsPerSquare,100),
                            Game::towerManager->getDrawRectSize()),
                                 upgradesPanel(0,Game::map[0].size()*Game::pixelsPerSquare,
                                         towersPanel.left+towersPanel.width,200);


    window.create(sf::VideoMode(upgradesPanel.left+upgradesPanel.width,
                                upgradesPanel.top+upgradesPanel.height), "Tower Defense", sf::Style::Titlebar|sf::Style::Close);
    window.setFramerateLimit(60);


    glViewport(0, 0, window.getSize().x, window.getSize().y);
    glOrtho(0,window.getSize().x, window.getSize().y,0, 0,1);

    glEnable (GL_BLEND);
    glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

    bool paused = false;

    Tooltip* tooltip = nullptr;
    TowerType* placingTower = nullptr;

    while(running && window.isOpen()) {
        sf::Event ev;
        while(window.pollEvent(ev)) {
            switch(ev.type) {
            case sf::Event::Closed:
                running = false;
                break;
            case sf::Event::MouseMoved:
                mouse.x = ev.mouseMove.x;
                mouse.y = ev.mouseMove.y;
                break;
            case sf::Event::KeyPressed:
                keys[ev.key.code] = true;
                if(ev.key.code == sf::Keyboard::Space) {
                    paused = !paused;
                } else if(ev.key.code == sf::Keyboard::Return) {
                    Game::clearEnemies();
                    Game::clearEntities();
                    Game::clearTowers();
                    Game::life = 20;
                    Game::money = 1500;
                    Game::tickCount = 0;
                }
                break;
            case sf::Event::KeyReleased:
                keys[ev.key.code] = false;
                break;
            case sf::Event::MouseButtonPressed:
                SetFocus(window.getSystemHandle());
                if(ev.mouseButton.button == sf::Mouse::Left) {
                    Vec2i p = Vec2i(mouse.x,mouse.y)/Game::pixelsPerSquare;
                    if(Game::map.size()>p.x && p.x>=0
                            && Game::map[p.x].size()>p.y && p.y>=0) {
                        bool mustDeselect = true;
                        if(Game::map[p.x][p.y] == Game::TileType::EmptyTile) {
                            if(placingTower != nullptr && Game::money >= placingTower->cost) {
                                Game::money -= placingTower->cost;
                                Tower* t = placingTower->model->clone();
                                t->setPosition(p);
                                if(!Game::putTower(t))
                                    delete t;
                                else
                                    mustDeselect = false;
                            }
                        } else if(Game::map[p.x][p.y] == Game::TileType::TowerTile) {
                            Game::selectedTower = Game::getTower(Vec2i(mouse.x,mouse.y)/Game::pixelsPerSquare);
                            mustDeselect = false;
                        }
                        if(mustDeselect)
                            Game::selectedTower = nullptr;
                    }
                    placingTower = nullptr;
                } else if(ev.mouseButton.button == sf::Mouse::Right) {
                    Vec2i p = Vec2i(mouse.x,mouse.y)/Game::pixelsPerSquare;
                    if(Game::map[p.x][p.y] == Game::TileType::TowerTile) {
                        Tower* t = Game::removeTower(p);
                        if(t==nullptr) {
                            cout << "ERROR DELETING TOWER" << endl;
                        } else {
                            Game::money += Game::towerManager->getTowerCost(t->getId());
                            delete t;
                        }
                    }
                }
                break;
            default:
//.........这里部分代码省略.........
开发者ID:ivancea,项目名称:TowerDefense,代码行数:101,代码来源:main.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ TooltipData类代码示例发布时间:2022-05-31
下一篇:
C++ Tools类代码示例发布时间: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