/* panel.cc * This file is part of NDK++ library * Copyright (c) 2003,2004 by Stanislav Ievlev * * This file is covered by the GNU Library General Public License, * which should be included with libndk++ as the file COPYING. */ #include #include #include #include ndk::panel::panel (panel *parent) : ncurses::panel (parent) , events_ (parent ? parent->events () : 0, this) { events ()->on_system (ndk::slot (&panel::at_system, this)); } /** * @todo add support for palette */ void ndk::panel::draw () { ncurses::pen (*this).fill (palette::instance ()[colors::panel]); } int ndk::panel::padding () const { return 0; } void ndk::panel::emit (int type) { events_.emit (type); } ndk::engine * ndk::panel::events () { return &events_; } void ndk::panel::in_focus (panel &other) { events_.in_focus (other.events ()); } void ndk::panel::focus () { if (parent ()) { dynamic_cast (*parent ()).focus (); dynamic_cast (*parent ()).in_focus (*this); } else ndk::app ().in_focus (*this); } ndk::event::result ndk::panel::at_system (const event &ev) { if (!ev.sender_ && engine::enter_focus == ev.type_) { top (); return event::accepted; } return event::ignored; }