Пример #1
0
PaddingWrap<RpWidget>::PaddingWrap(
	QWidget *parent,
	object_ptr<RpWidget> &&child,
	const style::margins &padding)
: Parent(parent, std::move(child)) {
	setPadding(padding);
}
Пример #2
0
CharacterModule::CharacterModule() : characterPortrait(NULL)
{
   characterStats = new gcn::contrib::AdjustingContainer();
   characterNameLabel = new edwt::Label();
   characterHPLabel = new edwt::Label();
   characterSPLabel = new edwt::Label();

   characterNameLabel->setForegroundColor(0xFFFFFF);
   characterHPLabel->setForegroundColor(0xFFFFFF);
   characterSPLabel->setForegroundColor(0xFFFFFF);

   characterPortrait = new edwt::Icon();

   characterStats->setNumberOfColumns(1);
   characterStats->setColumnAlignment(0, gcn::contrib::AdjustingContainer::LEFT);
   characterStats->add(characterNameLabel);
   characterStats->add(characterHPLabel);
   characterStats->add(characterSPLabel);
   characterStats->setOpaque(false);

   setNumberOfColumns(2);
   setColumnAlignment(0, gcn::contrib::AdjustingContainer::LEFT);
   setColumnAlignment(1, gcn::contrib::AdjustingContainer::RIGHT);
   setHorizontalSpacing(10);
   setPadding(5, 5, 5, 5);

   add(characterPortrait);
   add(characterStats);
   addMouseListener(this);
   setOpaque(false);
}
Пример #3
0
void SelectLevelState::onInitialize()
{
    auto scene = addScene(new Scene("SelectLevel"));

    auto camnode = scene->addChildNode(new dt::Node("camnode"));
    camnode->setPosition(Ogre::Vector3(0, 0, 10));
    camnode->addComponent(new dt::CameraComponent("cam"))->lookAt(Ogre::Vector3(0, 0, 0));
    
    //************************************************************
    //The following lines are for test purpose only.
    //Todo: Replace them with the actual content.
    Ogre::FontManager::getSingleton().load("DejaVuSans", "General");

    auto node1 = scene->addChildNode(new dt::Node("node1"));
    auto text1 = node1->addComponent(new dt::TextComponent("Select Level", "text1"));
    text1->setBackgroundMaterial("TextOverlayBackground");
    text1->setColor(Ogre::ColourValue::White);
    text1->setFont("DejaVuSans");
    text1->setFontSize(72);
    text1->setPadding(Ogre::Vector2(20, 20));

    GuiRootWindow& rootWindow = GuiManager::get()->getRootWindow();
    mReturnButton = rootWindow.addChildWidget<GuiButton>(new GuiButton("return"));

    mReturnButton->setPosition(100, 100);
    mReturnButton->setSize(250, 100);
    mReturnButton->setCaption("Return");
    dynamic_cast<MyGUI::Button*>(mReturnButton->getMyGUIWidget())->eventMouseButtonClick
        += MyGUI::newDelegate(this, &SelectLevelState::onReturnClick);
    //************************************************************
}
Пример #4
0
Layout::Layout() :
    LayoutCell(),
    mComputed(false)
{
    getArray();
    setPadding(6);
}
Пример #5
0
  NpcDialog::NpcDialog():
    XWindow(),
    gcn::ActionListener()
  {
    setBaseColor(gcn::Color(190, 208, 247, 128));
    setPadding(3);
    setSize(300, 400);
    //setAlignment(gcn::Graphics::LEFT);
    setShowCloseBtn(true);
    setVisible(true);
    setTitleBarHeight(25);

    mTextBox = new XTextBox();
    mTextBox->setWidth(300);
    mTextBox->setTextWrapped("你好,小伙子。你能帮我挑点水么?我老了,干不动体力活儿了。如果你能帮助我,我会给你一些奖励的。");
    mTextBox->setEditable(false);

    this->add(mTextBox, 0, 0);

    mListBox = new XListBox();
    mListModel = new XListModel();
    mListModel->addElement("好的。");
    mListModel->addElement("不了,谢谢!");
    mListBox->setListModel(mListModel);
    this->add(mListBox, 0, mTextBox->getHeight() + 20);
  }
Пример #6
0
KstBorderedViewObject::KstBorderedViewObject(const KstBorderedViewObject& borderedViewObject)
: KstViewObject(borderedViewObject) {
  setBorderColor(borderedViewObject.borderColor());
  setBorderWidth(borderedViewObject.borderWidth());
  setMargin(borderedViewObject.margin());
  setPadding(borderedViewObject.padding());
}
Пример #7
0
UINodeBackground::UINodeBackground (IFrontend *frontend, const std::string& title, bool showVehicle) :
		UINode(frontend), _showVehicle(showVehicle), _title(title)
{
	setPadding(getScreenPadding());
	setSize(1.0, 1.0f);
	setBackgroundColor(colorBlack);
	_cave = loadTexture("ui-scene-cave-ice");
	_vehicle = loadTexture("ui-scene-player");
	_caveArt = loadTexture("ui-scene-caveart-ice");
	_imageWidth = _cave->getWidth();
	_imageHeight = _cave->getHeight();
	_amountHorizontal = _imageWidth <= 0 ? 1 : getRenderWidth(false) / _imageWidth + 1;
	_amountVertical = _imageHeight <= 0 ? 1 : getRenderHeight(false) / _imageHeight + 1;

	const TexturePtr& tile1 = loadTexture("ui-scene-tile1-ice");
	if (tile1)
		_tiles.push_back(tile1);
	const TexturePtr& tile2 = loadTexture("ui-scene-tile2-ice");
	if (tile2)
		_tiles.push_back(tile2);

	_font = getFont(LARGE_FONT);
	Vector4Set(colorWhite, _fontColor);
	_textWidth = _font->getTextWidth(_title);
	_textHeight = _font->getTextHeight(_title);
}
UINodeBackgroundScene::UINodeBackgroundScene (IFrontend *frontend) :
		UINode(frontend), _reason(&MapFailedReasons::FAILED_NO), _theme(&ThemeTypes::ROCK)
{
	setPadding(getScreenPadding());
	setSize(1.0, 1.0f);
	setBackgroundColor(colorBlack);
	_caveOffIce = loadTexture("ui-scene-cave-ice");
	_caveArtIce = loadTexture("ui-scene-caveart-ice");
	_caveOffRock = loadTexture("ui-scene-cave-rock");
	_caveArtRock = loadTexture("ui-scene-caveart-rock");
	_imageWidth = _caveOffIce->getWidth();
	_imageHeight = _caveOffIce->getHeight();
	_amountHorizontal = getRenderWidth(false) / _imageWidth + 1;
	_amountVertical = getRenderHeight(false) / _imageHeight + 1;

	_tilesIce.push_back(loadTexture("ui-scene-tile1-ice"));
	_tilesIce.push_back(loadTexture("ui-scene-tile2-ice"));
	_groundsIce.push_back(loadTexture("ui-scene-ground1-ice"));
	_groundsIce.push_back(loadTexture("ui-scene-ground2-ice"));
	_tilesRock.push_back(loadTexture("ui-scene-tile1-rock"));
	_tilesRock.push_back(loadTexture("ui-scene-tile2-rock"));
	_groundsRock.push_back(loadTexture("ui-scene-ground1-rock"));
	_groundsRock.push_back(loadTexture("ui-scene-ground2-rock"));

	_failed[&MapFailedReasons::FAILED_WATER_HEIGHT] = loadTexture("dead-waterheight");
	_failed[&MapFailedReasons::FAILED_HITPOINTS] = loadTexture("dead-hitpoints");
	_failed[&MapFailedReasons::FAILED_SIDESCROLL] = loadTexture("dead-hitpoints");
	_failed[&MapFailedReasons::FAILED_NPC_FLYING] = loadTexture("dead-npc-flying");
	_failed[&MapFailedReasons::FAILED_NPC_WALKING] = loadTexture("dead-npc-walking");
	_failed[&MapFailedReasons::FAILED_NPC_FISH] = loadTexture("dead-npc-fish");
	_failed[&MapFailedReasons::FAILED_NPC_MAMMUT] = loadTexture("dead-npc-mammut");
	_failed[&MapFailedReasons::FAILED_NO_MORE_PLAYERS] = loadTexture("dead-hitpoints");
}
Пример #9
0
        FormIO(GUI::Context& mCtx)
            : GUI::Form{mCtx, "IO", Vec2f{300.f, 300.f}, Vec2f{100.f, 100.f}},
              mainStrip(create<GUI::Strip>(
                  GUI::At::Top, GUI::At::Bottom, GUI::At::Bottom)),
              lblCurrentPath(mainStrip.create<GUI::Label>("CURRENT: null")),
              tboxFilename(mainStrip.create<GUI::TextBox>(
                  getStyle().getBtnSizePerChar(14))),
              stripBtns(mainStrip.create<GUI::Strip>(
                  GUI::At::Left, GUI::At::Right, GUI::At::Right)),
              btnSave(stripBtns.create<GUI::Button>(
                  "save", getStyle().getBtnSizePerChar(6))),
              btnLoad(stripBtns.create<GUI::Button>(
                  "load", getStyle().getBtnSizePerChar(6)))
        {
            setScaling(GUI::Scaling::FitToChildren);
            setResizable(false);
            setPadding(2.f);

            mainStrip.attach(GUI::At::Center, *this, GUI::At::Center);
            mainStrip.setPadding(2.f);

            tboxFilename.setString("./level.lvl");

            btnSave.onLeftClick += [this]
            {
                if(!tboxFilename.getString().empty())
                    onSave(tboxFilename.getString());
            };
            btnLoad.onLeftClick += [this]
            {
                if(!tboxFilename.getString().empty())
                    onLoad(tboxFilename.getString());
            };
        }
Пример #10
0
    void ASCIIFormat::setFormatLinearData(const void* data, size_t* indexByte)
    {
        memcpy(&d_formatLinear, &reinterpret_cast<const unsigned char*>(data)[*indexByte], sizeof(d_formatLinear));
        (*indexByte) += sizeof(d_formatLinear);

        setASCIILength(d_formatLinear.d_asciiLength);
        setPadding(d_formatLinear.d_padding);
    }
Пример #11
0
	virtual void initialize()
	{
		Panel::initialize();

		setLayout(boost::make_shared<GridTransformerRendererLayout>());
		setBorder(boost::make_shared<gluit::SimpleBorder>());
		setPadding(0);
	}
Пример #12
0
Button::Button(SDL_Rect pos, const char *title) : Widget(pos) {
    this->frame.x = pos.x;
    this->frame.y = pos.y;
    this->frame.w = pos.w;
    this->frame.h = pos.h;
    this->value = std::string(title);
    setMargin(6, 6, 6, 6);
    setPadding(6, 6, 6, 6);
}
Пример #13
0
 //-----------------------------------------------------------------------
 //                          T G S c r o l l B o x 
 //-----------------------------------------------------------------------
 TGScrollBox::TGScrollBox(TGControl *parent, TGString name)
     : TGControl(parent, name)
 {
     setPadding(2, 2, 14, 16);
     hScroll = 0.0f;
     vScroll = 0.0f;
     scrolling = 0;
     setScrollingBounds(1, 1);
 }
Пример #14
0
void Node::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *ev)
{
    QString new_text = QInputDialog::getText(ev->widget(), QObject::tr("Редактирование текста"), QObject::tr("Введите новый текст"), QLineEdit::Normal, text);
    if (!new_text.isEmpty())
    {
        setText(new_text);
        setPadding(getPadding().width(), getPadding().height());
    }
}
Пример #15
0
ProgressBar::ProgressBar(const Widget2 *const widget,
                         float progress,
                         const int width,
                         const int height,
                         const ProgressColorIdT backColor,
                         const std::string &skin,
                         const std::string &skinFill) :
    Widget(widget),
    WidgetListener(),
    mFillRect(),
    mTextChunk(),
    mSkin(nullptr),
    mProgress(progress),
    mProgressToGo(progress),
    mBackgroundColorToGo(),
    mText(),
    mVertexes(new ImageCollection),
    mProgressPalette(backColor),
    mPadding(2),
    mFillPadding(3),
    mFillImage(false),
    mSmoothProgress(true),
    mSmoothColorChange(true),
    mTextChanged(true)
{
    mBackgroundColor = Theme::getProgressColor(
        backColor >= ProgressColorId::PROG_HP
        ? backColor : ProgressColorId::PROG_HP,
        mProgress);
    mBackgroundColorToGo = mBackgroundColor;
    mForegroundColor2 = getThemeColor(ThemeColorId::PROGRESS_BAR_OUTLINE);

    // The progress value is directly set at load time:
    if (mProgress > 1.0F || mProgress < 0.0F)
        mProgress = 1.0F;

    mForegroundColor = getThemeColor(ThemeColorId::PROGRESS_BAR);
    addWidgetListener(this);
    setSize(width, height);

    if (theme)
    {
        mSkin = theme->load(skin, "progressbar.xml");
        if (mSkin)
        {
            setPadding(mSkin->getPadding());
            mFillPadding = mSkin->getOption("fillPadding");
            mFillImage = mSkin->getOption("fillImage") != 0;
            if (mFillImage)
                theme->loadRect(mFillRect, skinFill, "progressbar_fill.xml");
        }
        setHeight(2 * mPadding + getFont()->getHeight() + 2);
    }

    mInstances++;
}
Пример #16
0
void SshOutgoingPacket::finalize()
{
    setPadding();
    setLengthField(m_data);
    m_length = m_data.size() - 4;
    qCDebug(sshLog, "Encrypting packet of type %u", m_data.at(TypeOffset));
    encrypt();
    qCDebug(sshLog, "Sending packet of size %d", rawData().count());
    Q_ASSERT(isComplete());
}
TouchScreenArea::TouchScreenArea(char *text, unsigned int foreColor, unsigned int backColor, unsigned int x, unsigned int y, unsigned int w, unsigned int h, unsigned int fontSize, unsigned int padding){
    _controller = &TSC;
    setPadding(padding);
    setText(text);
    setForeColor(foreColor);
    setBackColor(backColor);
    setFontSize(fontSize);
    setPosition(x,y);
    _w = w;
    _h = h;
}
Пример #18
0
void Dialog::setLayout(Widget * contents, Widget * buttons) {
	LinearContainer * container = new LinearContainer();
	container->setVertical();
	container->setSpacing(8);
	container->addWidget(contents);
	container->addWidget(buttons);

	setPadding(8);

	setContent(container);
}
Пример #19
0
void ComplexTextController::setupForRTL()
{
    int padding = m_padding;
    // FIXME: this causes us to shape the text twice -- once to compute the width and then again
    // below when actually rendering. Change ComplexTextController to match platform/mac and
    // platform/chromium/win by having it store the shaped runs, so we can reuse the results.
    reset(m_offsetX + widthOfFullRun());
    // We need to set the padding again because ComplexTextController layout consumed the value.
    // Fixing the above problem would help here too.
    setPadding(padding);
}
void SshOutgoingPacket::finalize()
{
    setPadding();
    setLengthField(m_data);
    m_length = m_data.size() - 4;
#ifdef CREATOR_SSH_DEBUG
    qDebug("Encrypting packet of type %u", m_data.at(TypeOffset));
#endif
    encrypt();
    Q_ASSERT(isComplete());
}
Пример #21
0
 Window::Window()
         :mMoved(false)
 {
     setFrameSize(1);
     setPadding(2);
     setTitleBarHeight(16);
     setAlignment(Graphics::CENTER);
     addMouseListener(this);
     setMovable(true);
     setOpaque(true);
 }
Пример #22
0
HarfBuzzShaper::HarfBuzzShaper(const Font* font, const TextRun& run)
    : HarfBuzzShaperBase(font, run)
    , m_fromIndex(0)
    , m_toIndex(m_run.length())
{
    m_normalizedBuffer = adoptArrayPtr(new UChar[m_run.length() + 1]);
    m_normalizedBufferLength = m_run.length();
    normalizeCharacters(m_run.characters16(), m_normalizedBuffer.get(), m_normalizedBufferLength);
    setPadding(m_run.expansion());
    setFontFeatures();
}
TouchScreenArea::TouchScreenArea(char *text){
    _controller = &TSC;
    setPadding(5);
    setText(text);
    setForeColor(0xffff);
    setBackColor(0x0000);
    setFontSize(2);
    setPosition(0,0);
    _w = 0;
    _h = 0;
}
Пример #24
0
KstViewLegend::KstViewLegend(const QDomElement& e)
: KstBorderedViewObject(e) {

  // some defaults and invariants
  _fallThroughTransparency = false;
  _container = false;
  _type = "Legend";
  _rotation = 0.0;
  _fontName = KstApp::inst()->defaultFont();
  _vertical = true;
  _isResizable = false;
  _fontSize = -1;
  setFontSize(0);
  _layoutActions &= ~(MoveTo | Copy | CopyTo);
  _standardActions |= Delete | Edit;
  _legendMargin = 5;
  _parsedTitle = 0L;
  _trackContents = true;

  QStringList ctaglist;

  // read the properties
  QDomNode n = e.firstChild();
  while (!n.isNull()) {
    QDomElement el = n.toElement();
    if (!el.isNull()) {
      if (metaObject()->indexOfProperty(el.tagName().toLatin1()) > -1) {
        setProperty(el.tagName().toLatin1(), QVariant(el.text()));
      } else if (el.tagName() == "curvetag") {
        ctaglist.append(el.text()); 
      }
    }
    n = n.nextSibling();
  }
  if (!_title.isEmpty()) {
    reparseTitle();
  }

  KstBaseCurveList l = kstObjectSubList<KstDataObject,KstBaseCurve>(KST::dataObjectList);
  KstBaseCurveList::ConstIterator end = l.end();
  for (QStringList::ConstIterator str = ctaglist.begin(); str != ctaglist.end(); ++str) {
    KstBaseCurveList::ConstIterator it = l.findTag(*str);
    if (it != end) {
      addCurve(*it);
    }
  }
  
  // Padding was incorrectly saved as 5 in Kst <= 1.2.0 so we need to strip it
  // out here since this object is buggy.  Remove this once padding is properly
  // supported?  Maybe, but geometries are then wrong.
  if (e.ownerDocument().documentElement().attribute("version") == "1.2") {
    setPadding(0);
  }
}
Пример #25
0
RoutingPlugin::RoutingPlugin( const MarbleModel *marbleModel ) :
    AbstractFloatItem( marbleModel, QPointF( -10, -10 ) ),
    d( new RoutingPluginPrivate( this ) )
{
    setEnabled( true );
    //plugin is visible by default on small screen devices
    setVisible( MarbleGlobal::getInstance()->profiles() & MarbleGlobal::SmallScreen );
    setPadding( 0.5 );
    setBorderWidth( 1 );
    setBackground( QBrush( QColor( "white" ) ) );
}
Пример #26
0
IUIMapWindow::IUIMapWindow (IFrontend *frontend, ServiceProvider& serviceProvider, CampaignManager& campaignManager, IUINodeMap* nodeMap, bool continuousMovement) :
		UIWindow(UI_WINDOW_MAP, frontend, WINDOW_FLAG_MODAL | WINDOW_FLAG_FULLSCREEN), _nodeMap(nodeMap), _waitLabel(nullptr), _mapControl(nullptr),
		_startButton(nullptr), _serviceProvider(serviceProvider), _panel(nullptr), _lastFingerPressEvent(0L), _cursorActive(false), _continuousMovement(continuousMovement) {
	const float screenPadding = getScreenPadding();
	setPadding(screenPadding);
	_playClickSound = false;
	_musicFile = "music-2";
	_onPop = CMD_CL_DISCONNECT;
	_nodeMap->setId(UINODE_MAP);
	add(_nodeMap);
}
TouchScreenMenu::TouchScreenMenu(TouchScreenMenuItem items[]){
    _controller = &TSC;
    setSpacing(5);
    setPadding(2);
    setFontSize(2);
    setTitleFontSize(2);
    setJustification(LEFTJ);
    setItems(items);
    setTitle(NULL);
    setTitleColors(0xffff, 0x001f);
    setClearScreenOnDraw(false);
}
TouchScreenMenu::TouchScreenMenu(TouchScreenMenuItem items[], unsigned int fontSize, unsigned int spacing, unsigned int padding, Justify justify, char *title){
    _controller = &TSC;
    setSpacing(spacing);
    setPadding(padding);
    setFontSize(fontSize);
    setTitleFontSize(2);
    setJustification(justify);
    setItems(items);
    setTitle(title);
    setTitleColors(0xffff, 0x001f);
    setClearScreenOnDraw(false);
}
Пример #29
0
 Window::Window(const std::string& caption)
         :mIsMoving(false)
 {
     setCaption(caption);
     setBorderSize(1);
     setPadding(2);
     setTitleBarHeight(16);
     setAlignment(Graphics::CENTER);
     addMouseListener(this);
     setMovable(true);
     setOpaque(true);
 }
Пример #30
0
 Window::Window(const std::string& caption)
         :mMoved(false)
 {
     setCaption(caption);
     setFrameSize(1);
     setPadding(2);
     setTitleBarHeight(16);
     setAlignment(Graphics::Center);
     addMouseListener(this);
     setMovable(true);
     setOpaque(true);
 }