Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

CArchConsoleWindows.h

00001 /*
00002  * synergy -- mouse and keyboard sharing utility
00003  * Copyright (C) 2002 Chris Schoeneman
00004  * 
00005  * This package is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * found in the file COPYING that should have accompanied this file.
00008  * 
00009  * This package is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  */
00014 
00015 #ifndef CARCHCONSOLEWINDOWS_H
00016 #define CARCHCONSOLEWINDOWS_H
00017 
00018 #define WIN32_LEAN_AND_MEAN
00019 
00020 #include "IArchConsole.h"
00021 #include "IArchMultithread.h"
00022 #include "stddeque.h"
00023 #include <windows.h>
00024 
00025 #define ARCH_CONSOLE CArchConsoleWindows
00026 
00028 class CArchConsoleWindows : public IArchConsole {
00029 public:
00030     CArchConsoleWindows(void*);
00031     virtual ~CArchConsoleWindows();
00032 
00033     // IArchConsole overrides
00034     virtual void        openConsole(const char* title);
00035     virtual void        closeConsole();
00036     virtual void        showConsole(bool showIfEmpty);
00037     virtual void        writeConsole(const char*);
00038     virtual const char* getNewlineForConsole();
00039 
00040 private:
00041     void                clearBuffer();
00042     void                appendBuffer(const char*);
00043     void                setSize(int width, int height);
00044 
00045     LRESULT             wndProc(HWND, UINT, WPARAM, LPARAM);
00046     static LRESULT CALLBACK
00047                         staticWndProc(HWND, UINT, WPARAM, LPARAM);
00048     void                threadMainLoop();
00049     static void*        threadEntry(void*);
00050 
00051 private:
00052     typedef std::deque<std::string> MessageBuffer;
00053 
00054     static CArchConsoleWindows* s_instance;
00055     static HINSTANCE    s_appInstance;
00056 
00057     // multithread data
00058     CArchMutex          m_mutex;
00059     CArchCond           m_condVar;
00060     bool                m_ready;
00061     CArchThread         m_thread;
00062 
00063     // child thread data
00064     HWND                m_frame;
00065     HWND                m_hwnd;
00066     LONG                m_wChar;
00067     LONG                m_hChar;
00068     bool                m_show;
00069 
00070     // messages
00071     size_t              m_maxLines;
00072     size_t              m_maxCharacters;
00073     size_t              m_numCharacters;
00074     MessageBuffer       m_buffer;
00075 };
00076 
00077 #endif

Generated on Fri Nov 6 00:21:13 2009 for synergy-plus by  doxygen 1.3.9.1