Mercurial > octave
annotate libgui/graphics/ButtonGroup.cc @ 22411:c69805d1fa64
maint: Style check C++ code in libgui/
* Backend.cc, Backend.h, BaseControl.cc, BaseControl.h, ButtonControl.cc,
ButtonControl.h, ButtonGroup.cc, ButtonGroup.h, Canvas.cc, Canvas.h,
CheckBoxControl.cc, CheckBoxControl.h, Container.cc, Container.h,
ContextMenu.cc, ContextMenu.h, EditControl.cc, EditControl.h, Figure.cc,
Figure.h, FigureWindow.cc, FigureWindow.h, GLCanvas.cc, GLCanvas.h,
GenericEventNotify.h, KeyMap.cc, KeyMap.h, ListBoxControl.cc, ListBoxControl.h,
Logger.cc, Logger.h, Menu.cc, Menu.h, MenuContainer.h, MouseModeActionGroup.cc,
MouseModeActionGroup.h, Object.cc, Object.h, ObjectFactory.cc, ObjectFactory.h,
ObjectProxy.cc, ObjectProxy.h, Panel.cc, Panel.h, PopupMenuControl.cc,
PopupMenuControl.h, PushButtonControl.cc, PushButtonControl.h, PushTool.cc,
PushTool.h, QtHandlesUtils.cc, QtHandlesUtils.h, RadioButtonControl.cc,
RadioButtonControl.h, SliderControl.cc, SliderControl.h, TextControl.cc,
TextControl.h, TextEdit.cc, TextEdit.h, ToggleButtonControl.cc,
ToggleButtonControl.h, ToggleTool.cc, ToggleTool.h, ToolBar.cc, ToolBar.h,
ToolBarButton.cc, ToolBarButton.h, __init_qt__.cc, __init_qt__.h,
annotation-dialog.cc, annotation-dialog.h, gl-select.cc, gl-select.h,
color-picker.cc, color-picker.h, dialog.h, documentation-dock-widget.cc,
documentation-dock-widget.h, files-dock-widget.cc, files-dock-widget.h,
find-files-dialog.h, find-files-model.cc, find-files-model.h,
history-dock-widget.cc, history-dock-widget.h, liboctgui-build-info.h,
liboctgui-build-info.in.cc, file-editor-interface.h, file-editor-tab.cc,
file-editor-tab.h, file-editor.cc, file-editor.h, find-dialog.cc,
find-dialog.h, marker.cc, marker.h, octave-qscintilla.cc, octave-qscintilla.h,
octave-txt-lexer.cc, octave-txt-lexer.h, main-window.cc, main-window.h,
octave-cmd.cc, octave-cmd.h, octave-dock-widget.cc, octave-dock-widget.h,
octave-gui.cc, octave-gui.h, octave-interpreter.cc, octave-interpreter.h,
octave-qt-link.cc, octave-qt-link.h, parser.cc, parser.h, webinfo.cc,
webinfo.h, resource-manager.cc, resource-manager.h, settings-dialog.cc,
settings-dialog.h, shortcut-manager.cc, shortcut-manager.h,
terminal-dock-widget.h, thread-manager.cc, thread-manager.h, welcome-wizard.cc,
welcome-wizard.h, workspace-model.cc, workspace-model.h, workspace-view.cc,
workspace-view.h:
Style check C++ code in libgui/
author | Rik <rik@octave.org> |
---|---|
date | Wed, 31 Aug 2016 12:20:46 -0700 |
parents | 1344509a480c |
children | 48c00363dc74 |
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 |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
8 under the terms of the GNU General Public License as published by the |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
9 Free Software Foundation; either version 3 of the License, or (at your |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
10 option) any later version. |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
11 |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
15 for more details. |
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 | 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 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
106 QFrame* frame = new QFrame(container); |
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) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
173 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
174 } |
21824
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
175 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
176 bool |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
177 ButtonGroup::eventFilter (QObject* watched, QEvent* xevent) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
178 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
179 if (! m_blockUpdates) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
180 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
181 if (watched == qObject ()) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
182 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
183 switch (xevent->type ()) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
184 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
185 case QEvent::Resize: |
21824
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
186 { |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
187 gh_manager::auto_lock lock; |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
188 graphics_object go = object (); |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
189 |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
190 if (go.valid_object ()) |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
191 { |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
192 if (m_title) |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
193 { |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
194 const uibuttongroup::properties& pp = |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
195 Utils::properties<uibuttongroup> (go); |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
196 |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
197 if (pp.fontunits_is ("normalized")) |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
198 { |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
199 QFrame* frame = qWidget<QFrame> (); |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
200 |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
201 m_title->setFont (Utils::computeFont<uibuttongroup> |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
202 (pp, frame->height ())); |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
203 m_title->resize (m_title->sizeHint ()); |
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 } |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
206 updateLayout (); |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
207 } |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
208 } |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
209 break; |
21824
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
210 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
211 case QEvent::MouseButtonPress: |
21824
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
212 { |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
213 QMouseEvent* m = dynamic_cast<QMouseEvent*> (xevent); |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
214 |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
215 if (m->button () == Qt::RightButton) |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
216 { |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
217 gh_manager::auto_lock lock; |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
218 |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
219 ContextMenu::executeAt (properties (), m->globalPos ()); |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
220 } |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
221 } |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
222 break; |
21824
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
223 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
224 default: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
225 break; |
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 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
228 else if (watched == m_container) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
229 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
230 switch (xevent->type ()) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
231 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
232 case QEvent::Resize: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
233 if (qWidget<QWidget> ()->isVisible ()) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
234 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
235 gh_manager::auto_lock lock; |
21824
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
236 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
237 properties ().update_boundingbox (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
238 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
239 break; |
21824
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
240 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
241 default: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
242 break; |
21824
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 } |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
245 } |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
246 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
247 return false; |
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 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
250 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
251 ButtonGroup::update (int pId) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
252 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
253 uibuttongroup::properties& pp = properties<uibuttongroup> (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
254 QFrame* frame = qWidget<QFrame> (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
255 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
256 m_blockUpdates = true; |
21824
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
257 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
258 switch (pId) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
259 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
260 case uibuttongroup::properties::ID_POSITION: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
261 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
262 Matrix bb = pp.get_boundingbox (false); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
263 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
264 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
|
265 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
|
266 updateLayout (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
267 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
268 break; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
269 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
270 case uibuttongroup::properties::ID_BORDERWIDTH: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
271 frame->setLineWidth (octave::math::round (pp.get_borderwidth ())); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
272 updateLayout (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
273 break; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
274 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
275 case uibuttongroup::properties::ID_BACKGROUNDCOLOR: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
276 case uibuttongroup::properties::ID_FOREGROUNDCOLOR: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
277 case uibuttongroup::properties::ID_HIGHLIGHTCOLOR: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
278 case uibuttongroup::properties::ID_SHADOWCOLOR: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
279 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
280 QPalette pal = frame->palette (); |
21824
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
281 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
282 setupPalette (pp, pal); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
283 frame->setPalette (pal); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
284 if (m_title) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
285 m_title->setPalette (pal); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
286 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
287 break; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
288 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
289 case uibuttongroup::properties::ID_TITLE: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
290 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
291 QString title = Utils::fromStdString (pp.get_title ()); |
21824
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
292 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
293 if (title.isEmpty ()) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
294 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
295 if (m_title) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
296 delete m_title; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
297 m_title = 0; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
298 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
299 else |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
300 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
301 if (! m_title) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
302 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
303 QPalette pal = frame->palette (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
304 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
305 m_title = new QLabel (title, frame); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
306 m_title->setAutoFillBackground (true); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
307 m_title->setContentsMargins (4, 0, 4, 0); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
308 m_title->setPalette (pal); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
309 m_title->setFont (Utils::computeFont<uibuttongroup> (pp)); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
310 m_title->show (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
311 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
312 else |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
313 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
314 m_title->setText (title); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
315 m_title->resize (m_title->sizeHint ()); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
316 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
317 } |
21824
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
318 updateLayout (); |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
319 } |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
320 break; |
21824
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
321 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
322 case uibuttongroup::properties::ID_TITLEPOSITION: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
323 updateLayout (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
324 break; |
21824
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
325 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
326 case uibuttongroup::properties::ID_BORDERTYPE: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
327 frame->setFrameStyle (frameStyleFromProperties (pp)); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
328 updateLayout (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
329 break; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
330 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
331 case uibuttongroup::properties::ID_FONTNAME: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
332 case uibuttongroup::properties::ID_FONTSIZE: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
333 case uibuttongroup::properties::ID_FONTWEIGHT: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
334 case uibuttongroup::properties::ID_FONTANGLE: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
335 if (m_title) |
21824
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
336 { |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
337 m_title->setFont (Utils::computeFont<uibuttongroup> (pp)); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
338 m_title->resize (m_title->sizeHint ()); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
339 updateLayout (); |
21824
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
340 } |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
341 break; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
342 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
343 case uibuttongroup::properties::ID_VISIBLE: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
344 frame->setVisible (pp.is_visible ()); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
345 updateLayout (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
346 break; |
21824
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
347 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
348 case uibuttongroup::properties::ID_SELECTEDOBJECT: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
349 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
350 graphics_handle h = pp.get_selectedobject (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
351 gh_manager::auto_lock lock; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
352 graphics_object go = gh_manager::get_object (h); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
353 Object* selectedObject = Backend::toolkitObject (go); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
354 ToggleButtonControl* toggle = static_cast<ToggleButtonControl*> |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
355 (selectedObject); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
356 RadioButtonControl* radio = static_cast<RadioButtonControl*>(selectedObject); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
357 if (toggle) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
358 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
359 go.get_properties ().set ("value", 1); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
360 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
361 else if (radio) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
362 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
363 go.get_properties ().set ("value", 1); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
364 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
365 else |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
366 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
367 m_hiddenbutton->setChecked (true); |
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 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
370 break; |
21824
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
371 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
372 default: |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
373 break; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
374 } |
21824
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
375 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
376 m_blockUpdates = false; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
377 } |
21824
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
378 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
379 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
380 ButtonGroup::redraw (void) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
381 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
382 Canvas* canvas = m_container->canvas (m_handle); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
383 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
384 if (canvas) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
385 canvas->redraw (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
386 } |
21824
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
387 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
388 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
389 ButtonGroup::updateLayout (void) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
390 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
391 uibuttongroup::properties& pp = properties<uibuttongroup> (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
392 QFrame* frame = qWidget<QFrame> (); |
21824
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
393 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
394 Matrix bb = pp.get_boundingbox (true); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
395 int bw = borderWidthFromProperties (pp); |
21824
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
396 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
397 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
|
398 octave::math::round (bb(1)) - bw, |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
399 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
|
400 m_container->setGeometry (octave::math::round (bb(0)), |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
401 octave::math::round (bb(1)), |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
402 octave::math::round (bb(2)), octave::math::round (bb(3))); |
21824
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
403 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
404 if (m_blockUpdates) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
405 pp.update_boundingbox (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
406 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
407 if (m_title) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
408 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
409 QSize sz = m_title->sizeHint (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
410 int offset = 5; |
21824
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
411 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
412 if (pp.titleposition_is ("lefttop")) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
413 m_title->move (bw+offset, 0); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
414 else if (pp.titleposition_is ("righttop")) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
415 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
|
416 else if (pp.titleposition_is ("leftbottom")) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
417 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
|
418 else if (pp.titleposition_is ("rightbottom")) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
419 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
|
420 frame->height () - sz.height ()); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
421 else if (pp.titleposition_is ("centertop")) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
422 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
|
423 else if (pp.titleposition_is ("centerbottom")) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
424 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
|
425 frame->height () - sz.height ()); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
426 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
427 } |
21824
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
428 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
429 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
430 ButtonGroup::selectNothing (void) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
431 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
432 m_hiddenbutton->setChecked (true); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
433 } |
21824
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
434 |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
435 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
436 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
437 ButtonGroup::addButton (QAbstractButton* btn) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
438 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
439 m_buttongroup->addButton(btn); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
440 connect (btn, SIGNAL (toggled (bool)), SLOT (buttonToggled (bool))); |
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 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
443 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
444 ButtonGroup::buttonToggled (bool toggled) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
445 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
446 Q_UNUSED (toggled); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
447 if (!m_blockUpdates) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
448 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
449 gh_manager::auto_lock lock; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
450 uibuttongroup::properties& bp = properties<uibuttongroup> (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
451 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
452 graphics_handle oldValue = bp.get_selectedobject(); |
21824
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
453 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
454 QAbstractButton* checkedBtn = m_buttongroup->checkedButton(); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
455 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
456 graphics_handle newValue = graphics_handle (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
457 if (checkedBtn != m_hiddenbutton) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
458 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
459 Object* checkedObj = Object::fromQObject(checkedBtn); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
460 newValue = checkedObj->properties ().get___myhandle__ (); |
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 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
463 if (oldValue != newValue) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
464 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
|
465 false); |
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 |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
469 void |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
470 ButtonGroup::buttonClicked (QAbstractButton* btn) |
21824
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
471 { |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
472 Q_UNUSED(btn); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
473 |
21824
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
474 gh_manager::auto_lock lock; |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
475 uibuttongroup::properties& bp = properties<uibuttongroup> (); |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
476 |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
477 graphics_handle oldValue = bp.get_selectedobject(); |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
478 |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
479 QAbstractButton* checkedBtn = m_buttongroup->checkedButton(); |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
480 Object* checkedObj = Object::fromQObject(checkedBtn); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
481 graphics_handle newValue = checkedObj->properties ().get___myhandle__ (); |
21824
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
482 |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
483 if (oldValue != newValue) |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
484 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
485 octave_scalar_map eventData; |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
486 eventData.setfield ("OldValue", oldValue.as_octave_value ()); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
487 eventData.setfield ("NewValue", newValue.as_octave_value ()); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
488 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
|
489 eventData.setfield ("EventName", "SelectionChanged"); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
490 octave_value selectionChangedEventObject = octave_value (new octave_struct ( |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
491 eventData)); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
492 gh_manager::post_callback(m_handle, "selectionchangedfcn", |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
493 selectionChangedEventObject); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
494 } |
21824
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 |
6780a8657be3
Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff
changeset
|
497 }; |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22188
diff
changeset
|
498 |