Changeset 8003 in orxonox.OLD for branches/gui
- Timestamp:
- May 31, 2006, 12:21:36 AM (18 years ago)
- Location:
- branches/gui/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/gui/src/lib/gui/gl_gui/glgui_box.cc
r8002 r8003 50 50 51 51 this->children.push_back(widget); 52 this->addChild2D(widget); 53 54 this->resize(); 52 55 } 53 56 … … 57 60 assert(widget == NULL); 58 61 59 this->children.remove(widget); 62 std::vector<GLGuiWidget*>::iterator delWidget = std::find(this->children.begin(), this->children.end(), widget); 63 if (delWidget != this->children.end()) 64 this->children.erase(delWidget); 65 } 66 67 void GLGuiBox::clear() 68 { 69 this->children.clear(); 70 this->resize(); 60 71 } 61 72 62 73 void GLGuiBox::showAll() 63 74 { 64 std:: list<GLGuiWidget*>::iterator itC = this->children.begin();75 std::vector<GLGuiWidget*>::iterator itC = this->children.begin(); 65 76 while (itC != this->children.end()) 66 77 { … … 77 88 void GLGuiBox::hideAll() 78 89 { 79 std:: list<GLGuiWidget*>::iterator itC = this->children.begin();90 std::vector<GLGuiWidget*>::iterator itC = this->children.begin(); 80 91 while (itC != this->children.end()) 81 92 { … … 90 101 } 91 102 103 void GLGuiBox::resize() 104 { 105 float height = 0.0f; 106 float width = 0.0f; 107 std::vector<GLGuiWidget*>::iterator widget; 108 109 // find out how big the Widgets are. 110 for (widget = this->children.begin(); widget != this->children.end(); ++widget) 111 { 112 (*widget)->setAbsCoor2D(0, height); 113 height += (*widget)->getSizeY2D(); 114 width = fmax(width, (*widget)->getSizeX2D()); 115 } 116 117 GLGuiWidget::resize(); 118 // resize everything. 119 //for (widget = this->children.begin(); widget != this->children.end(); ++widget) 120 //{} 121 } 92 122 93 123 /** 94 * draws the GLGuiBox124 * @brief draws the GLGuiBox 95 125 */ 96 126 void GLGuiBox::draw() const 97 127 { 128 this->beginDraw(); 129 GLGuiWidget::draw(); 130 this->endDraw(); 98 131 } 99 132 } -
branches/gui/src/lib/gui/gl_gui/glgui_box.h
r8002 r8003 24 24 virtual ~GLGuiBox(); 25 25 26 void init();27 26 /** @returns the Orientation of the Box */ 28 27 OrxGui::Orientation orientation() const { return this->_orientation; }; … … 38 37 virtual void draw() const; 39 38 40 pr ivate:39 protected: 41 40 virtual void resize(); 42 41 43 Orientation _orientation; 44 std::list<GLGuiWidget*> children; 42 private: 43 void init(); 44 45 Orientation _orientation; 46 std::vector<GLGuiWidget*> children; 45 47 }; 46 48 } -
branches/gui/src/story_entities/simple_game_menu.cc
r8002 r8003 85 85 void SimpleGameMenu::enterGui() 86 86 { 87 /// 88 OrxGui::GLGuiButton* dnpb = new OrxGui::GLGuiCheckButton("Push the button"); 89 dnpb->show(); 90 dnpb->setAbsCoor2D(350, 50); 91 92 93 OrxGui::GLGuiPushButton* rdnpb = new OrxGui::GLGuiPushButton("Quit ORXONOX!!"); 94 rdnpb->show(); 95 rdnpb->setAbsCoor2D(200, 180); 96 rdnpb->connect(SIGNAL(rdnpb, released), this, SLOT(SimpleGameMenu, quitMenu)); 97 98 OrxGui::GLGuiInputLine* input = new OrxGui::GLGuiInputLine(); 99 input->setText("input some text here"); 100 input->connect(SIGNAL(input, textChanged), this, SLOT(SimpleGameMenu, TEST)); 101 input->show(); 102 input->setAbsCoor2D(200, 230); 103 104 OrxGui::GLGuiSlider* slider = new OrxGui::GLGuiSlider(); 105 slider->connect(SIGNAL(slider, valueChanged), this, SLOT(SimpleGameMenu, TEST)); 106 slider->connect(SIGNAL(slider, valueChanged), slider, SLOT(OrxGui::GLGuiWidget, setBackgroundColor)); 107 slider->setRange(0, 1); 108 slider->setValue(slider->min()); 109 slider->show(); 110 slider->setAbsCoor2D(200, 270); 111 87 88 OrxGui::GLGuiBox* box = new OrxGui::GLGuiBox(); 89 { 90 /// 91 OrxGui::GLGuiButton* dnpb = new OrxGui::GLGuiCheckButton("Push the button"); 92 dnpb->show(); 93 dnpb->setAbsCoor2D(350, 50); 94 95 box->pack(dnpb); 96 97 OrxGui::GLGuiPushButton* rdnpb = new OrxGui::GLGuiPushButton("Quit ORXONOX!!"); 98 rdnpb->show(); 99 rdnpb->setAbsCoor2D(200, 180); 100 rdnpb->connect(SIGNAL(rdnpb, released), this, SLOT(SimpleGameMenu, quitMenu)); 101 102 box->pack(rdnpb); 103 104 OrxGui::GLGuiInputLine* input = new OrxGui::GLGuiInputLine(); 105 input->setText("input some text here"); 106 input->connect(SIGNAL(input, textChanged), this, SLOT(SimpleGameMenu, TEST)); 107 input->show(); 108 input->setAbsCoor2D(200, 230); 109 box->pack(input); 110 111 OrxGui::GLGuiSlider* slider = new OrxGui::GLGuiSlider(); 112 slider->connect(SIGNAL(slider, valueChanged), this, SLOT(SimpleGameMenu, TEST)); 113 slider->connect(SIGNAL(slider, valueChanged), dnpb, SLOT(OrxGui::GLGuiWidget, setBackgroundColor)); 114 slider->setRange(0, 1); 115 slider->setValue(slider->min()); 116 slider->show(); 117 slider->setAbsCoor2D(200, 270); 118 box->pack(slider); 119 } 120 box->setAbsCoor2D(50, 200); 112 121 ///// 113 122 } … … 133 142 system ((std::string("firefox ") + URL).c_str()); 134 143 #elif defined __OSX__ 135 136 137 138 144 CFURLRef url_handle = CFURLCreateWithBytes (NULL, (UInt8 *)URL.c_str(), URL.size(), 145 kCFStringEncodingASCII, NULL); 146 LSOpenCFURLRef (url_handle, NULL); 147 CFRelease (url_handle); 139 148 #elif defined __WIN32__ 140 141 142 149 ShellExecute(GetActiveWindow(), 150 "open", URL.c_str(), NULL, NULL, SW_SHOWNORMAL); 151 } 143 152 #endif 144 153 PRINTF(3)("loaded external webpage %s\n", URL.c_str());
Note: See TracChangeset
for help on using the changeset viewer.