void SessionEntry::disableSession() { // even if it failed to initialize, we still need to delete the session // object if ( session != NULL ) { gravUtil::logVerbose( "SessionEntry::disableSession: deleting " "VPMSession object for %s\n", address.c_str() ); delete session; session = NULL; } else { gravUtil::logVerbose( "SessionEntry::disableSession: session (%s) not " "active, not deleting\n", address.c_str() ); } initialized = false; setBaseColor( disabledColor ); inFailedState = false; // was originally going to call this var "lastInitFailed" but that name // wouldn't be accurate in this case. here we're sort of in an unknown // state, ie, if it were a DNS problem DNS could have come back in the // meantime. this should reflect the failed color being set }
LoginBox::LoginBox() : usernameLabel(new gcn::Label("Username: "******"Password: "******"")), passwordTextField(new PasswordField("")) //passwordField(new PasswordField) { setCaption("Login"); setBaseColor(gcn::Color(204,235,150)); usernameTextField->setWidth(100); passwordTextField->setWidth(100); usernameLabel->setPosition(10,10); usernameTextField->setPosition(usernameLabel->getWidth()+usernameLabel->getX(),10); passwordLabel->setPosition(10, usernameLabel->getY()+usernameLabel->getHeight()+5); passwordTextField->setPosition( passwordLabel->getX()+passwordLabel->getWidth(), passwordLabel->getY() ); doneButton->addMouseListener(this); add(usernameLabel); add(usernameTextField); add(passwordLabel); add(passwordTextField); resizeToContent(); setWidth(getWidth()+10); InfoForm::positionDefaultBtns(); }
ShaderCustomTex::ShaderCustomTex() : m_col(1.0f, 1.0f, 1.0f, 1.0f) { m_nameVS = "ShaderCustomTex_vs"; m_nameFS = "ShaderCustomTex_fs"; m_nameGS = "ShaderCustomTex_gs"; std::string glxvert(*GLSLShader::DEFINES_GL); glxvert.append(vertexShaderText); std::string glxgeom = GLSLShader::defines_Geom("triangles", "triangle_strip", 3); glxgeom.append(geometryShaderText); std::string glxfrag(*GLSLShader::DEFINES_GL); glxfrag.append(fragmentShaderText); // loadShadersFromMemory(glxvert.c_str(), glxfrag.c_str()); loadShadersFromMemory(glxvert.c_str(), glxfrag.c_str(), glxgeom.c_str(), GL_TRIANGLES, GL_TRIANGLE_STRIP, 3); m_unif_unit = glGetUniformLocation(this->program_handler(), "textureUnit"); setBaseColor(m_col); Geom::Matrix44f id; id.identity(); setTransformation(id); }
AudioOptions::AudioOptions(RootWidget * top) : gcn::Window("Audio"), m_top(top) { gcn::Color base = getBaseColor(); base.a = 128; setBaseColor(base); setOpaque(true); gcn::Box * vbox = new gcn::VBox(6); m_widgets.push_back(SPtr<gcn::Widget>(vbox)); gcn::Box * hbox = new gcn::HBox(6); m_widgets.push_back(SPtr<gcn::Widget>(hbox)); gcn::Button * b = new gcn::Button("Apply"); m_widgets.push_back(SPtr<gcn::Widget>(b)); b->setActionEventId("apply"); b->setFocusable(false); b->addActionListener(this); hbox->pack(b); b = new gcn::Button("Close"); m_widgets.push_back(SPtr<gcn::Widget>(b)); b->setActionEventId("close"); b->setFocusable(false); b->addActionListener(this); hbox->pack(b); vbox->pack(hbox); add(vbox); resizeToContent(); }
TaskWindow::TaskWindow(Eris::Entity * e) : m_entity(e) { assert(e != 0); gcn::Color base = getBaseColor(); base.a = 128; setBaseColor(base); // setTitleBarHeight(0); setMovable(false); // setOpaque(true); m_vbox = new gcn::VBox(2); m_widgets.push_back(SPtr<gcn::Widget>(m_vbox)); m_progressBar = new gcn::Bar; m_widgets.push_back(SPtr<gcn::Widget>(m_progressBar)); m_progressBar->setWidth(100); m_progressBar->setHeight(6); m_progressBar->setValue(0.0); m_progressBar->setForegroundColor(gcn::Color(0xaaaaaa)); m_progressBar->setBaseColor(gcn::Color(0,0,0,25)); m_vbox->pack(m_progressBar); add(m_vbox); resizeToContent(); }
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); }
Label::Label( GLFT_Font *font_, std::string text_ ) { setFont( font_ ); setText( text_ ); setBaseColor( 0.0f, 0.0f, 0.0f, 0.0f ); setSelectColor( 0.0f, 0.0f, 0.0f, 0.0f ); onClickedFunc = NULL; }
SelectionBox::SelectionBox( GLFT_Font *font, GLFT_Font *selectFont ) { setFont( font ); setSelectFont( selectFont ); entries.clear(); setBaseColor( 0.0f, 0.0f, 0.0f, 0.0f ); setSelectColor( 0.0f, 0.0f, 0.0f, 0.0f ); onSelectedFunc = NULL; maxWidth = 0; maxSelectedWidth = 0; selected = -1; //state = CLOSED; state = OPEN; }
int caClock::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QwtAnalogClock::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 2) qt_static_metacall(this, _c, _id, _a); _id -= 2; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< QString*>(_v) = getPV(); break; case 1: *reinterpret_cast< timeType*>(_v) = getTimeType(); break; case 2: *reinterpret_cast< QColor*>(_v) = getBaseColor(); break; case 3: *reinterpret_cast< bool*>(_v) = getScaleDefaultColor(); break; case 4: *reinterpret_cast< QColor*>(_v) = getScaleColor(); break; case 5: *reinterpret_cast< colMode*>(_v) = getColorMode(); break; } _id -= 6; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setPV(*reinterpret_cast< QString*>(_v)); break; case 1: setTimeType(*reinterpret_cast< timeType*>(_v)); break; case 2: setBaseColor(*reinterpret_cast< QColor*>(_v)); break; case 3: setScaleDefaultColor(*reinterpret_cast< bool*>(_v)); break; case 4: setScaleColor(*reinterpret_cast< QColor*>(_v)); break; case 5: setColorMode(*reinterpret_cast< colMode*>(_v)); break; } _id -= 6; } else if (_c == QMetaObject::ResetProperty) { _id -= 6; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 6; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 6; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 6; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 6; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 6; } #endif // QT_NO_PROPERTIES return _id; }
StatusWindow::StatusWindow(Eris::Entity * e) : m_entity(e) { assert(e != 0); gcn::Color base = getBaseColor(); base.a = 128; setBaseColor(base); // setTitleBarHeight(0); setMovable(false); setCaption(e->getName()); // setOpaque(true); m_vbox = new gcn::VBox(2); m_widgets.push_back(SPtr<gcn::Widget>(m_vbox)); m_healthBar = new gcn::Bar; m_widgets.push_back(SPtr<gcn::Widget>(m_healthBar)); m_healthBar->setWidth(100); m_healthBar->setHeight(6); m_healthBar->setValue(0.3); m_healthBar->setForegroundColor(gcn::Color(0xff0000)); m_healthBar->setBaseColor(gcn::Color(0,0,0,25)); m_vbox->pack(m_healthBar); m_staminaBar = new gcn::Bar; m_widgets.push_back(SPtr<gcn::Widget>(m_staminaBar)); m_staminaBar->setWidth(100); m_staminaBar->setHeight(6); m_staminaBar->setValue(0.6); m_staminaBar->setForegroundColor(gcn::Color(0xeeeeee)); m_staminaBar->setBaseColor(gcn::Color(0,0,0,25)); m_vbox->pack(m_staminaBar); m_manaBar = new gcn::Bar; m_widgets.push_back(SPtr<gcn::Widget>(m_manaBar)); m_manaBar->setWidth(100); m_manaBar->setHeight(6); m_manaBar->setValue(0.9); m_manaBar->setForegroundColor(gcn::Color(0x0000ff)); m_manaBar->setBaseColor(gcn::Color(0,0,0,25)); m_vbox->pack(m_manaBar); add(m_vbox); resizeToContent(); }
int TPatternParquet::setAttribute (const string& rktNAME, NAttribute nVALUE, EAttribType eTYPE) { if ( rktNAME == "color" ) { if ( eTYPE == FX_COLOR ) { setColor (*((TColor*) nVALUE.pvValue)); } else { return FX_ATTRIB_WRONG_TYPE; } } else if ( rktNAME == "base_color" ) { if ( eTYPE == FX_COLOR ) { setBaseColor (*((TColor*) nVALUE.pvValue)); } else { return FX_ATTRIB_WRONG_TYPE; } } else if ( rktNAME == "zoom" ) { if ( eTYPE == FX_VECTOR ) { tZoom = *((TVector*) nVALUE.pvValue); tZoom.set (1.0 / tZoom.x(), 1.0 / tZoom.y(), 1.0 / tZoom.z()); } else { return FX_ATTRIB_WRONG_TYPE; } } else { return TPattern::setAttribute (rktNAME, nVALUE, eTYPE); } return FX_ATTRIB_OK; } /* setAttribute() */
bool SessionEntry::initSession( VPMSessionListener* listener ) { if ( !isSessionEnabled() ) { VPMSessionFactory* factory = VPMSessionFactory::getInstance(); session = factory->createSession( address.c_str(), *listener ); session->enableVideo( !audio ); session->enableAudio( audio ); session->enableOther( false ); if ( !session->initialise() ) { gravUtil::logError( "SessionEntry::init: failed to initialize on " "address %s\n", address.c_str() ); initialized = false; // might as well delete the session object here to prevent potential // memleaks (ie, reinitializing a session that failed to init) disableSession(); setBaseColor( failedColor ); inFailedState = true; return false; } if ( encryptionKey.compare( "__NO_KEY__" ) != 0 ) { session->setEncryptionKey( encryptionKey.c_str() ); } sessionTS = random32(); initialized = true; inFailedState = false; resetColor(); return true; } else { gravUtil::logWarning( "SessionEntry::init: session %s already " "initialized\n", address.c_str() ); return false; } }
void Surface::parseAttributeElements(const std::string& name, const AttributeSet& attributes, int line, int column, ErrorManager* errorManager) { if(name == "Color") { ParserUtilities::toRGBA(attributes, color); setBaseColor(); setInvertedColor(false); } else if(name == "AmbientColor") { ParserUtilities::toRGBA(attributes, ambientColor); setBaseAmbientColor(); hasAmbientColor = true; } else if(name == "SpecularColor") { ParserUtilities::toRGBA(attributes, specularColor); } else if(name == "Shininess") { shininess = (GLfloat)ParserUtilities::toDouble(attributes[0].value); } else if(name == "EmissionColor") { ParserUtilities::toRGBA(attributes, emissionColor); } else if(name == "DiffuseTexture") { initTexture(attributes, diffuseTexture, line, column, errorManager); } else if(name == "BorderColor") { ParserUtilities::toRGBA(attributes, diffuseTexture.getBorderColorPtr()); } else if(name == "TextureGenModeS") { initTextureGenMode(attributes, texGen_s_mode, texGen_s_coeff, line, column, errorManager); } else if(name == "TextureGenModeT") { initTextureGenMode(attributes, texGen_t_mode, texGen_t_coeff, line, column, errorManager); } else if(name == "Reflectivity") { for(unsigned int i=0; i < attributes.size(); i++) { if(attributes[i].attribute == "value") { reflectivity = (GLfloat)ParserUtilities::toDouble(attributes[i].value); reflectivityColor[3] = reflectivity; } /*else if(attributes[i].attribute == "constantUpdate") constantUpdate = ParserUtilities::toBool(attributes[i].value); else if(attributes[i].attribute == "size") constantUpdateSize = ParserUtilities::toInt(attributes[i].value);*/ } } else { errorManager->addError("Unknown Surface Parameter", "The provided AppearanceDefinition parameter \"" + name + "\" is unknown", line, column); } }
int TPatternBrick::setAttribute (const string& rktNAME, NAttribute nVALUE, EAttribType eTYPE) { if ( rktNAME == "color" ) { if ( eTYPE == FX_COLOR ) { setColor (*((TColor*) nVALUE.pvValue)); } else { return FX_ATTRIB_WRONG_TYPE; } } else if ( rktNAME == "base_color" ) { if ( eTYPE == FX_COLOR ) { setBaseColor (*((TColor*) nVALUE.pvValue)); } else { return FX_ATTRIB_WRONG_TYPE; } } else if ( rktNAME == "zoom" ) { if ( eTYPE == FX_VECTOR ) { tZoomOriginal = *((TVector*) nVALUE.pvValue); tZoom.set (1.0 / tZoomOriginal.x(), 1.0 / tZoomOriginal.y(), 1.0 / tZoomOriginal.z()); } else { return FX_ATTRIB_WRONG_TYPE; } } else if ( rktNAME == "width" ) { if ( eTYPE == FX_REAL ) { tBrickWidth = nVALUE.dValue; } else { return FX_ATTRIB_WRONG_TYPE; } } else if ( rktNAME == "height" ) { if ( eTYPE == FX_REAL ) { tBrickHeight = nVALUE.dValue; } else { return FX_ATTRIB_WRONG_TYPE; } } else if ( rktNAME == "mortar" ) { if ( eTYPE == FX_REAL ) { tMortarThickness = nVALUE.dValue; } else { return FX_ATTRIB_WRONG_TYPE; } } else { return TPattern::setAttribute (rktNAME, nVALUE, eTYPE); } return FX_ATTRIB_OK; } /* setAttribute() */
ControlsOptions::ControlsOptions(RootWidget * top) : gcn::Window("Controls"), m_top(top) { gcn::Color base = getBaseColor(); base.a = 128; setBaseColor(base); setOpaque(true); gcn::Box * vbox = new gcn::VBox(6); m_widgets.push_back(SPtr<gcn::Widget>(vbox)); m_controlText = new gcn::TextBox; m_widgets.push_back(SPtr<gcn::Widget>(m_controlText)); m_controlText->setEditable(false); m_controlText->setOpaque(false); m_controlText->setFocusable(false); m_controlText->setEnabled(false); gcn::ScrollArea * control_scroll = new gcn::ScrollArea(m_controlText, gcn::ScrollArea::SHOW_AUTO, gcn::ScrollArea::SHOW_ALWAYS); m_widgets.push_back(SPtr<gcn::Widget>(control_scroll)); control_scroll->setWidth(500); control_scroll->setHeight(300); control_scroll->setFrameSize(1); vbox->pack(control_scroll); readBindings(); gcn::Box * hbox = new gcn::HBox(6); m_widgets.push_back(SPtr<gcn::Widget>(hbox)); gcn::Label * l = new gcn::Label("Key"); m_widgets.push_back(SPtr<gcn::Widget>(l)); hbox->pack(l); m_key = new gcn::TextField(" "); m_widgets.push_back(SPtr<gcn::Widget>(m_key)); m_key->setText(""); hbox->pack(m_key); l = new gcn::Label("Action"); m_widgets.push_back(SPtr<gcn::Widget>(l)); hbox->pack(l); m_action = new gcn::TextField(" "); m_widgets.push_back(SPtr<gcn::Widget>(m_action)); m_action->setText(""); hbox->pack(m_action); gcn::Button * b = new gcn::Button("Bind"); m_widgets.push_back(SPtr<gcn::Widget>(b)); b->setActionEventId("bind"); b->setFocusable(false); b->addActionListener(this); hbox->pack(b); vbox->pack(hbox); hbox = new gcn::HBox(6); m_widgets.push_back(SPtr<gcn::Widget>(hbox)); b = new gcn::Button("Apply"); m_widgets.push_back(SPtr<gcn::Widget>(b)); b->setActionEventId("apply"); b->setFocusable(false); b->addActionListener(this); hbox->pack(b); b = new gcn::Button("Close"); m_widgets.push_back(SPtr<gcn::Widget>(b)); b->setActionEventId("close"); b->setFocusable(false); b->addActionListener(this); hbox->pack(b); vbox->pack(hbox); add(vbox); resizeToContent(); }
void EnergyGauge::initialize() { setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT); setBaseColor(gcn::Color(DEFAULT_BASE_COLOR)); setBackgroundColor(gcn::Color(DEFAULT_FOREGROUND_COLOR)); setForegroundColor(gcn::Color(DEFAULT_BACKGROUND_COLOR)); }
Inventory::Inventory(int _size, std::string hide_event, gcn::ActionListener* el_coso) : _slots(_size),size(_size),gcn::Window("Inventario"),active(0),first_item(0),visible(true) { img=0;//revisame setSize(195,210); setBaseColor(gcn::Color(255, 150, 200, 127)); int colsPerRow=5; int actX,actY; int baseX=9; int baseY=24; for(int i=0 ;i<size; i++){ _slots[i]= new InventorySlot; _slots[i]->grh_img=0; if(i<20){ _slots[i]->visible=true; }else{ _slots[i]->visible=false; } _slots[i]->set_grhindex(0); _slots[i]->valor = 0; actX=baseX + (i%colsPerRow) * 36; actY=baseY + (i/colsPerRow) * 35; _slots[i]->setSize(32,32); //_slots[i]->setBaseColor(gcn::Color(0x99, 0xDF, 0xF5, 65)); _slots[i]->setBaseColor(gcn::Color(0x99, 0xDF, 0xF5, 0)); ///Esto tendr�a que tener un patron base que se pase x el constructor (y agregar action listeners) o hacer virtual la funcion de action, nose, REVISAR. =). :D std::stringstream bid; bid.str(std::string()); bid << "boton " << i; _slots[i]->setActionEventId(bid.str()); _slots[i]->addActionListener((gcn::ActionListener*)this); add(_slots[i],actX,actY); } label= new gcn::TextBox("Nada"); label->setSize(177,34); label->setOpaque(false); label->setEditable(false); label->setBorderSize(0); // label->setAlignment(gcn::Graphics::CENTER); up=new gcn::Button(" "); down= new gcn::Button(" "); up->setActionEventId("UP"); up->setBaseColor(gcn::Color(0x99, 0xDF, 0xF5, 0)); down->setBaseColor(gcn::Color(0x99, 0xDF, 0xF5, 0)); down->setActionEventId("DOWN"); up->addActionListener(this); up->setBorderSize(0); down->addActionListener(this); down->setBorderSize(0); add(label,8,169); add(up,7,4); add(down,28,4); hide = new gcn::Button(" "); hide->setBaseColor(gcn::Color(0x99, 0xDF, 0xF5, 0)); hide->setBorderSize(0); add(hide,170,5); hide->setHeight(14); hide->setActionEventId(hide_event); hide->addActionListener(el_coso); //add(label,5,146); l_x=l_y=0; show_prices(false); }