/* vim:set ts=4 sw=4 sts=4 et cindent: */ /* * nanodc - The ncurses DC++ client * Copyright © 2005-2006 Markus Lindqvist * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * Contributor(s): * */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace ui { Manager::Manager(): m_lastDraw(utils::get_millisecs()) { events::add_listener("client created", std::tr1::bind(&Manager::create_windows, this)); events::add_listener("client created", std::tr1::bind(&Manager::init_statusbar, this)); events::add_listener_first("window updated", std::tr1::bind(&Manager::redraw_screen, this)); events::add_listener_first("statusbar updated", std::tr1::bind(&Manager::redraw_screen, this)); } void Manager::redraw_screen() { m_screenMutex.lock(); if(m_lastDraw+20 < utils::get_millisecs()) { display::Manager::get()->redraw(); m_lastDraw = utils::get_millisecs(); } m_screenMutex.unlock(); } void Manager::init() { display::Screen::initialize(); display::Manager::create(); display::Manager::get()->push_back(new ui::WindowLog()); display::StatusBar::get()->add_item(new ui::StatusClock()); } void Manager::create_windows() { display::Manager *dm = display::Manager::get(); dm->push_back(new ui::WindowHubs()); dm->push_back(new ui::WindowFavorites()); dm->push_back(new ui::WindowTransfers()); } void Manager::init_statusbar() { display::StatusBar *m_statusbar = display::StatusBar::get(); m_statusbar->add_item(new ui::StatusUser()); m_statusbar->add_item(new ui::StatusWindowInfo()); m_statusbar->add_item(new ui::StatusWindowList()); m_statusbar->add_item(new ui::StatusHash()); } Manager::~Manager() { } } // namespace ui