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


C++ TextButton::getHeight方法代码示例

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


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

示例1: drawButtonText

void NonShinyLookAndFeel::drawButtonText (Graphics& g, TextButton& button,
                                  bool /*isMouseOverButton*/, bool /*isButtonDown*/)
{
    Font font (getFontForTextButton (button));
	if (button.getToggleState())
		font.setBold(true);
	g.setFont (font);
    g.setColour (button.findColour (button.getToggleState() ? TextButton::textColourOnId
                                                            : TextButton::textColourOffId)
                       .withMultipliedAlpha (button.isEnabled() ? 1.0f : 0.5f));

    const int yIndent = jmin (4, button.proportionOfHeight (0.3f));
    const int cornerSize = jmin (button.getHeight(), button.getWidth()) / 2;

    const int fontHeight = roundToInt (font.getHeight() * 0.6f);
    const int leftIndent  = jmin (fontHeight, 2 + cornerSize / (button.isConnectedOnLeft() ? 4 : 2));
    const int rightIndent = jmin (fontHeight, 2 + cornerSize / (button.isConnectedOnRight() ? 4 : 2));

    g.drawFittedText (button.getButtonText(),
                      leftIndent,
                      yIndent,
                      button.getWidth() - leftIndent - rightIndent,
                      button.getHeight() - yIndent * 2,
                      Justification::centred, 2);
}
开发者ID:Amcut,项目名称:pizmidi,代码行数:25,代码来源:LookAndFeel.cpp

示例2: drawButtonText

void ProjucerLookAndFeel::drawButtonText (Graphics& g, TextButton& button, bool isMouseOverButton, bool isButtonDown)
{
    ignoreUnused (isMouseOverButton, isButtonDown);

    g.setFont (getTextButtonFont (button, button.getHeight()));

    g.setColour (button.findColour (button.getToggleState() ? TextButton::textColourOnId
                                                            : TextButton::textColourOffId)
                                   .withMultipliedAlpha (button.isEnabled() ? 1.0f
                                                                            : 0.5f));

    auto xIndent = jmin (8, button.getWidth() / 10);
    auto yIndent = jmin (3,  button.getHeight() / 6);

    auto textBounds = button.getLocalBounds().reduced (xIndent, yIndent);

    g.drawFittedText (button.getButtonText(), textBounds, Justification::centred, 3, 1.0f);
}
开发者ID:azeteg,项目名称:HISE,代码行数:18,代码来源:jucer_ProjucerLookAndFeel.cpp

示例3: drawButtonText

void mlrVSTLookAndFeel::drawButtonText (Graphics& g, TextButton& button,
                                        bool /*isMouseOverButton*/, bool isButtonDown)
{
    g.setFont(defaultFont);

    if (isButtonDown)
        g.setColour(button.findColour(TextButton::textColourOnId));
    else
        g.setColour(button.findColour(TextButton::textColourOffId));

    g.drawFittedText (button.getButtonText(), 4, 4,
        button.getWidth() - 2, button.getHeight() - 8,
        Justification::centredLeft, 10);
}
开发者ID:grimtraveller,项目名称:mlrVST,代码行数:14,代码来源:mlrVSTLookAndFeel.cpp

示例4: addDisabledTextButton

int InstructionsMenu::addDisabledTextButton(const string &text, int x, int y, bool isHeader)
{
	TextButton *txtBut = new TextButton();
	txtBut->setText(text);	
	txtBut->setX(x);
	txtBut->setY(y);
	txtBut->setEnabled(false);
	txtBut->setTextColor(INSTR_R, INSTR_G, INSTR_B);
	if (isHeader) {
		txtBut->setTextSize(HEADER_TEXT_SIZE);	
	} else {
		txtBut->setTextSize(STANDARD_TEXT_SIZE);
	}
	m_buttons.push_back(txtBut);
	return txtBut->getHeight() + BUTTON_SEP;	
}
开发者ID:firehazard,项目名称:SphereWars,代码行数:16,代码来源:InstructionsMenu.cpp

示例5: init

void InstructionsMenu::init()
{
	TextButton *txtBut;
	int yPos;
	
	setTitle("Controls");
	
	yPos = initControlsDisplay();

	// Init back button.
	txtBut = new TextButton();
	txtBut->setText("Back");
	txtBut->setX(txtBut->getCenteredXPos());
	txtBut->setY(yPos);
	m_buttons.push_back(txtBut);
	yPos += txtBut->getHeight() + BUTTON_SEP;
	
}
开发者ID:firehazard,项目名称:SphereWars,代码行数:18,代码来源:InstructionsMenu.cpp

示例6: State

/**
 * Initializes all the elements in the Multiple Targets window.
 * @param game Pointer to the core game.
 * @param targets List of targets to display.
 * @param craft Pointer to craft to retarget (NULL if none).
 * @param state Pointer to the Geoscape state.
 */
MultipleTargetsState::MultipleTargetsState(Game *game, std::vector<Target*> targets, Craft *craft, GeoscapeState *state) : State(game), _targets(targets), _craft(craft), _state(state)
{
	_screen = false;

	if (_targets.size() > 1)
	{
		int winHeight = BUTTON_HEIGHT * _targets.size() + SPACING * (_targets.size() - 1) + MARGIN * 2;
		int winY = (200 - winHeight) / 2;
		int btnY = winY + MARGIN;

		// Create objects
		_window = new Window(this, 136, winHeight, 60, winY, POPUP_VERTICAL);

		// Set palette
		setPalette("PAL_GEOSCAPE", 7);

		add(_window);

		// Set up objects
		_window->setColor(Palette::blockOffset(8) + 5);
		_window->setBackground(_game->getResourcePack()->getSurface("BACK15.SCR"));

		int y = btnY;
		for (size_t i = 0; i < _targets.size(); ++i)
		{
			TextButton *button = new TextButton(116, BUTTON_HEIGHT, 70, y);
			button->setColor(Palette::blockOffset(8) + 5);
			button->setText(_targets[i]->getName(_game->getLanguage()));
			button->onMouseClick((ActionHandler)&MultipleTargetsState::btnTargetClick);
			add(button);

			_btnTargets.push_back(button);

			y += button->getHeight() + SPACING;
		}
		_btnTargets[0]->onKeyboardPress((ActionHandler)&MultipleTargetsState::btnCancelClick, Options::keyCancel);

		centerAllSurfaces();
	}
}
开发者ID:ArcticPheenix,项目名称:OpenXcom,代码行数:47,代码来源:MultipleTargetsState.cpp


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