2 Copyright 2004-2005 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, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include "vserverselect.h"
32 VServerSelect::VServerSelect(vector<VDRServer>& servers, void* treplyTo)
34 // I tried the whole passing using a reference here, but
35 // the program segfaulted when settitletext tried to new
36 // a char array. so now we have the messy dereferencing...
37 // anyway, now it doesn't use a object wide reference.
41 if (Video::getInstance()->getFormat() == Video::PAL)
43 setPosition(220, 200);
47 setPosition(210, 150);
51 setTitleBarColour(Colour::TITLEBARBACKGROUND);
52 setTitleText(tr("Choose a VDR server"));
54 sl.setPosition(10, 30 + 5);
55 sl.setSize(area.w - 20, area.h - 30 - 15);
58 sl.addOption(servers[0].name, 0, 1);
59 for(UINT k = 1; k < servers.size(); k++)
61 sl.addOption(servers[k].name, 0, 0);
67 VServerSelect::~VServerSelect()
71 void VServerSelect::draw()
76 int VServerSelect::handleCommand(int command)
85 BoxStack::getInstance()->update(this);
93 BoxStack::getInstance()->update(this);
98 Message* m = new Message(); // Question/Answer mech. Better being messages
100 m->message = Message::SERVER_SELECTED;
101 m->parameter = sl.getCurrentOption();
102 Command::getInstance()->postMessageNoLock(m);
110 void VServerSelect::processMessage(Message* m)
112 if (m->message == Message::MOUSE_MOVE)
114 if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
117 BoxStack::getInstance()->update(this);
120 else if (m->message == Message::MOUSE_LBDOWN)
122 if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
124 BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press