1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- #include <ClanLib/Display/display.h>
- #include "box.hpp"
- #include "panel.hpp"
- class PanelImpl
- {
- public:
- std::vector<CL_Slot> slots;
- CL_Component* parent;
- void draw();
- };
- Panel::Panel(const CL_Rect& rect, CL_Component* parent)
- : CL_Component(rect, parent), impl(new PanelImpl())
- {
- impl->parent = this;
- impl->slots.push_back(sig_paint().connect(impl.get(), &PanelImpl::draw));
- }
- void
- PanelImpl::draw()
- {
- CL_Display::push_translate(parent->get_screen_x(), parent->get_screen_y());
- CL_Rect rect = parent->get_position();
- Box::draw_panel(CL_Rect(CL_Point(0, 0), CL_Size(rect.get_width()-1, rect.get_height()-1)));
- CL_Display::pop_modelview();
- }
|