/************************************************************************* Initialises the Window based object ready for use. *************************************************************************/ void FrameWindow::initialiseComponents(void) { // get component windows Titlebar* titlebar = getTitlebar(); PushButton* closeButton = getCloseButton(); // configure titlebar titlebar->setDraggingEnabled(d_dragMovable); titlebar->setText(d_text); // bind handler to close button 'Click' event closeButton->subscribeEvent(PushButton::EventClicked, Event::Subscriber(&CEGUI::FrameWindow::closeClickHandler, this)); performChildWindowLayout(); }
void TitlebarImpl::draw() { CL_Display::push_translate(parent->get_screen_x(), parent->get_screen_y()); // FIXME: Hack should be done via has_mouse_over(), but that doesn't include child components if (parent->get_parent()->get_position().is_inside(CL_Point(CL_Mouse::get_x(), CL_Mouse::get_y()))) //parent->get_parent()->has_mouse_over()) { CL_Display::fill_rect(CL_Rect(CL_Point(0, 0), CL_Size(parent->get_width()-1, parent->get_height())), CL_Color(250, 250, 250)); } else { CL_Display::fill_rect(CL_Rect(CL_Point(0, 0), CL_Size(parent->get_width()-1, parent->get_height())), CL_Color(240, 240, 240)); } Fonts::verdana11.draw(4, 0, title); CL_Display::pop_modelview(); }
void TitlebarImpl::on_mouse_up(const CL_InputEvent& event) { if (event.id == CL_MOUSE_LEFT) { pressed = false; parent->release_mouse(); } }
void WindowImpl::on_resize(int, int) { titlebar->set_position(CL_Rect(CL_Point(3+16,3), CL_Size(parent->get_width()-6-18-18-18, 12+3))); close->set_position(3, 3); minimize->set_position(parent->get_width()-3-18-18, 3); maximize->set_position(parent->get_width()-3-18, 3); CL_Rect rect = parent->get_position(); client_area->set_position(CL_Rect(CL_Point(4, 3+12+7), CL_Size(rect.get_width()-10, rect.get_height()-28))); }
void TitlebarImpl::on_mouse_down(const CL_InputEvent& event) { if (event.id == CL_MOUSE_LEFT) { pressed = true; click_pos = event.mouse_pos; parent->capture_mouse(); window->raise(); old_pos = window->get_position(); click_pos.x += old_pos.left; click_pos.y += old_pos.top; } }
/************************************************************************* Initialises the Window based object ready for use. *************************************************************************/ void FrameWindow::initialiseComponents(void) { // get component windows Titlebar* titlebar = getTitlebar(); PushButton* closeButton = getCloseButton(); // configure titlebar titlebar->setDraggingEnabled(d_dragMovable); titlebar->setText(getText()); // ban some properties on components, since they are linked to settings // defined here. titlebar->banPropertyFromXML("Text"); titlebar->banPropertyFromXML("Visible"); titlebar->banPropertyFromXML("Disabled"); closeButton->banPropertyFromXML("Visible"); closeButton->banPropertyFromXML("Disabled"); // bind handler to close button 'Click' event closeButton->subscribeEvent(PushButton::EventClicked, Event::Subscriber(&CEGUI::FrameWindow::closeClickHandler, this)); performChildWindowLayout(); }