annotate libgui/graphics/ButtonGroup.cc @ 23070:bef714f45999

maint: Use space after function name/before parenthesis in libgui. * Backend.cc, ButtonControl.cc, ButtonGroup.cc, Canvas.cc, Container.cc, EditControl.cc, GLCanvas.cc, ListBoxControl.cc, ListBoxControl.h, PopupMenuControl.cc, QtHandlesUtils.cc, TextControl.cc, TextEdit.h, annotation-dialog.cc, annotation-dialog.h, gl-select.cc, dialog.cc, files-dock-widget.cc, find-files-dialog.cc, history-dock-widget.cc, file-editor-tab.cc, file-editor.cc, file-editor.h, find-dialog.cc, marker.cc, octave-qscintilla.cc, octave-qscintilla.h, main-window.cc, octave-dock-widget.cc, octave-dock-widget.h, octave-gui.cc, parser.cc, parser.h, webinfo.cc, settings-dialog.cc, shortcut-manager.cc, welcome-wizard.cc, workspace-view.cc: Use space after function name and before parenthesis.
author Rik <rik@octave.org>
date Wed, 18 Jan 2017 17:36:36 -0800
parents 3a2b891d0b33
children ef4d915df748
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
1 /*
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
2
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
3 Copyright (C) 2016 Andrew Thornton
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
4
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
5 This file is part of Octave.
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
6
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22737
diff changeset
8 under the terms of the GNU General Public License as published by
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22737
diff changeset
9 the Free Software Foundation; either version 3 of the License, or
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22737
diff changeset
10 (at your option) any later version.
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
11
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22737
diff changeset
12 Octave is distributed in the hope that it will be useful, but
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22737
diff changeset
13 WITHOUT ANY WARRANTY; without even the implied warranty of
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22737
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22737
diff changeset
15 GNU General Public License for more details.
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
16
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
18 along with Octave; see the file COPYING. If not, see
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
19 <http://www.gnu.org/licenses/>.
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
20
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
21 */
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
22
22188
1344509a480c style fixes
John W. Eaton <jwe@octave.org>
parents: 21824
diff changeset
23 #if defined (HAVE_CONFIG_H)
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
24 # include "config.h"
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
25 #endif
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
26
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
27 #include <QAbstractButton>
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
28 #include <QButtonGroup>
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
29 #include <QEvent>
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
30 #include <QFrame>
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
31 #include <QLabel>
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
32 #include <QMouseEvent>
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
33 #include <QRadioButton>
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
34 #include <QTimer>
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
35
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
36 #include "Canvas.h"
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
37 #include "Container.h"
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
38 #include "ContextMenu.h"
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
39 #include "ButtonGroup.h"
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
40 #include "ToggleButtonControl.h"
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
41 #include "RadioButtonControl.h"
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
42 #include "Backend.h"
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
43 #include "QtHandlesUtils.h"
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
44
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
45 #include "ov-struct.h"
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
46
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
47 namespace QtHandles
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
48 {
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
49
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
50 static int
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
51 frameStyleFromProperties (const uibuttongroup::properties& pp)
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
52 {
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
53 if (pp.bordertype_is ("none"))
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
54 return QFrame::NoFrame;
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
55 else if (pp.bordertype_is ("etchedin"))
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
56 return (QFrame::Box | QFrame::Sunken);
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
57 else if (pp.bordertype_is ("etchedout"))
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
58 return (QFrame::Box | QFrame::Raised);
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
59 else if (pp.bordertype_is ("beveledin"))
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
60 return (QFrame::Panel | QFrame::Sunken);
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
61 else if (pp.bordertype_is ("beveledout"))
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
62 return (QFrame::Panel | QFrame::Raised);
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
63 else
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
64 return (QFrame::Panel | QFrame::Plain);
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
65 }
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
66
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
67 static void
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
68 setupPalette (const uibuttongroup::properties& pp, QPalette &p)
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
69 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
70 p.setColor (QPalette::Window,
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
71 Utils::fromRgb (pp.get_backgroundcolor_rgb ()));
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
72 p.setColor (QPalette::WindowText,
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
73 Utils::fromRgb (pp.get_foregroundcolor_rgb ()));
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
74 p.setColor (QPalette::Light,
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
75 Utils::fromRgb (pp.get_highlightcolor_rgb ()));
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
76 p.setColor (QPalette::Dark,
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
77 Utils::fromRgb (pp.get_shadowcolor_rgb ()));
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
78 }
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
79
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
80 static int
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
81 borderWidthFromProperties (const uibuttongroup::properties& pp)
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
82 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
83 int bw = 0;
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
84
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
85 if (! pp.bordertype_is ("none"))
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
86 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
87 bw = octave::math::round (pp.get_borderwidth ());
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
88 if (pp.bordertype_is ("etchedin") || pp.bordertype_is ("etchedout"))
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
89 bw *= 2;
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
90 }
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
91
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
92 return bw;
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
93 }
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
94
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
95 ButtonGroup*
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
96 ButtonGroup::create (const graphics_object& go)
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
97 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
98 Object* parent = Object::parentObject (go);
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
99
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
100 if (parent)
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
101 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
102 Container* container = parent->innerContainer ();
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
103
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
104 if (container)
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
105 {
23070
bef714f45999 maint: Use space after function name/before parenthesis in libgui.
Rik <rik@octave.org>
parents: 22755
diff changeset
106 QFrame* frame = new QFrame (container);
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
107 return new ButtonGroup (go, new QButtonGroup (frame), frame);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
108 }
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
109 }
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
110
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
111 return 0;
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
112 }
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
113
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
114 ButtonGroup::ButtonGroup (const graphics_object& go, QButtonGroup* buttongroup,
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
115 QFrame* frame)
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
116 : Object (go, frame), m_hiddenbutton(0), m_container (0), m_title (0),
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
117 m_blockUpdates (false)
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
118 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
119 uibuttongroup::properties& pp = properties<uibuttongroup> ();
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
120
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
121 frame->setObjectName ("UIButtonGroup");
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
122 frame->setAutoFillBackground (true);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
123 Matrix bb = pp.get_boundingbox (false);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
124 frame->setGeometry (octave::math::round (bb(0)), octave::math::round (bb(1)),
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
125 octave::math::round (bb(2)), octave::math::round (bb(3)));
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
126 frame->setFrameStyle (frameStyleFromProperties (pp));
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
127 frame->setLineWidth (octave::math::round (pp.get_borderwidth ()));
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
128 QPalette pal = frame->palette ();
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
129 setupPalette (pp, pal);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
130 frame->setPalette (pal);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
131 m_buttongroup = buttongroup;
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
132 m_hiddenbutton = new QRadioButton (frame);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
133 m_hiddenbutton->hide ();
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
134 m_buttongroup->addButton (m_hiddenbutton);
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
135
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
136 m_container = new Container (frame);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
137 m_container->canvas (m_handle);
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
138
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
139 if (frame->hasMouseTracking ())
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
140 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
141 foreach (QWidget* w, frame->findChildren<QWidget*> ())
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
142 { w->setMouseTracking (true); }
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
143 foreach (QWidget* w, buttongroup->findChildren<QWidget*> ())
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
144 { w->setMouseTracking (true); }
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
145 }
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
146
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
147 QString title = Utils::fromStdString (pp.get_title ());
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
148 if (! title.isEmpty ())
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
149 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
150 m_title = new QLabel (title, frame);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
151 m_title->setAutoFillBackground (true);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
152 m_title->setContentsMargins (4, 0, 4, 0);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
153 m_title->setPalette (pal);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
154 m_title->setFont (Utils::computeFont<uibuttongroup> (pp, bb(3)));
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
155 }
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
156
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
157 frame->installEventFilter (this);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
158 m_container->installEventFilter (this);
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
159
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
160 if (pp.is_visible ())
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
161 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
162 QTimer::singleShot (0, frame, SLOT (show (void)));
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
163 QTimer::singleShot (0, buttongroup, SLOT (show (void)));
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
164 }
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
165 else
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
166 frame->hide ();
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
167
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
168 connect (m_buttongroup, SIGNAL (buttonClicked (QAbstractButton*)),
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
169 SLOT (buttonClicked (QAbstractButton*)));
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
170 }
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
171
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
172 ButtonGroup::~ButtonGroup (void)
22417
48c00363dc74 maint: Use '{ }' for empty function bodies in C++.
Rik <rik@octave.org>
parents: 22411
diff changeset
173 { }
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
174
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
175 bool
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
176 ButtonGroup::eventFilter (QObject* watched, QEvent* xevent)
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
177 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
178 if (! m_blockUpdates)
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
179 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
180 if (watched == qObject ())
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
181 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
182 switch (xevent->type ())
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
183 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
184 case QEvent::Resize:
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
185 {
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
186 gh_manager::auto_lock lock;
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
187 graphics_object go = object ();
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
188
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
189 if (go.valid_object ())
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
190 {
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
191 if (m_title)
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
192 {
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
193 const uibuttongroup::properties& pp =
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
194 Utils::properties<uibuttongroup> (go);
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
195
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
196 if (pp.fontunits_is ("normalized"))
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
197 {
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
198 QFrame* frame = qWidget<QFrame> ();
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
199
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
200 m_title->setFont (Utils::computeFont<uibuttongroup>
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
201 (pp, frame->height ()));
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
202 m_title->resize (m_title->sizeHint ());
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
203 }
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
204 }
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
205 updateLayout ();
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
206 }
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
207 }
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
208 break;
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
209
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
210 case QEvent::MouseButtonPress:
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
211 {
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
212 QMouseEvent* m = dynamic_cast<QMouseEvent*> (xevent);
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
213
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
214 if (m->button () == Qt::RightButton)
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
215 {
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
216 gh_manager::auto_lock lock;
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
217
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
218 ContextMenu::executeAt (properties (), m->globalPos ());
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
219 }
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
220 }
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
221 break;
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
222
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
223 default:
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
224 break;
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
225 }
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
226 }
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
227 else if (watched == m_container)
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
228 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
229 switch (xevent->type ())
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
230 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
231 case QEvent::Resize:
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
232 if (qWidget<QWidget> ()->isVisible ())
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
233 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
234 gh_manager::auto_lock lock;
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
235
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
236 properties ().update_boundingbox ();
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
237 }
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
238 break;
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
239
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
240 default:
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
241 break;
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
242 }
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
243 }
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
244 }
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
245
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
246 return false;
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
247 }
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
248
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
249 void
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
250 ButtonGroup::update (int pId)
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
251 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
252 uibuttongroup::properties& pp = properties<uibuttongroup> ();
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
253 QFrame* frame = qWidget<QFrame> ();
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
254
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
255 m_blockUpdates = true;
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
256
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
257 switch (pId)
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
258 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
259 case uibuttongroup::properties::ID_POSITION:
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
260 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
261 Matrix bb = pp.get_boundingbox (false);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
262
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
263 frame->setGeometry (octave::math::round (bb(0)), octave::math::round (bb(1)),
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
264 octave::math::round (bb(2)), octave::math::round (bb(3)));
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
265 updateLayout ();
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
266 }
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
267 break;
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
268
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
269 case uibuttongroup::properties::ID_BORDERWIDTH:
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
270 frame->setLineWidth (octave::math::round (pp.get_borderwidth ()));
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
271 updateLayout ();
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
272 break;
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
273
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
274 case uibuttongroup::properties::ID_BACKGROUNDCOLOR:
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
275 case uibuttongroup::properties::ID_FOREGROUNDCOLOR:
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
276 case uibuttongroup::properties::ID_HIGHLIGHTCOLOR:
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
277 case uibuttongroup::properties::ID_SHADOWCOLOR:
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
278 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
279 QPalette pal = frame->palette ();
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
280
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
281 setupPalette (pp, pal);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
282 frame->setPalette (pal);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
283 if (m_title)
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
284 m_title->setPalette (pal);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
285 }
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
286 break;
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
287
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
288 case uibuttongroup::properties::ID_TITLE:
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
289 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
290 QString title = Utils::fromStdString (pp.get_title ());
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
291
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
292 if (title.isEmpty ())
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
293 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
294 if (m_title)
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
295 delete m_title;
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
296 m_title = 0;
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
297 }
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
298 else
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
299 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
300 if (! m_title)
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
301 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
302 QPalette pal = frame->palette ();
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
303
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
304 m_title = new QLabel (title, frame);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
305 m_title->setAutoFillBackground (true);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
306 m_title->setContentsMargins (4, 0, 4, 0);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
307 m_title->setPalette (pal);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
308 m_title->setFont (Utils::computeFont<uibuttongroup> (pp));
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
309 m_title->show ();
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
310 }
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
311 else
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
312 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
313 m_title->setText (title);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
314 m_title->resize (m_title->sizeHint ());
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
315 }
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
316 }
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
317 updateLayout ();
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
318 }
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
319 break;
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
320
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
321 case uibuttongroup::properties::ID_TITLEPOSITION:
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
322 updateLayout ();
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
323 break;
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
324
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
325 case uibuttongroup::properties::ID_BORDERTYPE:
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
326 frame->setFrameStyle (frameStyleFromProperties (pp));
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
327 updateLayout ();
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
328 break;
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
329
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
330 case uibuttongroup::properties::ID_FONTNAME:
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
331 case uibuttongroup::properties::ID_FONTSIZE:
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
332 case uibuttongroup::properties::ID_FONTWEIGHT:
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
333 case uibuttongroup::properties::ID_FONTANGLE:
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
334 if (m_title)
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
335 {
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
336 m_title->setFont (Utils::computeFont<uibuttongroup> (pp));
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
337 m_title->resize (m_title->sizeHint ());
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
338 updateLayout ();
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
339 }
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
340 break;
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
341
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
342 case uibuttongroup::properties::ID_VISIBLE:
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
343 frame->setVisible (pp.is_visible ());
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
344 updateLayout ();
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
345 break;
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
346
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
347 case uibuttongroup::properties::ID_SELECTEDOBJECT:
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
348 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
349 graphics_handle h = pp.get_selectedobject ();
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
350 gh_manager::auto_lock lock;
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
351 graphics_object go = gh_manager::get_object (h);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
352 Object* selectedObject = Backend::toolkitObject (go);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
353 ToggleButtonControl* toggle = static_cast<ToggleButtonControl*>
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
354 (selectedObject);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
355 RadioButtonControl* radio = static_cast<RadioButtonControl*>(selectedObject);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
356 if (toggle)
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
357 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
358 go.get_properties ().set ("value", 1);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
359 }
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
360 else if (radio)
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
361 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
362 go.get_properties ().set ("value", 1);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
363 }
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
364 else
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
365 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
366 m_hiddenbutton->setChecked (true);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
367 }
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
368 }
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
369 break;
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
370
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
371 default:
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
372 break;
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
373 }
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
374
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
375 m_blockUpdates = false;
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
376 }
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
377
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
378 void
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
379 ButtonGroup::redraw (void)
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
380 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
381 Canvas* canvas = m_container->canvas (m_handle);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
382
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
383 if (canvas)
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
384 canvas->redraw ();
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
385 }
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
386
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
387 void
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
388 ButtonGroup::updateLayout (void)
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
389 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
390 uibuttongroup::properties& pp = properties<uibuttongroup> ();
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
391 QFrame* frame = qWidget<QFrame> ();
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
392
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
393 Matrix bb = pp.get_boundingbox (true);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
394 int bw = borderWidthFromProperties (pp);
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
395
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
396 frame->setFrameRect (QRect (octave::math::round (bb(0)) - bw,
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
397 octave::math::round (bb(1)) - bw,
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
398 octave::math::round (bb(2)) + 2*bw, octave::math::round (bb(3)) + 2*bw));
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
399 m_container->setGeometry (octave::math::round (bb(0)),
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
400 octave::math::round (bb(1)),
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
401 octave::math::round (bb(2)), octave::math::round (bb(3)));
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
402
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
403 if (m_blockUpdates)
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
404 pp.update_boundingbox ();
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
405
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
406 if (m_title)
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
407 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
408 QSize sz = m_title->sizeHint ();
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
409 int offset = 5;
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
410
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
411 if (pp.titleposition_is ("lefttop"))
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
412 m_title->move (bw+offset, 0);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
413 else if (pp.titleposition_is ("righttop"))
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
414 m_title->move (frame->width () - bw - offset - sz.width (), 0);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
415 else if (pp.titleposition_is ("leftbottom"))
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
416 m_title->move (bw+offset, frame->height () - sz.height ());
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
417 else if (pp.titleposition_is ("rightbottom"))
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
418 m_title->move (frame->width () - bw - offset - sz.width (),
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
419 frame->height () - sz.height ());
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
420 else if (pp.titleposition_is ("centertop"))
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
421 m_title->move (frame->width () / 2 - sz.width () / 2, 0);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
422 else if (pp.titleposition_is ("centerbottom"))
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
423 m_title->move (frame->width () / 2 - sz.width () / 2,
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
424 frame->height () - sz.height ());
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
425 }
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
426 }
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
427
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
428 void
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
429 ButtonGroup::selectNothing (void)
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
430 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
431 m_hiddenbutton->setChecked (true);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
432 }
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
433
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
434
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
435 void
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
436 ButtonGroup::addButton (QAbstractButton* btn)
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
437 {
23070
bef714f45999 maint: Use space after function name/before parenthesis in libgui.
Rik <rik@octave.org>
parents: 22755
diff changeset
438 m_buttongroup->addButton (btn);
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
439 connect (btn, SIGNAL (toggled (bool)), SLOT (buttonToggled (bool)));
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
440 }
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
441
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
442 void
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
443 ButtonGroup::buttonToggled (bool toggled)
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
444 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
445 Q_UNUSED (toggled);
22737
7abc25e6206a maint: Clean up code base to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 22417
diff changeset
446 if (! m_blockUpdates)
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
447 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
448 gh_manager::auto_lock lock;
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
449 uibuttongroup::properties& bp = properties<uibuttongroup> ();
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
450
23070
bef714f45999 maint: Use space after function name/before parenthesis in libgui.
Rik <rik@octave.org>
parents: 22755
diff changeset
451 graphics_handle oldValue = bp.get_selectedobject ();
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
452
23070
bef714f45999 maint: Use space after function name/before parenthesis in libgui.
Rik <rik@octave.org>
parents: 22755
diff changeset
453 QAbstractButton* checkedBtn = m_buttongroup->checkedButton ();
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
454
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
455 graphics_handle newValue = graphics_handle ();
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
456 if (checkedBtn != m_hiddenbutton)
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
457 {
23070
bef714f45999 maint: Use space after function name/before parenthesis in libgui.
Rik <rik@octave.org>
parents: 22755
diff changeset
458 Object* checkedObj = Object::fromQObject (checkedBtn);
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
459 newValue = checkedObj->properties ().get___myhandle__ ();
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
460 }
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
461
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
462 if (oldValue != newValue)
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
463 gh_manager::post_set (m_handle, "selectedobject", newValue.as_octave_value (),
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
464 false);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
465 }
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
466 }
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
467
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
468 void
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
469 ButtonGroup::buttonClicked (QAbstractButton* btn)
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
470 {
23070
bef714f45999 maint: Use space after function name/before parenthesis in libgui.
Rik <rik@octave.org>
parents: 22755
diff changeset
471 Q_UNUSED (btn);
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
472
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
473 gh_manager::auto_lock lock;
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
474 uibuttongroup::properties& bp = properties<uibuttongroup> ();
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
475
23070
bef714f45999 maint: Use space after function name/before parenthesis in libgui.
Rik <rik@octave.org>
parents: 22755
diff changeset
476 graphics_handle oldValue = bp.get_selectedobject ();
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
477
23070
bef714f45999 maint: Use space after function name/before parenthesis in libgui.
Rik <rik@octave.org>
parents: 22755
diff changeset
478 QAbstractButton* checkedBtn = m_buttongroup->checkedButton ();
bef714f45999 maint: Use space after function name/before parenthesis in libgui.
Rik <rik@octave.org>
parents: 22755
diff changeset
479 Object* checkedObj = Object::fromQObject (checkedBtn);
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
480 graphics_handle newValue = checkedObj->properties ().get___myhandle__ ();
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
481
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
482 if (oldValue != newValue)
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
483 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
484 octave_scalar_map eventData;
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
485 eventData.setfield ("OldValue", oldValue.as_octave_value ());
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
486 eventData.setfield ("NewValue", newValue.as_octave_value ());
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
487 eventData.setfield ("Source", bp.get___myhandle__ ().as_octave_value ());
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
488 eventData.setfield ("EventName", "SelectionChanged");
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
489 octave_value selectionChangedEventObject = octave_value (new octave_struct (
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
490 eventData));
23070
bef714f45999 maint: Use space after function name/before parenthesis in libgui.
Rik <rik@octave.org>
parents: 22755
diff changeset
491 gh_manager::post_callback (m_handle, "selectionchangedfcn",
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
492 selectionChangedEventObject);
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
493 }
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
494 }
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
495
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
496 };
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22188
diff changeset
497