23 #if defined (HAVE_CONFIG_H) 30 #include <QMouseEvent> 45 if (pp.bordertype_is (
"none"))
46 return QFrame::NoFrame;
47 else if (pp.bordertype_is (
"etchedin"))
48 return (QFrame::Box | QFrame::Sunken);
49 else if (pp.bordertype_is (
"etchedout"))
50 return (QFrame::Box | QFrame::Raised);
51 else if (pp.bordertype_is (
"beveledin"))
52 return (QFrame::Panel | QFrame::Sunken);
53 else if (pp.bordertype_is (
"beveledout"))
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,
77 if (! pp.bordertype_is (
"none"))
80 if (pp.bordertype_is (
"etchedin") || pp.bordertype_is (
"etchedout"))
97 return new Panel (go,
new QFrame (container));
104 :
Object (go,
frame), m_container (nullptr), m_title (nullptr),
105 m_blockUpdates (
false)
109 frame->setObjectName (
"UIPanel");
110 frame->setAutoFillBackground (
true);
116 QPalette pal =
frame->palette ();
118 frame->setPalette (pal);
123 if (
frame->hasMouseTracking ())
126 w->setMouseTracking (
true);
130 if (! title.isEmpty ())
133 m_title->setAutoFillBackground (
true);
134 m_title->setContentsMargins (4, 0, 4, 0);
139 frame->installEventFilter (
this);
142 if (pp.is_visible ())
143 QTimer::singleShot (0,
frame, SLOT (show (
void)));
158 switch (xevent->type ())
170 Utils::properties<uipanel> (go);
172 if (pp.fontunits_is (
"normalized"))
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)
209 switch (xevent->type ())
212 if (qWidget<QWidget> ()->isVisible ())
236 QFrame *
frame = qWidget<QFrame> ();
242 case uipanel::properties::ID_POSITION:
252 case uipanel::properties::ID_BORDERWIDTH:
257 case uipanel::properties::ID_BACKGROUNDCOLOR:
258 case uipanel::properties::ID_FOREGROUNDCOLOR:
259 case uipanel::properties::ID_HIGHLIGHTCOLOR:
260 case uipanel::properties::ID_SHADOWCOLOR:
262 QPalette pal =
frame->palette ();
265 frame->setPalette (pal);
271 case uipanel::properties::ID_TITLE:
275 if (title.isEmpty ())
285 QPalette pal =
frame->palette ();
288 m_title->setAutoFillBackground (
true);
289 m_title->setContentsMargins (4, 0, 4, 0);
304 case uipanel::properties::ID_TITLEPOSITION:
308 case uipanel::properties::ID_BORDERTYPE:
313 case uipanel::properties::ID_FONTNAME:
314 case uipanel::properties::ID_FONTSIZE:
315 case uipanel::properties::ID_FONTWEIGHT:
316 case uipanel::properties::ID_FONTANGLE:
325 case uipanel::properties::ID_VISIBLE:
326 frame->setVisible (pp.is_visible ());
350 QFrame *
frame = qWidget<QFrame> ();
370 if (pp.titleposition_is (
"lefttop"))
372 else if (pp.titleposition_is (
"righttop"))
374 else if (pp.titleposition_is (
"leftbottom"))
376 else if (pp.titleposition_is (
"rightbottom"))
378 frame->height () -
sz.height ());
379 else if (pp.titleposition_is (
"centertop"))
381 else if (pp.titleposition_is (
"centerbottom"))
383 frame->height () -
sz.height ());
static void setupPalette(const uibuttongroup::properties &pp, QPalette &p)
bool eventFilter(QObject *watched, QEvent *event)
static int frameStyleFromProperties(const uibuttongroup::properties &pp)
static Panel * create(const graphics_object &go)
QString fromStdString(const std::string &s)
Matrix get_boundingbox(bool internal=false, const Matrix &parent_pix_size=Matrix()) const
static Object * parentObject(const graphics_object &go)
virtual Container * innerContainer(void)=0
static int borderWidthFromProperties(const uibuttongroup::properties &pp)
void redraw(bool sync=false)
virtual void update_boundingbox(void)
static void executeAt(const base_properties &props, const QPoint &pt)
QColor fromRgb(const Matrix &rgb)
bool valid_object(void) const
std::complex< double > w(std::complex< double > z, double relerr=0)
base_properties & get_properties(void)
template QFont computeFont< uipanel >(const uipanel::properties &props, int height)
virtual QObject * qObject(void)
graphics_object object(void) const
Panel(const graphics_object &go, QFrame *frame)
octave::unwind_protect frame
Canvas * canvas(const graphics_handle &handle, bool create=true)