mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
oops
This commit is contained in:
parent
356ddce4e6
commit
3c3f5661f0
@ -160,11 +160,13 @@ void GuiFrame::pack_item(GuiItem* item, Packing rel, GuiItem* to, float gap) {
|
||||
void GuiFrame::clear_packing(GuiItem* item) {
|
||||
Boxes::iterator box = find_box(item);
|
||||
(*box).erase_all_links();
|
||||
this->recompute_frame();
|
||||
}
|
||||
|
||||
void GuiFrame::clear_all_packing(void) {
|
||||
for (Boxes::iterator i=_items.begin(); i!=_items.end(); ++i)
|
||||
(*i).erase_all_links();
|
||||
this->recompute_frame();
|
||||
}
|
||||
|
||||
void GuiFrame::manage(GuiManager* mgr, EventHandler& eh) {
|
||||
|
@ -50,16 +50,24 @@ void GuiLabel::set_properties(void) {
|
||||
float w = v[1] - v[0];
|
||||
float h = v[3] - v[2];
|
||||
if (_have_width) {
|
||||
gui_cat->debug() << "adjusting width: before = " << w;
|
||||
w = _width - w;
|
||||
gui_cat->debug(false) << " diff = " << w;
|
||||
w *= 0.5;
|
||||
v[1] += w;
|
||||
v[0] -= w;
|
||||
gui_cat->debug(false) << " after = " << (v[1] - v[0])
|
||||
<< " want = " << _width << endl;
|
||||
}
|
||||
if (_have_height) {
|
||||
gui_cat->debug() << "adjusting height: before = " << h;
|
||||
h = _height - h;
|
||||
gui_cat->debug(false) << " diff = " << h;
|
||||
h *= 0.5;
|
||||
v[3] += h;
|
||||
v[2] -= h;
|
||||
gui_cat->debug(false) << " after = " << (v[3] - v[2])
|
||||
<< " want = " << _height << endl;
|
||||
}
|
||||
n->set_card_actual(v[0], v[1], v[2], v[3]);
|
||||
} else
|
||||
|
@ -65,19 +65,19 @@ static void setup_gui(void) {
|
||||
// r1->set_pos(LVector3f::rfu(0.25, 0., 0.25));
|
||||
// r1->manage(mgr, event_handler);
|
||||
// test 3
|
||||
GuiLabel* l1 = GuiLabel::make_simple_text_label("up", font);
|
||||
GuiLabel* l2 = GuiLabel::make_simple_text_label("upr", font);
|
||||
GuiLabel* l3 = GuiLabel::make_simple_text_label("down", font);
|
||||
GuiLabel* l4 = GuiLabel::make_simple_text_label("downr", font);
|
||||
GuiLabel* l5 = GuiLabel::make_simple_text_label("none", font);
|
||||
GuiButton* b1 = new GuiButton("test3", l1, l2, l3, l4, l5);
|
||||
b1->set_scale(0.1);
|
||||
b1->set_pos(LVector3f::rfu(-0.25, 0., 0.25));
|
||||
l2->set_foreground_color(1., 1., 0., 1.);
|
||||
l4->set_foreground_color(1., 1., 0., 1.);
|
||||
l3->set_background_color(1., 1., 1., 0.5);
|
||||
l4->set_background_color(1., 1., 1., 0.5);
|
||||
b1->manage(mgr, event_handler);
|
||||
// GuiLabel* l1 = GuiLabel::make_simple_text_label("up", font);
|
||||
// GuiLabel* l2 = GuiLabel::make_simple_text_label("upr", font);
|
||||
// GuiLabel* l3 = GuiLabel::make_simple_text_label("down", font);
|
||||
// GuiLabel* l4 = GuiLabel::make_simple_text_label("downr", font);
|
||||
// GuiLabel* l5 = GuiLabel::make_simple_text_label("none", font);
|
||||
// GuiButton* b1 = new GuiButton("test3", l1, l2, l3, l4, l5);
|
||||
// b1->set_scale(0.1);
|
||||
// b1->set_pos(LVector3f::rfu(-0.25, 0., 0.25));
|
||||
// l2->set_foreground_color(1., 1., 0., 1.);
|
||||
// l4->set_foreground_color(1., 1., 0., 1.);
|
||||
// l3->set_background_color(1., 1., 1., 0.5);
|
||||
// l4->set_background_color(1., 1., 1., 0.5);
|
||||
// b1->manage(mgr, event_handler);
|
||||
// test 4
|
||||
// GuiRollover* r1 = new GuiRollover("r1",
|
||||
// GuiLabel::make_simple_text_label("1",
|
||||
@ -162,6 +162,35 @@ static void setup_gui(void) {
|
||||
// f1->set_pos(LVector3f::rfu(0., 0., -0.25));
|
||||
// f1->manage(mgr, event_handler);
|
||||
// cerr << *f1;
|
||||
// test 5
|
||||
GuiLabel* l1 = GuiLabel::make_simple_text_label("on", font);
|
||||
GuiLabel* l2 = GuiLabel::make_simple_text_label("off", font);
|
||||
GuiLabel* l3 = GuiLabel::make_simple_text_label("over", font);
|
||||
GuiLabel* l4 = GuiLabel::make_simple_text_label("easy", font);
|
||||
float w1, w2, w3, w4, w;
|
||||
w1 = l1->get_width();
|
||||
w2 = l2->get_width();
|
||||
w3 = l3->get_width();
|
||||
w4 = l4->get_width();
|
||||
w = (w1>w2)?w1:w2;
|
||||
w = (w>w3)?w:w3;
|
||||
w = (w>w4)?w:w4;
|
||||
l1->set_background_color(1., 1., 1., 0.3);
|
||||
l2->set_background_color(1., 1., 1., 0.3);
|
||||
l3->set_background_color(1., 1., 1., 0.3);
|
||||
l4->set_background_color(1., 1., 1., 0.3);
|
||||
l1->set_width(w);
|
||||
l2->set_width(w);
|
||||
l3->set_width(w);
|
||||
l4->set_width(w);
|
||||
GuiRollover* r1 = new GuiRollover("r1", l1, l2);
|
||||
GuiRollover* r2 = new GuiRollover("r2", l3, l4);
|
||||
GuiFrame* f1 = new GuiFrame("test5");
|
||||
f1->add_item(r1);
|
||||
f1->add_item(r2);
|
||||
f1->pack_item(r2, GuiFrame::UNDER, r1);
|
||||
f1->set_scale(0.1);
|
||||
f1->manage(mgr, event_handler);
|
||||
}
|
||||
|
||||
static void event_2(CPT_Event) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user