/*
|
/*
|
Copyright (C) Chris Johns (ccj@acm.org)
|
Copyright (C) Chris Johns (ccj@acm.org)
|
|
|
MicroWindows C++ Wrappers.
|
MicroWindows C++ Wrappers.
|
|
|
*/
|
*/
|
|
|
#if !defined (_MWOBJECTS_H_)
|
#if !defined (_MWOBJECTS_H_)
|
#define _MWOBJECTS_H_
|
#define _MWOBJECTS_H_
|
|
|
extern "C"
|
extern "C"
|
{
|
{
|
#include "windows.h"
|
#include "windows.h"
|
#include "wintern.h"
|
#include "wintern.h"
|
#include "graph3d.h"
|
#include "graph3d.h"
|
};
|
};
|
|
|
#include <set>
|
#include <set>
|
#include <iostream>
|
#include <iostream>
|
|
|
namespace MicroWindowsObjects
|
namespace MicroWindowsObjects
|
{
|
{
|
class FileDescriptor;
|
class FileDescriptor;
|
|
|
//
|
//
|
// Manage Window Classes. Notice you do not need to specify
|
// Manage Window Classes. Notice you do not need to specify
|
// a Window Procedure function pointer. This is handled for
|
// a Window Procedure function pointer. This is handled for
|
// you.
|
// you.
|
//
|
//
|
|
|
class WindowClass
|
class WindowClass
|
{
|
{
|
public:
|
public:
|
|
|
WindowClass ();
|
WindowClass ();
|
WindowClass (LPCSTR lpszClassName,
|
WindowClass (LPCSTR lpszClassName,
|
UINT style = CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW,
|
UINT style = CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW,
|
int cbClsExtra = 0,
|
int cbClsExtra = 0,
|
int cbWndExtra = 0,
|
int cbWndExtra = 0,
|
HINSTANCE hInstance = 0,
|
HINSTANCE hInstance = 0,
|
HICON hIcon = 0,
|
HICON hIcon = 0,
|
HCURSOR hCursor = 0,
|
HCURSOR hCursor = 0,
|
HBRUSH hbrBackground = 0,
|
HBRUSH hbrBackground = 0,
|
LPCSTR lpszMenuName = 0);
|
LPCSTR lpszMenuName = 0);
|
|
|
void set_style (UINT style)
|
void set_style (UINT style)
|
{ wclass.style = style; }
|
{ wclass.style = style; }
|
|
|
void set_class_extra (int cbClsExtra)
|
void set_class_extra (int cbClsExtra)
|
{ wclass.cbClsExtra = cbClsExtra; }
|
{ wclass.cbClsExtra = cbClsExtra; }
|
|
|
void set_window_extra (int cbWndExtra)
|
void set_window_extra (int cbWndExtra)
|
{ wclass.cbWndExtra = cbWndExtra; }
|
{ wclass.cbWndExtra = cbWndExtra; }
|
|
|
void set_instance (HINSTANCE hInstance)
|
void set_instance (HINSTANCE hInstance)
|
{ wclass.hInstance = hInstance; }
|
{ wclass.hInstance = hInstance; }
|
|
|
void set_icon (HICON hIcon)
|
void set_icon (HICON hIcon)
|
{ wclass.hIcon = hIcon; }
|
{ wclass.hIcon = hIcon; }
|
|
|
void set_cursor (HCURSOR hCursor)
|
void set_cursor (HCURSOR hCursor)
|
{ wclass.hCursor = hCursor; }
|
{ wclass.hCursor = hCursor; }
|
|
|
void set_background (HBRUSH hbrBackground)
|
void set_background (HBRUSH hbrBackground)
|
{ wclass.hbrBackground = hbrBackground; }
|
{ wclass.hbrBackground = hbrBackground; }
|
|
|
void set_menu_name (LPCSTR lpszMenuName)
|
void set_menu_name (LPCSTR lpszMenuName)
|
{ wclass.lpszMenuName = lpszMenuName; }
|
{ wclass.lpszMenuName = lpszMenuName; }
|
|
|
ATOM register_class ();
|
ATOM register_class ();
|
|
|
private:
|
private:
|
|
|
//
|
//
|
// This variable is a local copy which is
|
// This variable is a local copy which is
|
// registered. After that is class does little.
|
// registered. After that is class does little.
|
//
|
//
|
|
|
WNDCLASS wclass;
|
WNDCLASS wclass;
|
};
|
};
|
|
|
class Window
|
class Window
|
{
|
{
|
friend WindowClass;
|
friend WindowClass;
|
|
|
public:
|
public:
|
|
|
Window ();
|
Window ();
|
Window (DWORD dwExStyle,
|
Window (DWORD dwExStyle,
|
LPCSTR lpClassName,
|
LPCSTR lpClassName,
|
LPCSTR lpWindowName,
|
LPCSTR lpWindowName,
|
DWORD dwStyle,
|
DWORD dwStyle,
|
int x,
|
int x,
|
int y,
|
int y,
|
int nWidth,
|
int nWidth,
|
int nHeight,
|
int nHeight,
|
HWND hwndParent,
|
HWND hwndParent,
|
HMENU hMenu,
|
HMENU hMenu,
|
HINSTANCE hInstance,
|
HINSTANCE hInstance,
|
LPVOID lpParam);
|
LPVOID lpParam);
|
|
|
virtual ~Window ();
|
virtual ~Window ();
|
|
|
HWND create (DWORD dwExStyle,
|
HWND create (DWORD dwExStyle,
|
LPCSTR lpClassName,
|
LPCSTR lpClassName,
|
LPCSTR lpWindowName,
|
LPCSTR lpWindowName,
|
DWORD dwStyle,
|
DWORD dwStyle,
|
int x,
|
int x,
|
int y,
|
int y,
|
int nWidth,
|
int nWidth,
|
int nHeight,
|
int nHeight,
|
HWND hwndParent,
|
HWND hwndParent,
|
HMENU hMenu,
|
HMENU hMenu,
|
HINSTANCE hInstance,
|
HINSTANCE hInstance,
|
LPVOID lpParam);
|
LPVOID lpParam);
|
|
|
BOOL destory ();
|
BOOL destory ();
|
|
|
HWND get_handle () const
|
HWND get_handle () const
|
{ return hwnd; }
|
{ return hwnd; }
|
operator HWND () const
|
operator HWND () const
|
{ return get_handle (); }
|
{ return get_handle (); }
|
|
|
BOOL is_visible ()
|
BOOL is_visible ()
|
{ return IsWindowVisible (hwnd); }
|
{ return IsWindowVisible (hwnd); }
|
BOOL show (int nCmdShow)
|
BOOL show (int nCmdShow)
|
{ return ::ShowWindow (hwnd, nCmdShow); }
|
{ return ::ShowWindow (hwnd, nCmdShow); }
|
BOOL update ()
|
BOOL update ()
|
{ return ::UpdateWindow (hwnd); }
|
{ return ::UpdateWindow (hwnd); }
|
BOOL invalidate_rect (CONST RECT *lpRect, BOOL bErase)
|
BOOL invalidate_rect (CONST RECT *lpRect, BOOL bErase)
|
{ return ::InvalidateRect (hwnd, lpRect, bErase); }
|
{ return ::InvalidateRect (hwnd, lpRect, bErase); }
|
|
|
HWND get_focus ()
|
HWND get_focus ()
|
{ return ::GetFocus (); }
|
{ return ::GetFocus (); }
|
HWND set_focus ()
|
HWND set_focus ()
|
{ return ::SetFocus (hwnd); }
|
{ return ::SetFocus (hwnd); }
|
|
|
BOOL move (int x, int y, int nWidth, int nHeight, BOOL bRepaint)
|
BOOL move (int x, int y, int nWidth, int nHeight, BOOL bRepaint)
|
{ return MoveWindow (hwnd, x, y, nWidth, nHeight, bRepaint); }
|
{ return MoveWindow (hwnd, x, y, nWidth, nHeight, bRepaint); }
|
|
|
// FIXME: Should these be here ?
|
// FIXME: Should these be here ?
|
BOOL client_to_screen (LPPOINT lpPoint)
|
BOOL client_to_screen (LPPOINT lpPoint)
|
{ return ::ClientToScreen (hwnd, lpPoint); }
|
{ return ::ClientToScreen (hwnd, lpPoint); }
|
BOOL screen_to_client (LPPOINT lpPoint)
|
BOOL screen_to_client (LPPOINT lpPoint)
|
{ return ::ClientToScreen (hwnd, lpPoint); }
|
{ return ::ClientToScreen (hwnd, lpPoint); }
|
|
|
LONG get_long (int nIndex)
|
LONG get_long (int nIndex)
|
{ return ::GetWindowLong (hwnd, nIndex); }
|
{ return ::GetWindowLong (hwnd, nIndex); }
|
LONG set_long (int nIndex, LONG wNewLong)
|
LONG set_long (int nIndex, LONG wNewLong)
|
{ return ::SetWindowWord (hwnd, nIndex, wNewLong); }
|
{ return ::SetWindowWord (hwnd, nIndex, wNewLong); }
|
WORD get_word (int nIndex)
|
WORD get_word (int nIndex)
|
{ return ::GetWindowWord (hwnd, nIndex); }
|
{ return ::GetWindowWord (hwnd, nIndex); }
|
WORD set_word (int nIndex, WORD wNewWord)
|
WORD set_word (int nIndex, WORD wNewWord)
|
{ return ::SetWindowWord (hwnd, nIndex, wNewWord); }
|
{ return ::SetWindowWord (hwnd, nIndex, wNewWord); }
|
|
|
DWORD get_class_long (int nIndex)
|
DWORD get_class_long (int nIndex)
|
{ return ::GetClassLong (hwnd, nIndex); }
|
{ return ::GetClassLong (hwnd, nIndex); }
|
|
|
int get_text (LPSTR lpString, int nMaxCount)
|
int get_text (LPSTR lpString, int nMaxCount)
|
{ return GetWindowText (hwnd, lpString, nMaxCount); }
|
{ return GetWindowText (hwnd, lpString, nMaxCount); }
|
BOOL set_text (LPCSTR lpString)
|
BOOL set_text (LPCSTR lpString)
|
{ return SetWindowText (hwnd, lpString); }
|
{ return SetWindowText (hwnd, lpString); }
|
|
|
//
|
//
|
// File Descriptor handlers.
|
// File Descriptor handlers.
|
//
|
//
|
|
|
virtual bool attach (const int fd, FileDescriptor& file_descriptor);
|
virtual bool attach (const int fd, FileDescriptor& file_descriptor);
|
virtual bool detach (FileDescriptor& file_descriptor);
|
virtual bool detach (FileDescriptor& file_descriptor);
|
|
|
protected:
|
protected:
|
|
|
//
|
//
|
// The message handler. Insure you call this class's default
|
// The message handler. Insure you call this class's default
|
// handler for default message handling so any special
|
// handler for default message handling so any special
|
// filtering can occur.
|
// filtering can occur.
|
//
|
//
|
|
|
virtual LRESULT message_handler (UINT msg,
|
virtual LRESULT message_handler (UINT msg,
|
WPARAM wParam,
|
WPARAM wParam,
|
LPARAM lParam);
|
LPARAM lParam);
|
|
|
private:
|
private:
|
|
|
//
|
//
|
// We only need one WndProc.
|
// We only need one WndProc.
|
//
|
//
|
|
|
static LRESULT CALLBACK WndProc (HWND hwnd, UINT msg, WPARAM wp, LPARAM lp);
|
static LRESULT CALLBACK WndProc (HWND hwnd, UINT msg, WPARAM wp, LPARAM lp);
|
|
|
HWND hwnd;
|
HWND hwnd;
|
LPVOID lpCreateParams;
|
LPVOID lpCreateParams;
|
|
|
//
|
//
|
// Set of FileDescriptor objects
|
// Set of FileDescriptor objects
|
//
|
//
|
|
|
struct ltint
|
struct ltint
|
{
|
{
|
bool operator() (const FileDescriptor* f1, const FileDescriptor* f2) const;
|
bool operator() (const FileDescriptor* f1, const FileDescriptor* f2) const;
|
};
|
};
|
|
|
set<FileDescriptor*, ltint> file_descriptors;
|
set<FileDescriptor*, ltint> file_descriptors;
|
|
|
};
|
};
|
|
|
class Rect
|
class Rect
|
{
|
{
|
public:
|
public:
|
|
|
Rect ()
|
Rect ()
|
{ empty (); }
|
{ empty (); }
|
Rect (int xLeft, int yTop, int xRight, int yBottom)
|
Rect (int xLeft, int yTop, int xRight, int yBottom)
|
{ set (xLeft, yTop, xRight, yBottom); }
|
{ set (xLeft, yTop, xRight, yBottom); }
|
Rect (HWND hwnd)
|
Rect (HWND hwnd)
|
{ get_window (hwnd); }
|
{ get_window (hwnd); }
|
|
|
BOOL get_window (HWND hwnd)
|
BOOL get_window (HWND hwnd)
|
{ return GetWindowRect (hwnd, &rect); }
|
{ return GetWindowRect (hwnd, &rect); }
|
BOOL get_client (HWND hwnd)
|
BOOL get_client (HWND hwnd)
|
{ return GetClientRect (hwnd, &rect); }
|
{ return GetClientRect (hwnd, &rect); }
|
|
|
BOOL set (int xLeft, int yTop, int xRight, int yBottom)
|
BOOL set (int xLeft, int yTop, int xRight, int yBottom)
|
{ return ::SetRect (&rect, xLeft, yTop, xRight, yBottom); }
|
{ return ::SetRect (&rect, xLeft, yTop, xRight, yBottom); }
|
|
|
BOOL empty ()
|
BOOL empty ()
|
{ return ::SetRectEmpty (&rect); }
|
{ return ::SetRectEmpty (&rect); }
|
|
|
Rect& operator= (const Rect& other)
|
Rect& operator= (const Rect& other)
|
{ CopyRect (&rect, &other.rect); return *this; }
|
{ CopyRect (&rect, &other.rect); return *this; }
|
|
|
operator bool () const
|
operator bool () const
|
{ return ::IsRectEmpty (&rect); }
|
{ return ::IsRectEmpty (&rect); }
|
|
|
operator RECT* ()
|
operator RECT* ()
|
{ return ▭ }
|
{ return ▭ }
|
|
|
BOOL copy (LPRECT lpRectDst)
|
BOOL copy (LPRECT lpRectDst)
|
{ return ::CopyRect (lpRectDst, &rect); }
|
{ return ::CopyRect (lpRectDst, &rect); }
|
|
|
BOOL inflate (int dx, int dy)
|
BOOL inflate (int dx, int dy)
|
{ return ::InflateRect (&rect, dx, dy); }
|
{ return ::InflateRect (&rect, dx, dy); }
|
|
|
BOOL offset (int dx, int dy)
|
BOOL offset (int dx, int dy)
|
{ return ::OffsetRect (&rect, dx, dy); }
|
{ return ::OffsetRect (&rect, dx, dy); }
|
|
|
BOOL point_inside (POINT Point)
|
BOOL point_inside (POINT Point)
|
{ return PtInRect (&rect, Point); }
|
{ return PtInRect (&rect, Point); }
|
|
|
MWCOORD left () const
|
MWCOORD left () const
|
{ return rect.left; }
|
{ return rect.left; }
|
MWCOORD top () const
|
MWCOORD top () const
|
{ return rect.top; }
|
{ return rect.top; }
|
MWCOORD right () const
|
MWCOORD right () const
|
{ return rect.right; }
|
{ return rect.right; }
|
MWCOORD bottom () const
|
MWCOORD bottom () const
|
{ return rect.bottom; }
|
{ return rect.bottom; }
|
|
|
private:
|
private:
|
|
|
RECT rect;
|
RECT rect;
|
};
|
};
|
|
|
inline ostream& operator<< (ostream& s, const Rect& r) {
|
inline ostream& operator<< (ostream& s, const Rect& r) {
|
s << "rect"
|
s << "rect"
|
<< "(l=" << r.left () << ",t=" << r.top ()
|
<< "(l=" << r.left () << ",t=" << r.top ()
|
<< ",r=" << r.right () << ",b=" << r.bottom ()
|
<< ",r=" << r.right () << ",b=" << r.bottom ()
|
<< ")";
|
<< ")";
|
return s;
|
return s;
|
}
|
}
|
|
|
//
|
//
|
// Generic Paint class. Try to help the paint message.
|
// Generic Paint class. Try to help the paint message.
|
//
|
//
|
|
|
class Paint
|
class Paint
|
{
|
{
|
public:
|
public:
|
|
|
enum { TEXT_BUF_SIZE = 512 };
|
enum { TEXT_BUF_SIZE = 512 };
|
|
|
Paint (HWND hwnd);
|
Paint (HWND hwnd);
|
Paint (HWND hwnd, LPARAM lpParam);
|
Paint (HWND hwnd, LPARAM lpParam);
|
virtual ~Paint ();
|
virtual ~Paint ();
|
|
|
//
|
//
|
// These begin and end a paint session.
|
// These begin and end a paint session.
|
//
|
//
|
|
|
void begin (bool init_3d = false, bool draw_3d_in_memory = false);
|
void begin (bool init_3d = false, bool draw_3d_in_memory = false);
|
void end ();
|
void end ();
|
|
|
//
|
//
|
// Aspects of the client paint area under our control.
|
// Aspects of the client paint area under our control.
|
//
|
//
|
|
|
operator HWND ()
|
operator HWND ()
|
{ return hwnd; }
|
{ return hwnd; }
|
operator RECT* ()
|
operator RECT* ()
|
{ return r; }
|
{ return r; }
|
operator HDC ()
|
operator HDC ()
|
{ return hdc; }
|
{ return hdc; }
|
operator PAINTSTRUCT* ()
|
operator PAINTSTRUCT* ()
|
{ return &ps; }
|
{ return &ps; }
|
operator POINT* ()
|
operator POINT* ()
|
{ return &pt; }
|
{ return &pt; }
|
|
|
GDICOORD get_point_x () const
|
GDICOORD get_point_x () const
|
{ return pt.x; }
|
{ return pt.x; }
|
GDICOORD get_point_y () const
|
GDICOORD get_point_y () const
|
{ return pt.y; }
|
{ return pt.y; }
|
|
|
MWCOORD left () const
|
MWCOORD left () const
|
{ return r.left (); }
|
{ return r.left (); }
|
MWCOORD top () const
|
MWCOORD top () const
|
{ return r.top (); }
|
{ return r.top (); }
|
MWCOORD right () const
|
MWCOORD right () const
|
{ return r.right (); }
|
{ return r.right (); }
|
MWCOORD bottom () const
|
MWCOORD bottom () const
|
{ return r.bottom (); }
|
{ return r.bottom (); }
|
|
|
//
|
//
|
// Colour Control.
|
// Colour Control.
|
//
|
//
|
|
|
DWORD get_system_colour (int nIndex)
|
DWORD get_system_colour (int nIndex)
|
{ return ::GetSysColor (nIndex); }
|
{ return ::GetSysColor (nIndex); }
|
|
|
//
|
//
|
// Pixel, line and rectange draw support.
|
// Pixel, line and rectange draw support.
|
//
|
//
|
|
|
COLORREF set_pixel (int x, int y, COLORREF crColour)
|
COLORREF set_pixel (int x, int y, COLORREF crColour)
|
{ return ::SetPixel (hdc, x, y, crColour); }
|
{ return ::SetPixel (hdc, x, y, crColour); }
|
|
|
BOOL move_to (int x, int y)
|
BOOL move_to (int x, int y)
|
{ return ::MoveToEx (hdc, x, y, 0); }
|
{ return ::MoveToEx (hdc, x, y, 0); }
|
|
|
BOOL line_to (int x, int y)
|
BOOL line_to (int x, int y)
|
{ return ::LineTo (hdc, x, y); }
|
{ return ::LineTo (hdc, x, y); }
|
|
|
BOOL line_to (int x1, int y1, int x2, int y2)
|
BOOL line_to (int x1, int y1, int x2, int y2)
|
{ if (!move_to (x1, y1)) return FALSE;
|
{ if (!move_to (x1, y1)) return FALSE;
|
return line_to (x2, y2); }
|
return line_to (x2, y2); }
|
|
|
BOOL rectangle (int x1, int y1, int x2, int y2)
|
BOOL rectangle (int x1, int y1, int x2, int y2)
|
{ return ::Rectangle (hdc, x1, y1, x2, y2); }
|
{ return ::Rectangle (hdc, x1, y1, x2, y2); }
|
|
|
BOOL fill_rectangle (int x1, int y1, int x2, int y2, HBRUSH hbr)
|
BOOL fill_rectangle (int x1, int y1, int x2, int y2, HBRUSH hbr)
|
{ Rect r (x1, y1, x2, y2);
|
{ Rect r (x1, y1, x2, y2);
|
return ::FillRect (hdc, r, hbr); }
|
return ::FillRect (hdc, r, hbr); }
|
|
|
//
|
//
|
// Paint any 3d objects.
|
// Paint any 3d objects.
|
//
|
//
|
|
|
void initialise_3d (bool draw_3d_in_mem)
|
void initialise_3d (bool draw_3d_in_mem)
|
{ if (!draw_3d) {
|
{ if (!draw_3d) {
|
draw_3d = true; ::init3 (hdc, draw_3d_in_mem ? hwnd : 0); } }
|
draw_3d = true; ::init3 (hdc, draw_3d_in_mem ? hwnd : 0); } }
|
void paint_3d ()
|
void paint_3d ()
|
{ if (draw_3d) { ::paint3 (hdc); draw_3d = false; } }
|
{ if (draw_3d) { ::paint3 (hdc); draw_3d = false; } }
|
|
|
//
|
//
|
// Text Output.
|
// Text Output.
|
//
|
//
|
|
|
void set_text_fromat (UINT uFormat)
|
void set_text_fromat (UINT uFormat)
|
{ text_format = uFormat; }
|
{ text_format = uFormat; }
|
|
|
int text_out (int x, int y, const char *format, ...);
|
int text_out (int x, int y, const char *format, ...);
|
|
|
private:
|
private:
|
|
|
HWND hwnd;
|
HWND hwnd;
|
bool draw_3d;
|
bool draw_3d;
|
bool drawing;
|
bool drawing;
|
Rect r;
|
Rect r;
|
HDC hdc;
|
HDC hdc;
|
PAINTSTRUCT ps;
|
PAINTSTRUCT ps;
|
POINT pt;
|
POINT pt;
|
UINT text_format;
|
UINT text_format;
|
|
|
char format_buf[TEXT_BUF_SIZE];
|
char format_buf[TEXT_BUF_SIZE];
|
|
|
};
|
};
|
|
|
//
|
//
|
// FileDescriptor handles fd event from the User Registered File
|
// FileDescriptor handles fd event from the User Registered File
|
// Descriptor support.
|
// Descriptor support.
|
//
|
//
|
|
|
class FileDescriptor
|
class FileDescriptor
|
{
|
{
|
friend class Window;
|
friend class Window;
|
|
|
public:
|
public:
|
|
|
FileDescriptor ();
|
FileDescriptor ();
|
virtual ~FileDescriptor ();
|
virtual ~FileDescriptor ();
|
|
|
//
|
//
|
// Enable/disable controls.
|
// Enable/disable controls.
|
//
|
//
|
|
|
bool enable_read ();
|
bool enable_read ();
|
bool disable_read ();
|
bool disable_read ();
|
bool read_enabled () const
|
bool read_enabled () const
|
{ return read_is_enabled; }
|
{ return read_is_enabled; }
|
|
|
bool enable_write ();
|
bool enable_write ();
|
bool disable_write ();
|
bool disable_write ();
|
bool write_enabled () const
|
bool write_enabled () const
|
{ return write_is_enabled; }
|
{ return write_is_enabled; }
|
|
|
bool enable_except ();
|
bool enable_except ();
|
bool disable_except ();
|
bool disable_except ();
|
bool except_enabled () const
|
bool except_enabled () const
|
{ return except_is_enabled; }
|
{ return except_is_enabled; }
|
|
|
int fd () const
|
int fd () const
|
{ return file_desc; }
|
{ return file_desc; }
|
|
|
operator int () const
|
operator int () const
|
{ return fd (); }
|
{ return fd (); }
|
|
|
const Window *get_window () const
|
const Window *get_window () const
|
{ return window; }
|
{ return window; }
|
|
|
protected:
|
protected:
|
|
|
//
|
//
|
// These are called in responce to user fd messages to the window.
|
// These are called in responce to user fd messages to the window.
|
//
|
//
|
|
|
virtual LRESULT read ();
|
virtual LRESULT read ();
|
virtual LRESULT write ();
|
virtual LRESULT write ();
|
virtual LRESULT except ();
|
virtual LRESULT except ();
|
|
|
private:
|
private:
|
|
|
int file_desc;
|
int file_desc;
|
bool read_is_enabled;
|
bool read_is_enabled;
|
bool write_is_enabled;
|
bool write_is_enabled;
|
bool except_is_enabled;
|
bool except_is_enabled;
|
Window *window;
|
Window *window;
|
|
|
};
|
};
|
|
|
class Application
|
class Application
|
{
|
{
|
public:
|
public:
|
|
|
Application ();
|
Application ();
|
Application (MWIMAGEHDR& background);
|
Application (MWIMAGEHDR& background);
|
virtual ~Application ();
|
virtual ~Application ();
|
|
|
HINSTANCE instance () const
|
HINSTANCE instance () const
|
{ return app_instance; }
|
{ return app_instance; }
|
|
|
HINSTANCE prev_instance () const
|
HINSTANCE prev_instance () const
|
{ return app_prev_instance; }
|
{ return app_prev_instance; }
|
|
|
LPSTR cmd_line () const
|
LPSTR cmd_line () const
|
{ return app_cmd_line; }
|
{ return app_cmd_line; }
|
|
|
int show_cmd ()
|
int show_cmd ()
|
{ return app_show_cmd; }
|
{ return app_show_cmd; }
|
|
|
//
|
//
|
// This is called the public C linkage WinMain. Do not call.
|
// This is called the public C linkage WinMain. Do not call.
|
//
|
//
|
|
|
static int WINAPI WinMain (HINSTANCE hInstance,
|
static int WINAPI WinMain (HINSTANCE hInstance,
|
HINSTANCE hPrevInstance,
|
HINSTANCE hPrevInstance,
|
LPSTR lpCmdLine,
|
LPSTR lpCmdLine,
|
int nShowCmd);
|
int nShowCmd);
|
protected:
|
protected:
|
|
|
virtual int initialise ();
|
virtual int initialise ();
|
virtual int shutdown ();
|
virtual int shutdown ();
|
|
|
private:
|
private:
|
|
|
MWIMAGEHDR *background;
|
MWIMAGEHDR *background;
|
HINSTANCE app_instance;
|
HINSTANCE app_instance;
|
HINSTANCE app_prev_instance;
|
HINSTANCE app_prev_instance;
|
LPSTR app_cmd_line;
|
LPSTR app_cmd_line;
|
int app_show_cmd;
|
int app_show_cmd;
|
|
|
};
|
};
|
}
|
}
|
|
|
#endif
|
#endif
|
|
|
|
|