2 Copyright 2004-2020 Chris Tallon
4 This file is part of VOMP.
6 VOMP is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 VOMP is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with VOMP. If not, see <https://www.gnu.org/licenses/>.
26 #include "messagequeue.h"
28 #include "vserverselect.h"
30 VServerSelect::VServerSelect(const VDPC& servers, void* treplyTo)
34 if (Video::getInstance()->getFormat() == Video::PAL)
36 setPosition(220, 200);
40 setPosition(210, 150);
44 setTitleBarColour(DrawStyle::TITLEBARBACKGROUND);
45 setTitleText(tr("Choose a VDR server"));
47 sl.setPosition(10, 30 + 5);
48 sl.setSize(area.w - 20, area.h - 30 - 15);
51 sl.addOption(servers[0].name.c_str(), 0, 1);
52 for(UINT k = 1; k < servers.numServers(); k++)
54 sl.addOption(servers[k].name.c_str(), 0, 0);
60 VServerSelect::~VServerSelect()
64 void VServerSelect::draw()
69 int VServerSelect::handleCommand(int command)
77 BoxStack::getInstance()->update(this);
84 BoxStack::getInstance()->update(this);
89 Message* m = new Message(); // Question/Answer mech. Better being messages
91 m->message = Message::SERVER_SELECTED;
92 m->parameter = sl.getCurrentOption();
93 MessageQueue::getInstance()->postMessage(m);
101 void VServerSelect::processMessage(Message* m)
103 if (m->message == Message::MOUSE_MOVE)
105 if (sl.mouseMove(m->parameter - getScreenX(), m->tag - getScreenY()))
108 BoxStack::getInstance()->update(this);
111 else if (m->message == Message::MOUSE_LBDOWN)
113 if (sl.mouseLBDOWN(m->parameter - getScreenX(), m->tag - getScreenY()))
115 BoxStack::getInstance()->handleCommand(Input::OK); //simulate OK press