From 2455a350e8bccd930e4a2420028f7c7a0f3dff9e Mon Sep 17 00:00:00 2001 From: fluxgen Date: Wed, 1 Sep 2004 12:41:11 +0000 Subject: foreground and background color as argument --- src/tests/testFont.cc | 39 ++++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/src/tests/testFont.cc b/src/tests/testFont.cc index c450216..e8a3687 100644 --- a/src/tests/testFont.cc +++ b/src/tests/testFont.cc @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: testFont.cc,v 1.6 2003/09/11 16:51:03 fluxgen Exp $ +// $Id: testFont.cc,v 1.7 2004/09/01 12:41:11 fluxgen Exp $ #include "App.hh" #include "FbWindow.hh" @@ -38,13 +38,14 @@ using namespace std; class App:public FbTk::App, public FbTk::EventHandler { public: - App(const char *displayname): + App(const char *displayname, const string &foreground, const string background): FbTk::App(displayname), m_win(DefaultScreen(display()), 0, 0, 640, 480, KeyPressMask | ExposureMask) { - + m_background = background; + m_foreground = foreground; m_win.show(); - m_win.setBackgroundColor(FbTk::Color("white", m_win.screenNumber())); + m_win.setBackgroundColor(FbTk::Color(background.c_str(), m_win.screenNumber())); FbTk::EventManager::instance()->add(*this, m_win); } ~App() { @@ -84,7 +85,8 @@ public: wingc.setForeground(FbTk::Color("red", m_win.screenNumber())); m_win.drawLine(wingc.gc(), x, y, x + text_w, y); - wingc.setForeground(FbTk::Color("black", m_win.screenNumber())); + wingc.setForeground(FbTk::Color(m_foreground.c_str(), m_win.screenNumber())); + cerr<<"text width: "<"<"<"<"<"<