4 XCSoar Glide Computer - http://www.xcsoar.org/
5 Copyright (C) 2000-2013 The XCSoar Project
6 A detailed list of copyright holders can be found in the file "AUTHORS".
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 #include "MacCreadySetup.hpp"
25 #include "Screen/Layout.hpp"
26 #include "Widget/WindowWidget.hpp"
27 #include "Form/Button.hpp"
28 #include "Form/ActionListener.hpp"
29 #include "Interface.hpp"
30 #include "UIGlobals.hpp"
31 #include "Language/Language.hpp"
32 #include "Profile/Profile.hpp"
36 class MacCreadySetupPanel
: public WindowWidget
,
37 private ActionListener
{
39 WndButton
&GetButton() {
40 return *(WndButton
*)GetWindow();
44 static const TCHAR
*GetCaption() {
45 return CommonInterface::GetComputerSettings().task
.auto_mc
50 void UpdateCaption() {
51 GetButton().SetCaption(GetCaption());
54 /* virtual methods from class Widget */
55 virtual PixelSize
GetMinimumSize() const override
{
56 return PixelSize
{Layout::Scale(80u), Layout::Scale(30u)};
59 virtual void Prepare(ContainerWindow
&parent
,
60 const PixelRect
&rc
) override
;
62 virtual void Show(const PixelRect
&rc
) override
;
64 /* virtual methods from class ActionListener */
65 virtual void OnAction(int id
) override
;
69 MacCreadySetupPanel::OnAction(int id
)
71 TaskBehaviour
&task_behaviour
= CommonInterface::SetComputerSettings().task
;
72 task_behaviour
.auto_mc
= !task_behaviour
.auto_mc
;
73 Profile::Set(ProfileKeys::AutoMc
, task_behaviour
.auto_mc
);
79 MacCreadySetupPanel::Prepare(ContainerWindow
&parent
, const PixelRect
&rc
)
81 ButtonWindowStyle style
;
85 SetWindow(new WndButton(parent
, UIGlobals::GetDialogLook(), GetCaption(), rc
,
90 MacCreadySetupPanel::Show(const PixelRect
&rc
)
93 WindowWidget::Show(rc
);
97 LoadMacCreadySetupPanel(unsigned id
)
99 return new MacCreadySetupPanel();