void cBorderGump::setGump(unsigned short id, unsigned short hue, bool forceupdate) { if (forceupdate || this->id != id || this->hue != hue) { clear(); // Clear all children this->id = id; this->hue = hue; // Upper Left uleft = new cGumpImage(id, hue); uleft->update(); addControl(uleft); // Upper Right uright = new cGumpImage(id + 2, hue); uright->update(); addControl(uright); // Lower Left lleft = new cGumpImage(id + 6, hue); lleft->update(); addControl(lleft); // Lower Right lright = new cGumpImage(id + 8, hue); lright->update(); addControl(lright); // Top top = new cTiledGumpImage(id + 1, hue); top->update(); addControl(top); // Left left = new cTiledGumpImage(id + 3, hue); left->update(); addControl(left); // Right right = new cTiledGumpImage(id + 5, hue); right->update(); addControl(right); // Bottom bottom = new cTiledGumpImage(id + 7, hue); bottom->update(); addControl(bottom); // Center center = new cTiledGumpImage(id + 4, hue); center->update(); addControl(center); alignControls(); // Align the controls } }
MidiBoxItem::MidiBoxItem( const string& text, bool state ) : GridBoxItem() { label_ = new Label( CRect( 0,0,0,0 ), text ); label_->font_ = fontArial9; label_->indent_ = CPoint( 3, 0 ); addControl( label_ ); checkbox_ = new Checkbox( CRect( 0,0,0,0 ), this, 0, state ); checkbox_->tickSize_ = CPoint( 7, 7 ); addControl( checkbox_ ); setColors(); }
GearPropertiesDialog::GearPropertiesDialog(QWidget *parent, Gear *gear, Engine *engine) : QDialog(parent, "Properties", true), _gear(gear), _engine(engine) { setCaption("Properties"); _verticalLayout = new Q3VBoxLayout(this, 12, 12, "layout"); std::vector<Property*> properties; _gear->settings().getAll(&properties); //create all PropertieControls for the gear for (std::vector<Property*>::iterator it=properties.begin(); it!=properties.end(); ++it) addControl((*it)); //ok cancels Q3HBoxLayout *hLayout = new Q3HBoxLayout(2); _okButton = new QPushButton("Ok", this); hLayout->addWidget(_okButton); QObject::connect(_okButton, SIGNAL(clicked()), this, SLOT(slotOK())); _cancelButton = new QPushButton("Cancel", this); QObject::connect(_cancelButton, SIGNAL(clicked()), this, SLOT(accept())); hLayout->addWidget(_cancelButton); _verticalLayout->addLayout(hLayout); }
GuiDropDownList* GuiPane::addDropDownList (const GuiText& caption, const Array<GuiText>& list, const Pointer<int>& pointer, const GuiControl::Callback& actionCallback) { return addControl(new GuiDropDownList(this, caption, pointer, list, actionCallback)); }
void InputManager::addControls(QList<Control> controls) { for(QList<Control>::Iterator it = controls.begin() ; it != controls.end() ; it++) { addControl(*it); } }
void ControllersControlGroupDialog::setControlUI(QString ControlPath) { QFile* UiFile = new QFile("./Controllers/" + ControlPath + ".ui"); if (!UiFile->exists()) { QMessageBox::warning(this, tr("UI File"), tr("Cannot found file %1:\n%2.") .arg(UiFile->fileName()) .arg(UiFile->errorString())); this->rejected(); return; } if (!UiFile->open(QFile::ReadOnly | QFile::Text)) { QMessageBox::warning(this, tr("SAX Bookmarks"), tr("Cannot read file %1:\n%2.") .arg(UiFile->fileName()) .arg(UiFile->errorString())); this->rejected(); return; } QUiLoader uiLoader; ui->ControlUI->layout()->addWidget(uiLoader.load(UiFile)); connect(ui->ControlAdd, SIGNAL(pressed()), this, SLOT(addControl())); return; }
DialogExtraControls::DialogExtraControls(QWidget *parent) : QDialog(parent), m_ui(new Ui::DialogExtraControls) { m_ui->setupUi(this); m_ui->btnUp->setIcon(style()->standardIcon(QStyle::StandardPixmap(QStyle::SP_ArrowUp))); m_ui->btnDown->setIcon(style()->standardIcon(QStyle::StandardPixmap(QStyle::SP_ArrowDown))); m_ui->btnAdd->setIcon(QtIconLoader::icon("list-add", QIcon(":/vpiano/list-add.svg"))); m_ui->btnRemove->setIcon(QtIconLoader::icon("list-remove", QIcon(":/vpiano/list-remove.svg"))); connect( m_ui->btnAdd, SIGNAL(clicked()), SLOT(addControl()) ); connect( m_ui->btnRemove, SIGNAL(clicked()), SLOT(removeControl()) ); connect( m_ui->btnUp, SIGNAL(clicked()), SLOT(controlUp()) ); connect( m_ui->btnDown, SIGNAL(clicked()), SLOT(controlDown()) ); connect( m_ui->extraList, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), SLOT(itemSelected(QListWidgetItem *, QListWidgetItem*)) ); connect( m_ui->txtLabel, SIGNAL(textEdited(QString)), SLOT(labelEdited(QString)) ); connect( m_ui->spinController, SIGNAL(valueChanged(int)), SLOT(controlChanged(int)) ); connect( m_ui->cboControlType, SIGNAL(currentIndexChanged(int)), SLOT(typeChanged(int)) ); connect( m_ui->chkSwitchDefOn, SIGNAL(toggled(bool)), SLOT(defOnChanged(bool)) ); connect( m_ui->spinKnobDef, SIGNAL(valueChanged(int)), SLOT(defaultChanged(int)) ); connect( m_ui->spinSpinDef, SIGNAL(valueChanged(int)), SLOT(defaultChanged(int)) ); connect( m_ui->spinSliderDef, SIGNAL(valueChanged(int)), SLOT(defaultChanged(int)) ); connect( m_ui->spinKnobMax, SIGNAL(valueChanged(int)), SLOT(maximumChanged(int)) ); connect( m_ui->spinSpinMax, SIGNAL(valueChanged(int)), SLOT(maximumChanged(int)) ); connect( m_ui->spinSliderMax, SIGNAL(valueChanged(int)), SLOT(maximumChanged(int)) ); connect( m_ui->spinKnobMin, SIGNAL(valueChanged(int)), SLOT(minimumChanged(int)) ); connect( m_ui->spinSpinMin, SIGNAL(valueChanged(int)), SLOT(minimumChanged(int)) ); connect( m_ui->spinSliderMin, SIGNAL(valueChanged(int)), SLOT(minimumChanged(int)) ); connect( m_ui->spinValueOff, SIGNAL(valueChanged(int)), SLOT(minimumChanged(int)) ); connect( m_ui->spinValueOn, SIGNAL(valueChanged(int)), SLOT(maximumChanged(int)) ); connect( m_ui->spinSliderSize, SIGNAL(valueChanged(int)), SLOT(sizeChanged(int)) ); connect( m_ui->spinValue, SIGNAL(valueChanged(int)), SLOT(minimumChanged(int)) ); connect( m_ui->btnFileSyx, SIGNAL(clicked()), SLOT(openFile()) ); }
void PluckerBookReader::safeAddControl(FBTextKind kind, bool start) { if (myParagraphStarted) { addControl(kind, start); } else { myDelayedControls.push_back(std::pair<FBTextKind,bool>(kind, start)); } }
bool UI_Box::loadFile(IStream& rStream) { if (UI_Object::loadFile(rStream) == false) return false; ISTREAM_READFLOAT(rStream, &m_fOffsetX); ISTREAM_READFLOAT(rStream, &m_fOffsetY); int nSize; ISTREAM_READINT(rStream, &nSize); for (int i = 0; i < nSize; ++i) { // read class string CStringW strClassName; ISTREAM_READSTRING(rStream, &strClassName); // create class instance UI_Widget* pControl = createControl(strClassName); if(pControl == NULL) return false; // load class if(!pControl->loadFile(rStream)) return false; // add to list if(!addControl(pControl)) return false; } return true; }
// This function is used in your Ship need those parts. // This special Messagebox can hold up to 4 images void CMessageBoxVort::addTileAt(Uint16 tile, Uint16 x, Uint16 y) { CTilemap &tilemap = g_pGfxEngine->getTileMap(1); const int tileDim = tilemap.getDimension(); // now we'll create a new surface on which the Tile will be printed. SDL_Rect rect; rect.x = rect.y = 0; rect.w = rect.h = tileDim; SmartPointer<SDL_Surface> bmpSfc = CG_CreateRGBSurface(rect); SDL_FillRect(bmpSfc.get(), NULL, 0xFFFFFFFF); tilemap.drawTile(bmpSfc.get(), 0, 0, tile); rect.x = x; rect.y = y; CRect<float> fRect( x, y, 16.0f, 16.0f); CRect<float> gameRect = g_pVideoDriver->getGameResolution(); fRect.transformInverse(gameRect); fRect.transform(mRect); SmartPointer<CBitmap> pBitmap = new CBitmap(bmpSfc); addControl( new CGUIBitmap(pBitmap), fRect ); }
void cContextMenu::addEntry(const QString &name, unsigned short hue, int id) { cContextMenuEntry *entry = new cContextMenuEntry(name, hue); entry->update(); entry->setId(id); entries.append(entry); addControl(entry); }
void BookReader::addStyleCloseEntry() { addControl(REGULAR, false); //used instead in XHTMLReader //TODO implement ZLTextModel::addStyleCloseEntry() // if (paragraphIsOpen()) { // flushTextBufferToParagraph(); // myCurrentTextModel->addStyleCloseEntry(); // } }
void cContextMenu::show(int x, int y) { if (!border) { border = new cBorderGump(0xa3c); border->setAlign(CA_CLIENT); border->setMoveHandle(false); addControl(border, true); } if (!checkerboard) { cSurface *surface = new cSurface(64, 64, false); int black = surface->color(0, 0, 0, 0); int white = surface->color(255, 255, 255, 255); for (int x = 0; x < 64; ++x) { for (int y = 0; y < 64; ++y) { if (y % 2 == 0) { if (x % 2 == 0) { surface->setPixel(x, y, white); } else { surface->setPixel(x, y, black); } } else { if (x % 2 == 0) { surface->setPixel(x, y, black); } else { surface->setPixel(x, y, white); } } } } checkerboard = new cTexture(surface, false); delete surface; } if (!parent_) { Gui->addControl(this); } int totalheight = 0; int maxwidth = 0; // Iterate over all known controls and see how high this thing is Iterator it; for (it = entries.begin(); it != entries.end(); ++it) { (*it)->setPosition(10, 10 + totalheight); // Reposition the entry totalheight += (*it)->height(); if ((*it)->width() > maxwidth) { maxwidth = (*it)->width(); } } // Resize the contextmenu setSize(20 + maxwidth, 22 + totalheight); setPosition(x, y); setVisible(true); }
//-------------------------------------------------------------- Gui::Gui() : Container(NULL, "ofxMSAControlFreakGui") { doDraw = true; // _pActiveControl = NULL; _pGuiControls = new GuiControls(this); addControl(_pGuiControls); enableAllEvents(); setDefaultKeys(false); }
group_siteObject(openLogin &lin, cgiScript & script):objectBase(lin,script) { // add fields addField( "id", FIELD_TYPE_LONGLONG ); addField( "group_id", FIELD_TYPE_LONGLONG ); addField( "site_id", FIELD_TYPE_LONGLONG ); // add controls addControl( "id", staticEntry( "id", "10" ) ); addControl( "group_id", cmboEntry( "group_id", "select id, name from groups order by name", "Select a group: " ) ); addControl( "site_id", cmboEntry( "site_id", "select id, name from sites order by name", "Select a site: " ) ); // set name setName("group_sites"); }
void PluckerBookReader::safeBeginParagraph() { if (!myParagraphStarted) { myParagraphStarted = true; myBufferIsEmpty = true; beginParagraph(); if (!myParagraphStored) { myParagraphVector->push_back(model().bookTextModel()->paragraphsNumber() - 1); myParagraphStored = true; } for (std::vector<std::pair<FBTextKind,bool> >::const_iterator it = myDelayedControls.begin(); it != myDelayedControls.end(); ++it) { addControl(it->first, it->second); } if (myForcedEntry != 0) { addControl(*myForcedEntry); } else { addControl(REGULAR, true); } for (std::vector<std::string>::const_iterator it = myDelayedHyperlinks.begin(); it != myDelayedHyperlinks.end(); ++it) { addHyperlinkControl(INTERNAL_HYPERLINK, *it); } myDelayedHyperlinks.clear(); } }
void DocBookBookReader::startElementHandler(int tag, const char **) { switch (tag) { case _SECT1: myReadText = true; pushKind(REGULAR); beginContentsParagraph(); break; case _PARA: if (myReadText) { beginParagraph(); } break; case _TITLE: enterTitle(); pushKind(SECTION_TITLE); if (myReadText) { beginParagraph(); } break; case _EMPHASIS: addControl(EMPHASIS, true); break; case _CITETITLE: addControl(CITE, true); break; case _ULINK: case _EMAIL: addControl(CODE, true); break; case _BLOCKQUOTE: pushKind(STRONG); break; default: break; } }
GuiButton* GuiPane::addButton(const GuiText& text, const GuiControl::Callback& callback, GuiTheme::ButtonStyle style) { GuiButton* b = new GuiButton(this, callback, text, style); addControl(b); Vector2 size((float)BUTTON_WIDTH, (float)CONTROL_HEIGHT); // Ensure that the button is wide enough for the caption const Vector2& bounds = theme()->minButtonSize(text, style); if (style == GuiTheme::NORMAL_BUTTON_STYLE) { size = size.max(bounds); } else { size.x = max((float) TOOL_BUTTON_WIDTH, bounds.x); } b->setSize(size); return b; }
GuiRadioButton* GuiPane::addRadioButton(const GuiText& text, int myID, const Pointer<int>& ptr, GuiTheme::RadioButtonStyle style) { GuiRadioButton* c = addControl(new GuiRadioButton(this, text, myID, ptr, style)); Vector2 size((float)BUTTON_WIDTH, (float)CONTROL_HEIGHT); // Ensure that the button is wide enough for the caption const Vector2& bounds = theme()->minButtonSize(text, (style == GuiTheme::TOOL_RADIO_BUTTON_STYLE) ? GuiTheme::TOOL_BUTTON_STYLE : GuiTheme::NORMAL_BUTTON_STYLE); if (style == GuiTheme::TOOL_RADIO_BUTTON_STYLE) { c->setSize(Vector2(max((float)TOOL_BUTTON_WIDTH, bounds.x), CONTROL_HEIGHT)); } else if (style == GuiTheme::BUTTON_RADIO_BUTTON_STYLE) { c->setSize(Vector2(max((float)BUTTON_WIDTH, bounds.x), CONTROL_HEIGHT)); } return c; }
GuiCheckBox* GuiPane::addCheckBox (const GuiText& text, const Pointer<bool>& pointer, GuiTheme::CheckBoxStyle style) { GuiCheckBox* c = addControl(new GuiCheckBox(this, text, pointer, style)); Vector2 size(0, CONTROL_HEIGHT); if (style == GuiTheme::TOOL_CHECK_BOX_STYLE) { Vector2 bounds = theme()->minButtonSize(text, GuiTheme::TOOL_BUTTON_STYLE); size.x = max(float(TOOL_BUTTON_WIDTH), bounds.x); } else { size.x = BUTTON_WIDTH; Vector2 bounds = theme()->minButtonSize(text, GuiTheme::NORMAL_BUTTON_STYLE); size = size.max(bounds); } c->setSize(size); return c; }
CMessageBox::CMessageBox(const std::string& Text, bool lower, bool keymsg, bool leftbound, const FXState fx) : CGUIDialog(GsRect<float>(0.1f, 0.1f, 0.8f, 0.8f), fx), m_mustclose(false) { const char closeChar = 0x1F; std::string closeString; closeString = closeChar; GsRect<float> closeButtonRect(0.0f, 0.0f, (0.06f)/0.8f, (0.06f)/0.8f); GsRect<float> facRect( gVideoDriver.getGameResFactors() ); closeButtonRect.transformInverse(facRect); mpTextCtrl = new CGUIText( Text ); // Those formulas work well with our constellation but I don't think they are perfect. // They transform the Message Box the way the text fits perfectly in. const float screenW = gVideoDriver.getGameResolution().w; const float screenH = gVideoDriver.getGameResolution().h; mRect.w = static_cast<float>( (mpTextCtrl->mTextDim.w+4)*8 )/screenW; mRect.h = static_cast<float>( (mpTextCtrl->mTextDim.h+2)*8 )/screenH; mRect.x = (1.0f - mRect.w)/2.0f; mRect.y = (1.0f - mRect.h)/2.0f; // now let's center that long text... GsRect<float> TextRect; TextRect.w = ((mpTextCtrl->mTextDim.w*8)/screenW) / mRect.w; TextRect.h = ((mpTextCtrl->mTextDim.h*8)/screenH) / mRect.h; TextRect.x = (2.5f*TextRect.w)/(static_cast<float>(mpTextCtrl->mTextDim.w)); TextRect.y = (1.0f*TextRect.h)/(static_cast<float>(mpTextCtrl->mTextDim.h)); if(lower) // if lower is enabled, try to snap the Dlg to the bottom off the screen. { mRect.y = 1.0f - mRect.h; } addControl( mpTextCtrl, TextRect ); updateBackground(); }
// This function is used in your Ship need those parts. // This special Messagebox can hold up to 4 images void CMessageBoxVort::addTileAt(Uint16 tile, Uint16 x, Uint16 y) { GsTilemap &tilemap = gGraphics.getTileMap(1); const int tileDim = tilemap.getDimension(); // now we'll create a new surface on which the Tile will be printed. SDL_Rect rect; rect.x = rect.y = 0; rect.w = rect.h = tileDim; #if SDL_VERSION_ATLEAST(2, 0, 0) std::shared_ptr<SDL_Surface> bmpSfc( CG_CreateRGBSurface( rect ), &SDL_FreeSurface ); bmpSfc.reset(gVideoDriver.convertThroughBlitSfc(bmpSfc.get()), &SDL_FreeSurface); #else std::shared_ptr<SDL_Surface> bmpSfc( CG_CreateRGBSurface(rect), &SDL_FreeSurface ); #endif SDL_FillRect(bmpSfc.get(), NULL, 0xFF00FFFF); tilemap.drawTile(bmpSfc.get(), 0, 0, tile); rect.x = x; rect.y = y; GsRect<float> fRect( x, y, 16.0f, 16.0f); GsRect<float> gameRect = gVideoDriver.getGameResolution(); fRect.transformInverse(gameRect); GsRect<float> scaleRect = mRect; scaleRect.x = 0; scaleRect.y = 0; fRect.transformInverse(scaleRect); std::shared_ptr<GsBitmap> pBitmap(new GsBitmap(bmpSfc)); addControl( new CGUIBitmap(pBitmap), fRect ); }
GuiRadioButton* GuiPane::addRadioButton(const GuiText& text, int myID, void* selection, GuiTheme::RadioButtonStyle style) { GuiRadioButton* c = addControl (new GuiRadioButton(this, text, myID, Pointer<int>(reinterpret_cast<int*>(selection)), style)); Vector2 size(0, (float)CONTROL_HEIGHT); if (style == GuiTheme::TOOL_RADIO_BUTTON_STYLE) { Vector2 bounds = theme()->minButtonSize(text, GuiTheme::TOOL_BUTTON_STYLE); size.x = max(float(TOOL_BUTTON_WIDTH), bounds.x); } else if (style == 1) { // Doesn't compile on gcc unless we put the integer in. GuiTheme::BUTTON_RADIO_BUTTON_STYLE) { size.x = BUTTON_WIDTH; Vector2 bounds = theme()->minButtonSize(text, GuiTheme::NORMAL_BUTTON_STYLE); size = size.max(bounds); } else { // NORMAL_RADIO_BUTTON_STYLE Vector2 bounds = theme()->minButtonSize(text, GuiTheme::NORMAL_BUTTON_STYLE); size.x = bounds.x; } c->setSize(size); return c; }
mail_groupObject(openLogin &lin, cgiScript & script):objectBase(lin,script) { // add fields addField( "id", pgLongOid ); addField( "group_id", pgLongOid ); addField( "name", pgVarCharArrayOid ); addField( "description", pgVarCharArrayOid ); addField( "created", pgTimestampOid ); addField( "created_by", pgLongOid ); addField( "modified", pgTimestampOid ); addField( "modified_by", pgLongOid ); // add controls addControl( "id", staticEntry( "id", "10" ) ); if( lin.SiteAdmin() ) { addControl( "group_id", cmboEntry( "group_id", "select id, name from groups order by name", "Select a group: " ) ); } else { addControl( "group_id", hiddenEntry( "group_id" ) ); } addControl( "name", textEntry( "name", "32" ) ); addControl( "description", areaEntry( "description" ) ); addControl( "created", staticEntry( "created", "24" ) ); addControl( "modified", staticEntry( "modified", "24" ) ); // set name setName("mail_groups"); }
void CGUIDialog::addControl( CGUIControl *newControl ) { std::unique_ptr<CGUIControl> ctrl(newControl); addControl(ctrl); }
void CGUIDialog::addControl( CGUIControl *newControl, const CRect<float>& RelRect ) { std::unique_ptr<CGUIControl> ctrl(newControl); addControl( ctrl, RelRect ); }
ofxSimpleGuiComboBox &ofxSimpleGuiPage::addComboBox(string name, int &choice_out, int numChoices, const char** choiceTitles) { return (ofxSimpleGuiComboBox &)addControl(* new ofxSimpleGuiComboBox(name, choice_out, numChoices, this, choiceTitles)); }
ofxSimpleGuiColorPicker &ofxSimpleGuiPage::addColorPicker(string name, float *values) { return (ofxSimpleGuiColorPicker &)addControl(* new ofxSimpleGuiColorPicker(name, values)); }
ofxSimpleGuiToggle &ofxSimpleGuiPage::addToggle(string name, bool &value) { return (ofxSimpleGuiToggle &)addControl(* new ofxSimpleGuiToggle(name, value)); }
ofxSimpleGuiTitle &ofxSimpleGuiPage::addTitle(string name, float height) { return (ofxSimpleGuiTitle &)addControl(* new ofxSimpleGuiTitle(name, height)); }