30 #include <QMouseEvent>
46 return QFrame::NoFrame;
48 return (QFrame::Box | QFrame::Sunken);
50 return (QFrame::Box | QFrame::Raised);
52 return (QFrame::Panel | QFrame::Sunken);
54 return (QFrame::Panel | QFrame::Raised);
56 return (QFrame::Panel | QFrame::Plain);
62 p.setColor (QPalette::Window,
64 p.setColor (QPalette::WindowText,
66 p.setColor (QPalette::Light,
68 p.setColor (QPalette::Dark,
97 return new Panel (go,
new QFrame (container));
104 :
Object (go, frame), m_container (0), m_title (0), m_blockUpdates (false)
108 frame->setObjectName (
"UIPanel");
109 frame->setAutoFillBackground (
true);
115 QPalette pal = frame->palette ();
117 frame->setPalette (pal);
122 if (frame->hasMouseTracking ())
125 { w->setMouseTracking (
true); }
129 if (! title.isEmpty ())
131 m_title =
new QLabel (title, frame);
132 m_title->setAutoFillBackground (
true);
133 m_title->setContentsMargins (4, 0, 4, 0);
138 frame->installEventFilter (
this);
142 QTimer::singleShot (0, frame, SLOT (show (
void)));
158 switch (xevent->type ())
170 Utils::properties<uipanel> (go);
174 QFrame* frame = qWidget<QFrame> ();
177 (pp, frame->height ()));
186 case QEvent::MouseButtonPress:
188 QMouseEvent* m =
dynamic_cast<QMouseEvent*
> (xevent);
190 if (m->button () == Qt::RightButton)
205 switch (xevent->type ())
208 if (qWidget<QWidget> ()->isVisible ())
229 QFrame* frame = qWidget<QFrame> ();
255 QPalette pal = frame->palette ();
258 frame->setPalette (pal);
268 if (title.isEmpty ())
278 QPalette pal = frame->palette ();
280 m_title =
new QLabel (title, frame);
281 m_title->setAutoFillBackground (
true);
282 m_title->setContentsMargins (4, 0, 4, 0);
327 m_blockUpdates =
false;
343 QFrame* frame = qWidget<QFrame> ();
348 frame->setFrameRect (QRect (
xround (bb(0)) - bw,
xround (bb(1)) - bw,
358 QSize sz =
m_title->sizeHint ();
364 m_title->move (frame->width () - bw - offset - sz.width (), 0);
366 m_title->move (bw+offset, frame->height () - sz.height ());
368 m_title->move (frame->width () - bw - offset - sz.width (),
369 frame->height () - sz.height ());
371 m_title->move (frame->width () / 2 - sz.width () / 2, 0);
373 m_title->move (frame->width () / 2 - sz.width () / 2,
374 frame->height () - sz.height ());
std::string get_title(void) const
double get_borderwidth(void) const
bool is_visible(void) const
bool eventFilter(QObject *watched, QEvent *event)
Matrix get_backgroundcolor_rgb(void) const
static int frameStyleFromProperties(const uipanel::properties &pp)
static Panel * create(const graphics_object &go)
QString fromStdString(const std::string &s)
bool titleposition_is(const std::string &v) const
static Object * parentObject(const graphics_object &go)
virtual Container * innerContainer(void)=0
void redraw(bool sync=false)
Matrix get_foregroundcolor_rgb(void) const
virtual void update_boundingbox(void)
static void executeAt(const base_properties &props, const QPoint &pt)
QColor fromRgb(const Matrix &rgb)
bool bordertype_is(const std::string &v) const
std::complex< double > w(std::complex< double > z, double relerr=0)
Matrix get_shadowcolor_rgb(void) const
template QFont computeFont< uipanel >(const uipanel::properties &props, int height)
virtual QObject * qObject(void)
bool fontunits_is(const std::string &v) const
static void setupPalette(const uipanel::properties &pp, QPalette &p)
Panel(const graphics_object &go, QFrame *frame)
graphics_object object(void) const
Matrix get_boundingbox(bool internal=false, const Matrix &parent_pix_size=Matrix()) const
bool valid_object(void) const
static int borderWidthFromProperties(const uipanel::properties &pp)
Canvas * canvas(const graphics_handle &handle, bool create=true)
Matrix get_highlightcolor_rgb(void) const
base_properties & properties(void)