void CWindowHandler::loadColor(int i) { ui.labelOmbre1Color->setText(CLoaderRecipe::getLoaderRecipe()->getShadow1(ui.comboBoxName->currentText())); ui.labelLumiere1Color->setText(CLoaderRecipe::getLoaderRecipe()->getLight(ui.comboBoxName->currentText())); ui.labelBaseColor->setText(CLoaderRecipe::getLoaderRecipe()->getBase(ui.comboBoxName->currentText())); ui.labelOmbre2Color->setText(CLoaderRecipe::getLoaderRecipe()->getShadow2(ui.comboBoxName->currentText())); ui.labelOmbre1Name->setText(CColorList::getColorList()->getName(ui.labelOmbre1Color->text())); ui.labelOmbre2Name->setText(CColorList::getColorList()->getName(ui.labelOmbre2Color->text())); ui.labelLumiereName->setText(CColorList::getColorList()->getName(ui.labelLumiere1Color->text())); ui.labelBaseName->setText(CColorList::getColorList()->getName(ui.labelBaseColor->text())); ui.labelBaseColorHex->setStyleSheet(getStyleSheet(ui.labelBaseColor->text())); ui.labelLumiere1ColorHex->setStyleSheet(getStyleSheet(ui.labelLumiere1Color->text())); ui.labelOmbre1ColorHex->setStyleSheet(getStyleSheet(ui.labelOmbre1Color->text())); ui.labelOmbre2ColorHex->setStyleSheet(getStyleSheet(ui.labelOmbre2Color->text())); }
void ScrolledImage::init(bool sManageChild) { /* Get the style sheet: */ const StyleSheet* ss=getStyleSheet(); /* Set the compound widget's borders: */ setBorderWidth(ss->textfieldBorderWidth); setBorderType(Widget::LOWERED); /* Disable the image's borders: */ //image->setBorderWidth(image->getBorderWidth()); //image->setBorderType(Widget::PLAIN); /* Initialize the horizontal scroll bar: */ horizontalScrollBar->setPositionRange(0,image->getImage().getSize(0),image->getImage().getSize(0)); horizontalScrollBar->getValueChangedCallbacks().add(this,&ScrolledImage::scrollBarCallback); /* Initialize the vertical scroll bar: */ verticalScrollBar->setPositionRange(0,image->getImage().getSize(1),image->getImage().getSize(1)); verticalScrollBar->getValueChangedCallbacks().add(this,&ScrolledImage::scrollBarCallback); /* Manage the children: */ image->manageChild(); horizontalScrollBar->manageChild(); verticalScrollBar->manageChild(); /* Manage me: */ if(sManageChild) manageChild(); }
TextFieldSlider::TextFieldSlider(const char* sName,Container* sParent,GLint sCharWidth,GLfloat sShaftLength,bool sManageChild) :Container(sName,sParent,false), textField(new TextField("TextField",this,sCharWidth,false)), slider(new Slider("Slider",this,Slider::HORIZONTAL,sShaftLength,false)), sliderMapping(LINEAR),valueType(FLOAT), valueMin(0.0),valueMax(1000.0),valueIncrement(1.0),value(500.0) { /* Get the style sheet: */ const StyleSheet* ss=getStyleSheet(); /* Initialize the compound widget: */ setBorderWidth(0.0f); setBorderType(PLAIN); spacing=ss->size; /* Initialize the text field: */ textField->setEditable(true); textField->getValueChangedCallbacks().add(this,&TextFieldSlider::textFieldValueChangedCallback); /* Initialize the slider: */ slider->getValueChangedCallbacks().add(this,&TextFieldSlider::sliderValueChangedCallback); /* Manage the children: */ textField->manageChild(); slider->manageChild(); /* Manage me: */ if(sManageChild) manageChild(); }
NewButton::NewButton(const char* sName,Container* sParent,const char* sLabel,bool sManageChild) :SingleChildContainer(sName,sParent,false), isArmed(false) { /* Get the style sheet: */ const StyleSheet* ss=getStyleSheet(); /* Button defaults to raised border: */ setBorderType(Widget::RAISED); setBorderWidth(ss->buttonBorderWidth); /* Set the armed background color: */ armedBackgroundColor=ss->buttonArmedBackgroundColor; /* Create the label child widget: */ Label* label=new Label("ButtonLabel",this,sLabel); label->setBorderType(Widget::PLAIN); label->setBorderWidth(0.0f); /* Button defaults to some margin: */ label->setMarginWidth(ss->buttonMarginWidth); /* Button defaults to centered text: */ label->setHAlignment(GLFont::Center); /* Manage me: */ if(sManageChild) manageChild(); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); this->modelMsgList = new MessageListWidget(this); ui->scrollArea->setStyleSheet("background: white;"); ui->scrollArea->setWidget(modelMsgList); this->setStyleSheet(getStyleSheet()); this->xplPortUsed = -1; this->connected = false; this->xplSocket = NULL; this->hbeatTimer = NULL; this->setupToolBar(); connect(this, SIGNAL(xPLMessageReceived(xPLMessage)), modelMsgList, SLOT(add(xPLMessage))); connect(ui->actionQuit, SIGNAL(triggered()), qApp, SLOT(quit())); try { this->initializeXPLNetwork(); } catch(const QString& exception) { qDebug() << exception; } }
ColorBar::ColorBar(const char* sName,Container* sParent,GLfloat sColorBarHeight,int sTickMarkLabelPrecision,int sNumTickMarks,bool sManageChild) :Widget(sName,sParent,false), colorBarHeight(sColorBarHeight), valueMin(0.0),valueMax(1.0), colorMap(0), font(0), tickMarkLabelPrecision(sTickMarkLabelPrecision), numTickMarks(sNumTickMarks),tickMarks(new TickMark[numTickMarks]), tickMarksVersion(1) { /* Get the style sheet: */ const StyleSheet* ss=getStyleSheet(); /* Get the margin width: */ marginWidth=ss->containerMarginWidth; /* Get the font: */ font=ss->font; /* Get the tick mark height: */ tickMarkHeight=font->getTextHeight(); tickMarkWidth=tickMarkHeight*0.5f; /* Calculate the tick mark label separation: */ tickMarkLabelSeparation=font->getCharacterWidth()*2.0f; /* Initialize the tick marks: */ updateTickMarks(); /* Manage me: */ if(sManageChild) manageChild(); }
ScrolledListBox::ScrolledListBox(const char* sName,Container* sParent,ListBox::SelectionMode sSelectionMode,int sPreferredWidth,int sPreferredPageSize,bool sManageChild) :Container(sName,sParent,false), listBox(new ListBox("ListBox",this,sSelectionMode,sPreferredWidth,sPreferredPageSize,false)), verticalScrollBar(new ScrollBar("VerticalScrollBar",this,ScrollBar::VERTICAL,true,false)), horizontalScrollBar(0) { /* Get the style sheet: */ const StyleSheet* ss=getStyleSheet(); /* Set the compound widget's borders: */ setBorderWidth(ss->textfieldBorderWidth); setBorderType(Widget::LOWERED); /* Initialize the list box: */ listBox->setBorderWidth(0.0f); listBox->setBorderType(Widget::PLAIN); listBox->getPageChangedCallbacks().add(this,&ScrolledListBox::listBoxPageChangedCallback); /* Initialize the vertical scroll bar: */ verticalScrollBar->setPositionRange(0,0,listBox->getPageSize()); verticalScrollBar->getValueChangedCallbacks().add(this,&ScrolledListBox::scrollBarCallback); /* Manage the children: */ listBox->manageChild(); verticalScrollBar->manageChild(); /* Manage me: */ if(sManageChild) manageChild(); }
Pager::Pager(const char* sName,Container* sParent,bool sManageChild) :Container(sName,sParent,false), nextChildIndex(0),nextPageIndex(0),addingPageButton(false), currentChildIndex(0) { /* Get the style sheet: */ const StyleSheet* ss=getStyleSheet(); /* Set the child widget margin: */ marginWidth=ss->containerMarginWidth; /* Manage this widget if requested: */ if(sManageChild) manageChild(); }
NewButton::NewButton(const char* sName,Container* sParent,bool sManageChild) :SingleChildContainer(sName,sParent,false), isArmed(false) { /* Get the style sheet: */ const StyleSheet* ss=getStyleSheet(); /* Button defaults to raised border: */ setBorderType(Widget::RAISED); setBorderWidth(ss->buttonBorderWidth); /* Set the armed background color: */ armedBackgroundColor=ss->buttonArmedBackgroundColor; /* Manage me: */ if(sManageChild) manageChild(); }
void Menu::addChild(Widget* newChild) { /* Get the style sheet: */ const StyleSheet* ss=getStyleSheet(); /* Set the child's border: */ newChild->setBorderWidth(ss->menuButtonBorderWidth); /* If the child is a label: Left-align its text */ Label* newLabel=dynamic_cast<Label*>(newChild); if(newLabel!=0) newLabel->setHAlignment(GLFont::Left); /* Call the parent class widget's routine: */ RowColumn::addChild(newChild); /* If the child is a button: Set the child's select callback to point to us: */ Button* newButton=dynamic_cast<Button*>(newChild); if(newButton!=0) newButton->getSelectCallbacks().add(childrenSelectCallbackWrapper,this); }
void Pager::setCurrentChildIndex(GLint newCurrentChildIndex) { if(newCurrentChildIndex>GLint(children.size())-1) newCurrentChildIndex=GLint(children.size())-1; /* Get the style sheet: */ const StyleSheet& ss=*getStyleSheet(); /* Un-"arm" the previously selected path button: */ pageButtons[currentChildIndex]->setBorderType(Widget::RAISED); pageButtons[currentChildIndex]->setBackgroundColor(ss.bgColor); pageButtons[currentChildIndex]->setArmedBackgroundColor(ss.buttonArmedBackgroundColor); /* Select the new page button: */ pageButtons[newCurrentChildIndex]->setBorderType(Widget::LOWERED); pageButtons[newCurrentChildIndex]->setBackgroundColor(ss.buttonArmedBackgroundColor); pageButtons[newCurrentChildIndex]->setArmedBackgroundColor(ss.bgColor); /* Select the new child widget: */ currentChildIndex=newCurrentChildIndex; /* Invalidate the visual representation: */ update(); }
Button::Button(const char* sName,Container* sParent,const char* sLabel,bool sManageChild) :Label(sName,sParent,sLabel,false), isArmed(false) { /* Get the style sheet: */ const StyleSheet* ss=getStyleSheet(); /* Button defaults to raised border: */ setBorderType(Widget::RAISED); setBorderWidth(ss->buttonBorderWidth); /* Button defaults to some margin: */ setMarginWidth(ss->buttonMarginWidth); /* Button defaults to centered text: */ setHAlignment(GLFont::Center); /* Set the armed background color: */ armedBackgroundColor=ss->buttonArmedBackgroundColor; /* Manage me: */ if(sManageChild) manageChild(); }
NewButton::NewButton(const char* sName,Container* sParent,const Vector& preferredSize,bool sManageChild) :SingleChildContainer(sName,sParent,false), isArmed(false) { /* Get the style sheet: */ const StyleSheet* ss=getStyleSheet(); /* Button defaults to raised border: */ setBorderType(Widget::RAISED); setBorderWidth(ss->buttonBorderWidth); /* Set the armed background color: */ armedBackgroundColor=ss->buttonArmedBackgroundColor; /* Create the blind child: */ Blind* blind=new Blind("ButtonBlind",this); blind->setBorderType(Widget::PLAIN); blind->setBorderWidth(0.0f); blind->setPreferredSize(preferredSize); /* Manage me: */ if(sManageChild) manageChild(); }