ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/cf.schmorp.de/dclient/src/backend/ndk/application.cpp
Revision: 1.2
Committed: Mon Oct 18 14:11:48 2010 UTC (16 years ago) by sf-pippijn
Branch: MAIN
Changes since 1.1: +1 -1 lines
Log Message:
check and log but do not die when ncurses stuff fails

File Contents

# Content
1 /* application.cc
2 * This file is part of NDK++ library
3 * Copyright (c) 2003,2004 by Stanislav Ievlev
4 *
5 * This file is covered by the GNU Library General Public License,
6 * which should be included with libndk++ as the file COPYING.
7 */
8
9 #include <ndk++/application.hh>
10
11 #include <ndk++/color.hh>
12 #include <ndk++/keymap.hh>
13 #include <ndk++/palette.hh>
14 #include <ndk++/panel.hh>
15
16 #include <ncurses/assert.hh>
17
18 #include <clocale>
19
20 using ndk::application;
21
22 application &
23 ndk::app ()
24 {
25 static application *instance;
26
27 setlocale (LC_ALL, "");
28 if (!instance)
29 instance = new application;
30 return *instance;
31 }
32
33 application::application ()
34 : ncurses::application ()
35 {
36 if (!has_keymap ())
37 return_unless (keypad (stdscr, true) == OK);
38
39 palette::obj_type &p = palette::instance ();
40
41 p[colors::button_default]
42 = p[colors::label]
43 = p[colors::panel] = { COLOR_WHITE, COLOR_BLACK };
44
45 p[colors::title]
46 = p[colors::frame1] = { COLOR_WHITE, COLOR_BLUE, WA_BOLD };
47 p[colors::frame2] = { COLOR_WHITE, COLOR_BLACK };
48
49 p[colors::button_focused] = { COLOR_BLACK, COLOR_WHITE };
50 p[colors::button_selected] = { COLOR_WHITE, COLOR_WHITE, WA_BOLD };
51 p[colors::minibutton] = { COLOR_WHITE, COLOR_BLACK };
52
53 p[colors::edit_active] = { COLOR_WHITE, COLOR_BLACK, WA_BOLD };
54 p[colors::edit_inactive] = { COLOR_WHITE, COLOR_BLACK };
55 }
56
57 ndk::engine *
58 application::events ()
59 {
60 return &events_;
61 }
62
63 void
64 application::update ()
65 {
66 events_.update ();
67 }
68
69 void
70 application::process (int ch)
71 {
72 events_.process (ch);
73 }
74
75 void
76 application::in_focus (panel &other)
77 {
78 events_.in_focus (other.events ());
79 }