| 1 |
sf-pippijn |
1.1 |
/* color.cc |
| 2 |
|
|
* This file is part of ncursesxx 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 libncursesxx as the file COPYING. |
| 7 |
|
|
*/ |
| 8 |
|
|
#include <ncurses/color.hh> |
| 9 |
|
|
|
| 10 |
|
|
#include <ncurses/assert.hh> |
| 11 |
|
|
#include <ncurses/support.hh> |
| 12 |
|
|
|
| 13 |
|
|
#include <algorithm> |
| 14 |
|
|
|
| 15 |
|
|
using ncurses::color; |
| 16 |
|
|
|
| 17 |
|
|
static short color_counter; |
| 18 |
|
|
|
| 19 |
|
|
color::color () |
| 20 |
|
|
: attr_ (WA_NORMAL) |
| 21 |
|
|
, num_ (-1) |
| 22 |
|
|
{ |
| 23 |
|
|
} |
| 24 |
|
|
|
| 25 |
|
|
color::color (short f, short b, attr_t attr) |
| 26 |
|
|
: attr_ (attr) |
| 27 |
|
|
, num_ (++color_counter) |
| 28 |
|
|
{ |
| 29 |
|
|
if (has_colors ()) |
| 30 |
|
|
NCURSES_ASSERT (init_pair (num_, f, b)); |
| 31 |
|
|
} |
| 32 |
|
|
|
| 33 |
|
|
color::~color () |
| 34 |
|
|
{ |
| 35 |
|
|
} |
| 36 |
|
|
|
| 37 |
|
|
attr_t |
| 38 |
|
|
color::attr () const |
| 39 |
|
|
{ |
| 40 |
|
|
return attr_; |
| 41 |
|
|
} |
| 42 |
|
|
|
| 43 |
|
|
short |
| 44 |
|
|
color::num () const |
| 45 |
|
|
{ |
| 46 |
|
|
return num_; |
| 47 |
|
|
} |