| 1 |
/* label.hh |
| 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 |
#ifndef NDK_XX_LABEL_HH__ |
| 9 |
#define NDK_XX_LABEL_HH__ |
| 10 |
|
| 11 |
#include <string> |
| 12 |
|
| 13 |
#include <ndk/pen.hh> |
| 14 |
#include <ndk/panel.hh> |
| 15 |
|
| 16 |
namespace ndk |
| 17 |
{ |
| 18 |
/** |
| 19 |
* General label object, add to ndk::panel |
| 20 |
* feature to set/get and draw text |
| 21 |
*/ |
| 22 |
struct label |
| 23 |
: panel |
| 24 |
{ |
| 25 |
label (const std::string &str, panel *parent = 0); |
| 26 |
|
| 27 |
void set_text (const std::string &str); /**< set label text */ |
| 28 |
const std::string &text () const; /**< get label text */ |
| 29 |
|
| 30 |
virtual void draw (); /**< draw text in the window, don't made refresh */ |
| 31 |
|
| 32 |
protected: |
| 33 |
void draw (const std::string &str, std::string::size_type begin); /* draw text on the label */ |
| 34 |
virtual void set_color (pen &p); /** set default color of the label */ |
| 35 |
std::string text_; /**< label's text */ |
| 36 |
}; |
| 37 |
} |
| 38 |
|
| 39 |
#endif |