From fbe722de6da27d80c69551bdeffa271764094c6f Mon Sep 17 00:00:00 2001 From: fluxgen Date: Thu, 11 Sep 2003 16:51:21 +0000 Subject: update --- src/tests/Makefile | 16 ++++---- src/tests/testFont.cc | 108 ++++++++++++++++++++++++++------------------------ 2 files changed, 65 insertions(+), 59 deletions(-) diff --git a/src/tests/Makefile b/src/tests/Makefile index 2df6ebe..90e45ce 100644 --- a/src/tests/Makefile +++ b/src/tests/Makefile @@ -4,13 +4,12 @@ LIBS= XFLAGS= -I/usr/X11R6/include XLIBS= -L/usr/X11R6/lib -lX11 -lXft COMPILEFILE=$(CXX) -c $(CXXFLAGS) -FONT_OBJ = ../BaseDisplay.o ../FbTk/Font.o ../FbTk/XFontImp.o ../FbTk/XftFontImp.o ../FbTk/XmbFontImp.o \ - ../FbTk/Timer.o ../StringUtil.o ../i18n.o +FONT_OBJ = ../FbTk/libFbTk.a -all: testLayers testStringUtil testKeys testResource testSignal +all: testLayers testStringUtil testKeys testResource testSignal glxtest .cc.o: - $(CXX) -c $(CXXFLAGS) $< -o $@ + $(CXX) -c $(CXXFLAGS) $< ../FbTk/XftFontImp.o: ../FbTk/XftFontImp.hh ../FbTk/XftFontImp.cc @@ -20,8 +19,11 @@ all: testLayers testStringUtil testKeys testResource testSignal ../FbTk/Font.o: ../FbTk/XFontImp.hh ../FbTk/XftFontImp.hh ../FbTk/XmbFontImp.hh ../FbTk/Font.hh ../FbTk/Font.cc +glxtest: ../FbTk/App.hh glxtest.cc + ${CXX} glxtest.cc ${CXXFLAGS} ${XLIBS} -lGL -lGLU -lXpm -o glxtest + StringUtil.o: ../StringUtil.cc ../StringUtil.hh - $(CXX) -c $(CXXFLAGS) ../StringUtil.cc -o StringUtil.o + $(CXX) -c $(CXXFLAGS) ../StringUtil.cc Keys.o: ../Keys.cc ../Keys.hh $(CXX) -c $(CXXFLAGS) $(XFLAGS) ../Keys.cc -o Keys.o @@ -32,8 +34,8 @@ Resource.o: ../Resource.cc ../Resource.hh ../FbTk/SignalHandler.o: ${COMPILEFILE} ../FbTk/SignalHandler.cc -o ../FbTk/SignalHandler.o -testStringUtil: StringUtiltest.o StringUtil.o - $(CXX) $(LIBS) StringUtiltest.o StringUtil.o -o testStringUtil +testStringUtil: StringUtiltest.o ../FbTk/StringUtil.o + $(CXX) $(LIBS) StringUtiltest.o ../FbTk/StringUtil.o -o testStringUtil testKeys: Keys.o testKeys.o StringUtil.o $(CXX) $(LIBS) $(XLIBS) StringUtil.o Keys.o testKeys.o -o testKeys diff --git a/src/tests/testFont.cc b/src/tests/testFont.cc index 7498194..c450216 100644 --- a/src/tests/testFont.cc +++ b/src/tests/testFont.cc @@ -19,92 +19,91 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: testFont.cc,v 1.5 2002/12/01 13:42:15 rathnor Exp $ +// $Id: testFont.cc,v 1.6 2003/09/11 16:51:03 fluxgen Exp $ +#include "App.hh" +#include "FbWindow.hh" #include "Font.hh" -#include "BaseDisplay.hh" +#include "EventHandler.hh" +#include "EventManager.hh" +#include "GContext.hh" +#include "Color.hh" -#include #include #include -#include + #include #include using namespace std; -class App:public BaseDisplay { +class App:public FbTk::App, public FbTk::EventHandler { public: - App(const char *displayname):BaseDisplay("app", displayname) { + App(const char *displayname): + FbTk::App(displayname), + m_win(DefaultScreen(display()), + 0, 0, 640, 480, KeyPressMask | ExposureMask) { - // using screen 0 - m_win = XCreateSimpleWindow(getXDisplay(), - DefaultRootWindow(getXDisplay()), - 0, 0, - 640, 480, - 1, - 0, - 0xFFFF); - XSelectInput(getXDisplay(), m_win, KeyPressMask|ExposureMask); - XMapWindow(getXDisplay(), m_win); + m_win.show(); + m_win.setBackgroundColor(FbTk::Color("white", m_win.screenNumber())); + FbTk::EventManager::instance()->add(*this, m_win); } ~App() { - XDestroyWindow(getXDisplay(), m_win); } - - void handleEvent(XEvent * const ev) { - switch (ev->type) { - case KeyPress: - KeySym ks; - char keychar[1]; - XLookupString(&ev->xkey, keychar, 1, &ks, 0); - if (ks == XK_Escape) - shutdown(); - else { // toggle antialias - m_font.setAntialias(!m_font.isAntialias()); - cerr<