From 04ef50df3a0fa3c343800c554e609f98fc7575cc Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Fri, 29 Jun 2001 10:58:59 +0000 Subject: [PATCH] First pass at adding MicroWindows support git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10717 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/app.h | 2 +- include/wx/defs.h | 4 +- include/wx/msw/font.h | 6 +- include/wx/msw/microwin.h | 235 ++++++++++++++++++++++++ include/wx/msw/private.h | 7 +- samples/minimal/makefile.mic | 88 +++++++++ src/common/filefn.cpp | 6 +- src/common/intl.cpp | 2 +- src/common/strconv.cpp | 6 +- src/common/utilscmn.cpp | 2 +- src/generic/tipwin.cpp | 16 +- src/msw/app.cpp | 22 ++- src/msw/bitmap.cpp | 36 +++- src/msw/brush.cpp | 2 + src/msw/cursor.cpp | 15 ++ src/msw/dc.cpp | 9 +- src/msw/dialog.cpp | 2 + src/msw/font.cpp | 18 +- src/msw/fontenum.cpp | 6 + src/msw/fontutil.cpp | 4 +- src/msw/frame.cpp | 28 ++- src/msw/gdiimage.cpp | 13 ++ src/msw/icon.cpp | 4 + src/msw/main.cpp | 2 +- src/msw/makefile.mic | 337 +++++++++++++++++++++++++++++++++++ src/msw/palette.cpp | 10 +- src/msw/pen.cpp | 6 +- src/msw/region.cpp | 2 +- src/msw/settings.cpp | 42 +++-- src/msw/timer.cpp | 7 + src/msw/utils.cpp | 62 +++++-- src/msw/utilsexc.cpp | 4 +- src/msw/window.cpp | 45 ++++- 33 files changed, 985 insertions(+), 65 deletions(-) create mode 100644 include/wx/msw/microwin.h create mode 100644 samples/minimal/makefile.mic create mode 100644 src/msw/makefile.mic diff --git a/include/wx/app.h b/include/wx/app.h index 4478b6d7eb..8f0b44bbed 100644 --- a/include/wx/app.h +++ b/include/wx/app.h @@ -21,7 +21,7 @@ // typedefs // ---------------------------------------------------------------------------- -#if defined(__WXMSW__) || defined (__WXPM__) +#if (defined(__WXMSW__) && !defined(__WXMICROWIN__)) || defined (__WXPM__) class WXDLLEXPORT wxApp; typedef wxApp* (*wxAppInitializerFunction)(); #else diff --git a/include/wx/defs.h b/include/wx/defs.h index d814dfcd49..0304b78660 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -409,7 +409,7 @@ typedef int wxWindowID; // wxCALLBACK should be used for the functions which are called back by // Windows (such as compare function for wxListCtrl) -#if defined(__WIN32__) +#if defined(__WIN32__) && !defined(__WXMICROWIN__) #define wxCALLBACK wxSTDCALL #else // no stdcall under Unix nor Win16 @@ -2010,7 +2010,7 @@ typedef struct tagLOGPALETTE } LOGPALETTE; #endif //__WXPM__ -#if defined(__GNUWIN32__) || defined(__WXWINE__) +#if defined(__GNUWIN32__) || defined(__WXWINE__) || defined(__WXMICROWIN__) typedef int (*WXFARPROC)(); #elif defined(__WIN32__) typedef int (__stdcall *WXFARPROC)(); diff --git a/include/wx/msw/font.h b/include/wx/msw/font.h index 90073aa564..8149aaa6af 100644 --- a/include/wx/msw/font.h +++ b/include/wx/msw/font.h @@ -40,11 +40,11 @@ public: (void)Create(size, family, style, weight, underlined, face, encoding); } - wxFont(const wxNativeFontInfo& info) + wxFont(const wxNativeFontInfo& info, WXHFONT hFont = 0) { Init(); - Create(info); + Create(info, hFont); } wxFont(const wxString& fontDesc); @@ -57,7 +57,7 @@ public: const wxString& face = wxEmptyString, wxFontEncoding encoding = wxFONTENCODING_DEFAULT); - bool Create(const wxNativeFontInfo& info); + bool Create(const wxNativeFontInfo& info, WXHFONT hFont = 0); virtual ~wxFont(); diff --git a/include/wx/msw/microwin.h b/include/wx/msw/microwin.h new file mode 100644 index 0000000000..4bba1f0efe --- /dev/null +++ b/include/wx/msw/microwin.h @@ -0,0 +1,235 @@ +/* +///////////////////////////////////////////////////////////////////////////// +// Name: microwin.h +// Purpose: Extra implementation for MicroWindows +// Author: Julian Smart +// Created: 2001-05-31 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// +*/ + +#ifndef _WX_MICROWIN_H_ +#define _WX_MICROWIN_H_ + +#ifdef __GNUG__ +#pragma interface "microwin.h" +#endif + + +/* Implemented by microwin.cpp */ + +#ifdef __cplusplus +extern "C" { +#endif + +BOOL SetCursorPos(int x, int y); + +HCURSOR SetCursor(HCURSOR hCursor); + +/* Implemented with wrong number of args by MicroWindows */ +/* so we need to use a different name */ +int GetScrollPosWX (HWND hWnd, int iSBar); + +BOOL ScrollWindow(HWND, int xAmount, int yAmount, + CONST RECT* lpRect, CONST RECT* lpClipRect); + +HWND WindowFromPoint(POINT pt); +SHORT GetKeyState(int nVirtKey); +HWND SetParent(HWND hWndChild, HWND hWndNewParent); +VOID DragAcceptFiles(HWND, BOOL); +BOOL IsDialogMessage(HWND hWnd, MSG* msg); +DWORD GetMessagePos(VOID); +BOOL IsIconic(HWND hWnd); +int SetMapMode(HDC hDC, int mode); +int GetMapMode(HDC hDC); +HCURSOR LoadCursor(HINSTANCE hInst, int cursor); +DWORD GetModuleFileName(HINSTANCE hInst, LPSTR name, DWORD sz); +VOID DestroyIcon(HICON hIcon); +COLORREF GetTextColor(HDC hdc); +COLORREF GetBkColor(HDC hdc); +HPALETTE SelectPalette(HDC hdc, HPALETTE hPalette, BOOL b); +BOOL IntersectClipRect(HDC hdc, int x, int y, + int w, int h); +BOOL GetClipBox(HDC hdc, RECT* rect); +BOOL DrawIconEx(HDC hdc, int x, int y, HICON hIcon, int w, int h, UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags); +BOOL SetViewportExtEx(HDC hdc, int x, int y, LPSIZE lpSize); +BOOL SetViewportOrgEx(HDC hdc, int x, int y, LPPOINT lpPoint); +BOOL SetWindowExtEx(HDC hdc, int x, int y, LPSIZE lpSize); +BOOL SetWindowOrgEx(HDC hdc, int x, int y, LPPOINT lpSize); +BOOL ExtFloodFill(HDC hdc, int x, int y, COLORREF col, UINT flags); +int SetPolyFillMode(HDC hdc, int mode); +BOOL RoundRect(HDC hdc, int left, int top, int right, int bottom, int r1, int r2); +BOOL MaskBlt(HDC hdc, int x, int y, int w, int h, + HDC hDCSource, int xSrc, int ySrc, HBITMAP hBitmapMask, int xMask, int yMask, DWORD rop); +UINT RealizePalette(HDC hDC); +BOOL SetBrushOrgEx(HDC hdc, int xOrigin, int yOrigin, LPPOINT lpPoint); +int GetObject(HGDIOBJ hObj, int sz, LPVOID logObj); + +/* For some reason these aren't defined in the headers */ +BOOL EnableScrollBar (HWND hWnd, int iSBar, BOOL bEnable) ; +BOOL GetScrollPos (HWND hWnd, int iSBar, int* pPos); +BOOL GetScrollRange (HWND hWnd, int iSBar, int* pMinPos, int* pMaxPos); +BOOL SetScrollPos (HWND hWnd, int iSBar, int iNewPos); +BOOL SetScrollRange (HWND hWnd, int iSBar, int iMinPos, int iMaxPos); +BOOL SetScrollInfo (HWND hWnd, int iSBar, + LPCSCROLLINFO lpsi, BOOL fRedraw); +BOOL GetScrollInfo(HWND hWnd, int iSBar, LPSCROLLINFO lpsi); +BOOL ShowScrollBar (HWND hWnd, int iSBar, BOOL bShow); + +#ifdef __cplusplus +} +#endif + +/* + * Key State Masks for Mouse Messages + */ +#ifndef MK_LBUTTON +#define MK_LBUTTON 0x0001 +#define MK_RBUTTON 0x0002 +#define MK_SHIFT 0x0004 +#define MK_CONTROL 0x0008 +#define MK_MBUTTON 0x0010 +#endif + +/* + * DrawIcon flags + */ + +#ifndef DI_MASK +#define DI_MASK 0x0001 +#define DI_IMAGE 0x0002 +#define DI_NORMAL 0x0003 +#define DI_COMPAT 0x0004 +#define DI_DEFAULTSIZE 0x0008 +#endif + +/* TODO: May have to fake these message */ +#ifndef WM_INITDIALOG +#define WM_INITDIALOG 0x0110 +#endif +#ifndef WM_QUERYENDSESSION +#define WM_QUERYENDSESSION 0x0011 +#endif +#ifndef WM_ENDSESSION +#define WM_ENDSESSION 0x0016 +#endif +#ifndef WM_SETCURSOR +#define WM_SETCURSOR 0x0020 +#endif +#ifndef WM_GETMINMAXINFO +#define WM_GETMINMAXINFO 0x0024 +typedef struct tagMINMAXINFO { + POINT ptReserved; + POINT ptMaxSize; + POINT ptMaxPosition; + POINT ptMinTrackSize; + POINT ptMaxTrackSize; +} MINMAXINFO, *PMINMAXINFO, *LPMINMAXINFO; + +#endif +#ifndef WM_SYSCOMMAND +#define WM_SYSCOMMAND 0x0112 +#endif +#ifndef WM_SYSCOLORCHANGE +#define WM_SYSCOLORCHANGE 0x0015 +#endif +#ifndef WM_QUERYNEWPALETTE +#define WM_QUERYNEWPALETTE 0x030F +#endif +#ifndef WM_PALETTEISCHANGING +#define WM_PALETTEISCHANGING 0x0310 +#endif +#ifndef WM_PALETTECHANGED +#define WM_PALETTECHANGED 0x0311 +#endif +#ifndef WM_NOTIFY +#define WM_NOTIFY 0x004E +#endif +#ifndef WM_DROPFILES +#define WM_DROPFILES 0x0233 +#endif + +#ifndef PALETTERGB +#define PALETTERGB RGB +#endif + +#ifndef MM_TEXT +#define MM_TEXT 1 +#define MM_LOMETRIC 2 +#define MM_HIMETRIC 3 +#define MM_LOENGLISH 4 +#define MM_HIENGLISH 5 +#define MM_TWIPS 6 +#define MM_ISOTROPIC 7 +#define MM_ANISOTROPIC 8 +#endif + +#ifndef SC_MAXIMIZE +#define SC_MINIMIZE 0xF020 +#define SC_MAXIMIZE 0xF030 +#endif + +// TODO: all of them +#ifndef IDC_ARROW +#define IDC_ARROW 1 +#endif + +/* + * Standard Cursor IDs + */ +#ifndef MAKEINTRESOURCE +#define MAKEINTRESOURCE(r) r +#endif + +#ifndef IDC_ARROW +#define IDC_ARROW MAKEINTRESOURCE(32512) +#define IDC_IBEAM MAKEINTRESOURCE(32513) +#define IDC_WAIT MAKEINTRESOURCE(32514) +#define IDC_CROSS MAKEINTRESOURCE(32515) +#define IDC_UPARROW MAKEINTRESOURCE(32516) +#define IDC_SIZE MAKEINTRESOURCE(32640) /* OBSOLETE: use IDC_SIZEALL */ +#define IDC_ICON MAKEINTRESOURCE(32641) /* OBSOLETE: use IDC_ARROW */ +#define IDC_SIZENWSE MAKEINTRESOURCE(32642) +#define IDC_SIZENESW MAKEINTRESOURCE(32643) +#define IDC_SIZEWE MAKEINTRESOURCE(32644) +#define IDC_SIZENS MAKEINTRESOURCE(32645) +#define IDC_SIZEALL MAKEINTRESOURCE(32646) +#define IDC_NO MAKEINTRESOURCE(32648) /* not in win3.1 */ +#if(WINVER >= 0x0500) +#define IDC_HAND MAKEINTRESOURCE(32649) +#endif /* WINVER >= 0x0500 */ +#define IDC_APPSTARTING MAKEINTRESOURCE(32650) /* not in win3.1 */ +#if(WINVER >= 0x0400) +#define IDC_HELP MAKEINTRESOURCE(32651) +#endif /* WINVER >= 0x0400 */ +#endif + +/* ExtFloodFill style flags */ +#define FLOODFILLBORDER 0 +#define FLOODFILLSURFACE 1 + +/* PolyFill() Modes */ +#define ALTERNATE 1 +#define WINDING 2 +#define POLYFILL_LAST 2 + +/* Quaternary raster codes */ +#define MAKEROP4(fore,back) (DWORD)((((back) << 8) & 0xFF000000) | (fore)) + +/* Device Parameters for GetDeviceCaps() */ +#define DRIVERVERSION 0 /* Device driver version */ +#define TECHNOLOGY 2 /* Device classification */ +#define HORZSIZE 4 /* Horizontal size in millimeters */ +#define VERTSIZE 6 /* Vertical size in millimeters */ + +/* Ternary raster operations */ +#define DSTINVERT (DWORD)0x00550009 /* dest = (NOT dest) */ +#define WHITENESS (DWORD)0x00FF0062 /* dest = WHITE */ +#define SRCERASE (DWORD)0x00440328 /* dest = source AND (NOT dest ) */ +#define MERGEPAINT (DWORD)0x00BB0226 /* dest = (NOT source) OR dest */ +#define SRCPAINT (DWORD)0x00EE0086 /* dest = source OR dest */ +#define NOTSRCCOPY (DWORD)0x00330008 /* dest = (NOT source) */ + +#endif /* _WX_MICROWIN_H_ */ diff --git a/include/wx/msw/private.h b/include/wx/msw/private.h index 334db2efe7..20b4d94676 100644 --- a/include/wx/msw/private.h +++ b/include/wx/msw/private.h @@ -16,6 +16,11 @@ #include +#ifdef __WXMICROWIN__ +/* Extra prototypes and symbols not defined by MicroWindows */ +#include "wx/msw/microwin.h" +#endif + // undefine conflicting symbols which were defined in windows.h #include "wx/msw/winundef.h" @@ -184,7 +189,7 @@ extern LONG APIENTRY _EXPORT // --------------------------------------------------------------------------- // a wrapper macro for ZeroMemory() -#ifdef __WIN32__ +#if defined(__WIN32__) && !defined(__WXMICROWIN__) #define wxZeroMemory(obj) ::ZeroMemory(&obj, sizeof(obj)) #else #define wxZeroMemory(obj) memset((void*) & obj, 0, sizeof(obj)) diff --git a/samples/minimal/makefile.mic b/samples/minimal/makefile.mic new file mode 100644 index 0000000000..c73f434bcd --- /dev/null +++ b/samples/minimal/makefile.mic @@ -0,0 +1,88 @@ +############################################################################## +# Microwindows template Makefile +# Copyright (c) 2000 Martin Jolicoeur, Greg Haerr +############################################################################## + +TOP=/home/julians/microwindows/microwin/src +CONFIG = $(TOP)/config +WXDIR = ../.. +OBJSUFF = o +SRCSUFF = cpp +WXLIB=$(WXDIR)/lib/libwx.a +AROPTIONS = ruv +RANLIB = ranlib +RM = rm -f + +ZLIBLIB = $(WXDIR)/lib/libzlib.a +PNGLIB = $(WXDIR)/lib/libpng.a +JPEGLIB = $(WXDIR)/lib/libjpeg.a +TIFFLIB = $(WXDIR)/lib/libtiff.a + +include $(CONFIG) + +######################## Additional Flags section ############################ + +# Directories list for header files +INCLUDEDIRS += -I$(WXDIR)/include +# Defines for preprocessor +DEFINES += -DMWIN -D__WXMICROWIN__ -D__WIN32__ -D__WIN95__ -DHAVE_BOOL -DMICROWIN_TODO=1 -D__UNIX__ -DHAVE_NANOSLEEP -DMICROWIN_NOCONTROLS -D__WXDEBUG__ + +# Compilation flags for C files OTHER than include directories +CFLAGS += +# Preprocessor flags OTHER than defines +CPPFLAGS += +# Linking flags +#LDFLAGS += -lwx -L$(WXDIR)/lib +LDFLAGS += $(WXLIB) + +############################# targets section ################################ + +# If you want to create a library with the objects files, define the name here +LIBNAME = + +# If we put it below OBJS=, Makefile.rules includes .depend +# and it continually looks for .c files to satisfy .o.cpp +# dependency. What's going on there? +include $(TOP)/Makefile.rules + +# List of objects to compile +OBJS = minimal.o +MTESTOBJS = mtest.o + +all: minimal + +######################### Makefile.rules section ############################# + + + +######################## Tools targets section ############################### + +minimal: $(OBJS) $(MWINLIBS) $(WXLIB) $(TOP)/config + $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@ $(WXLIB) $(MWINLIBS) -lm + +mtest: $(MTESTOBJS) $(MWINLIBS) $(TOP)/config + $(CC) $(CFLAGS) $(LDFLAGS) $(MTESTOBJS) -o $@ $(MWINLIBS) + +#.SUFFIXES: .cpp .cxx .c + +#.c.o: +# $(CC) -c $(CFLAGS) $(CFLAGS) -o $@ $*.c + +.cxx.o: + $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $*.cxx + +.cpp.o: + $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $*.cpp + +#$(COMMDIR)/appcmn.o: $(COMMDIR)/appcmn.cpp +# $(CC) -c $(CPPFLAGS) -o $@ $*.cpp + +#appcmn.o: $(COMMDIR)/appcmn.cpp +# $(CC) $(CPPFLAGS) -c -o $@ $< + +cleanwx: + -$(RM) *.o + -$(RM) minimal + +wx: + @pushd $(WXDIR)/src/microwin; make all; popd diff --git a/src/common/filefn.cpp b/src/common/filefn.cpp index 109cb88311..781e18dc95 100644 --- a/src/common/filefn.cpp +++ b/src/common/filefn.cpp @@ -1002,7 +1002,7 @@ wxConcatFiles (const wxString& file1, const wxString& file2, const wxString& fil bool wxCopyFile (const wxString& file1, const wxString& file2, bool overwrite) { -#if defined(__WIN32__) +#if defined(__WIN32__) && !defined(__WXMICROWIN__) // CopyFile() copies file attributes and modification time too, so use it // instead of our code if available // @@ -1197,7 +1197,7 @@ bool wxPathExists(const wxChar *pszPathName) // Get a temporary filename, opening and closing the file. wxChar *wxGetTempFileName(const wxString& prefix, wxChar *buf) { -#ifdef __WINDOWS__ +#if defined(__WINDOWS__) && !defined(__WXMICROWIN__) #ifndef __WIN32__ wxChar tmp[144]; @@ -1816,7 +1816,7 @@ bool wxSetWorkingDirectory(const wxString& d) // On non-Windows platform, probably just return the empty string. wxString wxGetOSDirectory() { -#ifdef __WINDOWS__ +#if defined(__WINDOWS__) && !defined(__WXMICROWIN__) wxChar buf[256]; GetWindowsDirectory(buf, 256); return wxString(buf); diff --git a/src/common/intl.cpp b/src/common/intl.cpp index 9d86e167ab..66a219459b 100644 --- a/src/common/intl.cpp +++ b/src/common/intl.cpp @@ -1180,7 +1180,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxLocaleModule, wxModule) // This table is generated by misc/languages/genlang.py // When making changes, please put them into misc/languages/langtabl.txt -#ifndef __WIN32__ +#if !defined(__WIN32__) || defined(__WXMICROWIN__) #define SETWINLANG(info,lang,sublang) diff --git a/src/common/strconv.cpp b/src/common/strconv.cpp index 40c4ae3c50..45d3599040 100644 --- a/src/common/strconv.cpp +++ b/src/common/strconv.cpp @@ -402,7 +402,7 @@ WXDLLEXPORT_DATA(wxCSConv) wxConvLocal((const wxChar *)NULL); // - perhaps common encodings to objects ("UTF8" -> wxConvUTF8) // - move wxEncodingConverter meat in here -#ifdef __WIN32__ +#if defined(__WIN32__) && !defined(__WXMICROWIN__) #include "wx/msw/registry.h" // this should work if M$ Internet Exploiter is installed static long CharsetToCodepage(const wxChar *name) @@ -616,7 +616,7 @@ public: }; #endif -#ifdef __WIN32__ +#if defined(__WIN32__) && !defined(__WXMICROWIN__) class CP_CharSet : public wxCharacterSet { public: @@ -722,7 +722,7 @@ static wxCharacterSet *wxGetCharacterSet(const wxChar *name) cset = NULL; } -#ifdef __WIN32__ +#if defined(__WIN32__) && !defined(__WXMICROWIN__) cset = new CP_CharSet(name); // may take NULL if (cset->usable()) return cset; diff --git a/src/common/utilscmn.cpp b/src/common/utilscmn.cpp index 6c1682a5d9..1e70d44ab9 100644 --- a/src/common/utilscmn.cpp +++ b/src/common/utilscmn.cpp @@ -180,7 +180,7 @@ int strncasecmp(const char *str_1, const char *str_2, size_t maxchar) } #endif // __VMS__ -#ifdef __WINDOWS__ +#if defined(__WINDOWS__) && !defined(__WXMICROWIN__) #ifndef __GNUWIN32__ #ifndef __MWERKS__ diff --git a/src/generic/tipwin.cpp b/src/generic/tipwin.cpp index 1469b554c7..f9c3b5538c 100644 --- a/src/generic/tipwin.cpp +++ b/src/generic/tipwin.cpp @@ -99,7 +99,14 @@ wxTipWindow::wxTipWindow(wxWindow *parent, { // set colours SetForegroundColour(*wxBLACK); - SetBackgroundColour(wxColour(255, 255, 231)); + +#ifdef __WXMSW__ + wxColour bkCol(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_INFOBK)); +#else + wxColour bkCol(wxColour(255, 255, 225)); +#endif + SetBackgroundColour(bkCol); + // set position and size int x, y; wxGetMousePosition(&x, &y); @@ -154,7 +161,12 @@ wxTipWindowView::wxTipWindowView(wxWindow *parent) { // set colours SetForegroundColour(*wxBLACK); - SetBackgroundColour(wxColour(255, 255, 231)); +#ifdef __WXMSW__ + wxColour bkCol(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_INFOBK)); +#else + wxColour bkCol(wxColour(255, 255, 225)); +#endif + SetBackgroundColour(bkCol); m_creationTime = wxGetLocalTime(); } diff --git a/src/msw/app.cpp b/src/msw/app.cpp index 18bb7bbaed..7ad291e9d9 100644 --- a/src/msw/app.cpp +++ b/src/msw/app.cpp @@ -86,11 +86,13 @@ #include #include -#if defined(__WIN95__) && !((defined(__GNUWIN32_OLD__) || defined(__TWIN32__)) && !defined(__CYGWIN10__)) +#if defined(__WIN95__) && !((defined(__GNUWIN32_OLD__) || defined(__TWIN32__) || defined(__WXMICROWIN__)) && !defined(__CYGWIN10__)) #include #endif +#ifndef __WXMICROWIN__ #include "wx/msw/msvcrt.h" +#endif // ---------------------------------------------------------------------------- // conditional compilation @@ -124,7 +126,9 @@ extern wxChar *wxBuffer; extern wxList *wxWinHandleList; extern wxList WXDLLEXPORT wxPendingDelete; +#ifndef __WXMICROWIN__ extern void wxSetKeyboardHook(bool doIt); +#endif MSG s_currentMsg; wxApp *wxTheApp = NULL; @@ -234,9 +238,8 @@ bool wxApp::Initialize() wxBitmap::InitStandardHandlers(); -#if defined(__WIN95__) +#if defined(__WIN95__) && !defined(__WXMICROWIN__) InitCommonControls(); - #endif // __WIN95__ #if wxUSE_OLE || wxUSE_DRAG_AND_DROP || wxUSE_DATAOBJ @@ -273,6 +276,7 @@ bool wxApp::Initialize() RegisterWindowClasses(); +#ifndef __WXMICROWIN__ // Create the brush for disabling bitmap buttons LOGBRUSH lb; @@ -284,6 +288,7 @@ bool wxApp::Initialize() ::DeleteObject( (HGDIOBJ)lb.lbHatch ); } //else: wxWindows resources are probably not linked in +#endif #if wxUSE_PENWINDOWS wxRegisterPenWin(); @@ -298,7 +303,9 @@ bool wxApp::Initialize() if (wxDummyChar) wxDummyChar++; #endif +#ifndef __WXMICROWIN__ wxSetKeyboardHook(TRUE); +#endif wxModule::RegisterModules(); if (!wxModule::InitializeModules()) @@ -562,7 +569,9 @@ void wxApp::CleanUp() //// WINDOWS-SPECIFIC CLEANUP +#ifndef __WXMICROWIN__ wxSetKeyboardHook(FALSE); +#endif #if wxUSE_PENWINDOWS wxCleanUpPenWin(); @@ -673,7 +682,10 @@ int wxEntry(WXHINSTANCE hInstance, // do check for memory leaks on program exit // (another useful flag is _CRTDBG_DELAY_FREE_MEM_DF which doesn't free // deallocated memory which may be used to simulate low-memory condition) +#ifndef __WXMICROWIN__ wxCrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF); +#endif + #ifdef __MWERKS__ #if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT // This seems to be necessary since there are 'rogue' @@ -1188,6 +1200,9 @@ void wxApp::OnQueryEndSession(wxCloseEvent& event) /* static */ int wxApp::GetComCtl32Version() { +#ifdef __WXMICROWIN__ + return 0; +#else // cache the result static int s_verComCtl32 = -1; @@ -1270,6 +1285,7 @@ int wxApp::GetComCtl32Version() } return s_verComCtl32; +#endif } void wxExit() diff --git a/src/msw/bitmap.cpp b/src/msw/bitmap.cpp index 437a6c4452..d6e1ddd207 100644 --- a/src/msw/bitmap.cpp +++ b/src/msw/bitmap.cpp @@ -43,7 +43,10 @@ #include "wx/msw/private.h" #include "wx/log.h" +#if !defined(__WXMICROWIN__) #include "wx/msw/dib.h" +#endif + #include "wx/image.h" #include "wx/xpmdecod.h" @@ -112,6 +115,7 @@ void wxBitmap::Init() bool wxBitmap::CopyFromIconOrCursor(const wxGDIImage& icon) { +#ifndef __WXMICROWIN__ // it may be either HICON or HCURSOR HICON hicon = (HICON)icon.GetHandle(); @@ -145,6 +149,9 @@ bool wxBitmap::CopyFromIconOrCursor(const wxGDIImage& icon) #endif // WXWIN_COMPATIBILITY_2 return TRUE; +#else + return FALSE; +#endif } #endif // Win32 @@ -219,6 +226,7 @@ wxBitmap::wxBitmap(const char bits[], int width, int height, int depth) { Init(); +#ifndef __WXMICROWIN__ wxBitmapRefData *refData = new wxBitmapRefData; m_refData = refData; @@ -279,6 +287,7 @@ wxBitmap::wxBitmap(const char bits[], int width, int height, int depth) } SetHBITMAP((WXHBITMAP)hbmp); +#endif } // Create from XPM data @@ -323,6 +332,7 @@ wxBitmap::wxBitmap(const wxString& filename, wxBitmapType type) bool wxBitmap::Create(int w, int h, int d) { +#ifndef __WXMICROWIN__ UnRef(); m_refData = new wxBitmapRefData; @@ -358,8 +368,10 @@ bool wxBitmap::Create(int w, int h, int d) #if WXWIN_COMPATIBILITY_2 GetBitmapData()->m_ok = hbmp != 0; #endif // WXWIN_COMPATIBILITY_2 - return Ok(); +#else + return FALSE; +#endif } // ---------------------------------------------------------------------------- @@ -799,6 +811,7 @@ bool wxBitmap::SaveFile(const wxString& filename, int type, const wxPalette *pal wxBitmap wxBitmap::GetSubBitmap( const wxRect& rect) const { +#ifndef __WXMICROWIN__ wxCHECK_MSG( Ok() && (rect.x >= 0) && (rect.y >= 0) && (rect.x+rect.width <= GetWidth()) && @@ -834,6 +847,9 @@ wxBitmap wxBitmap::GetSubBitmap( const wxRect& rect) const DeleteDC(dcSrc); return ret; +#else + return wxBitmap(); +#endif } // ---------------------------------------------------------------------------- @@ -876,6 +892,9 @@ void wxBitmap::SetMask(wxMask *mask) // Contributed by Frederic Villeneuve wxBitmap wxBitmap::GetBitmapForDC(wxDC& dc) const { +#ifdef __WXMICROWIN__ + return wxBitmap(); +#else wxMemoryDC memDC; wxBitmap tmpBitmap(GetWidth(), GetHeight(), dc.GetDepth()); HPALETTE hPal = (HPALETTE) NULL; @@ -920,6 +939,7 @@ wxBitmap wxBitmap::GetBitmapForDC(wxDC& dc) const wxFreeDIB(lpDib); return tmpBitmap; +#endif } // ---------------------------------------------------------------------------- @@ -963,6 +983,7 @@ wxMask::~wxMask() // Create a mask from a mono bitmap (copies the bitmap). bool wxMask::Create(const wxBitmap& bitmap) { +#ifndef __WXMICROWIN__ wxCHECK_MSG( bitmap.Ok() && bitmap.GetDepth() == 1, FALSE, _T("can't create mask from invalid or not monochrome bitmap") ); @@ -987,6 +1008,9 @@ bool wxMask::Create(const wxBitmap& bitmap) SelectObject(destDC, 0); DeleteDC(destDC); return TRUE; +#else + return FALSE; +#endif } // Create a mask from a bitmap and a palette index indicating @@ -1014,6 +1038,7 @@ bool wxMask::Create(const wxBitmap& bitmap, int paletteIndex) // the transparent area bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour) { +#ifndef __WXMICROWIN__ wxCHECK_MSG( bitmap.Ok(), FALSE, _T("invalid bitmap in wxMask::Create") ); if ( m_maskBitmap ) @@ -1093,6 +1118,9 @@ bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour) ::DeleteDC(destDC); return ok; +#else + return FALSE; +#endif } // ---------------------------------------------------------------------------- @@ -1159,6 +1187,7 @@ bool wxBitmapHandler::SaveFile(wxBitmap *WXUNUSED(bitmap), // DIB functions // ---------------------------------------------------------------------------- +#ifndef __WXMICROWIN__ bool wxCreateDIB(long xSize, long ySize, long bitsPerPixel, HPALETTE hPal, LPBITMAPINFO* lpDIBHeader) { @@ -1206,6 +1235,7 @@ void wxFreeDIB(LPBITMAPINFO lpDIBHeader) { free(lpDIBHeader); } +#endif // ---------------------------------------------------------------------------- // other helper functions @@ -1213,6 +1243,7 @@ void wxFreeDIB(LPBITMAPINFO lpDIBHeader) extern HBITMAP wxInvertMask(HBITMAP hbmpMask, int w, int h) { +#ifndef __WXMICROWIN__ wxCHECK_MSG( hbmpMask, 0, _T("invalid bitmap in wxInvertMask") ); // get width/height from the bitmap if not given @@ -1250,4 +1281,7 @@ extern HBITMAP wxInvertMask(HBITMAP hbmpMask, int w, int h) ::DeleteDC(hdcDst); return hbmpInvMask; +#else + return 0; +#endif } diff --git a/src/msw/brush.cpp b/src/msw/brush.cpp index 825410a28b..83f9652783 100644 --- a/src/msw/brush.cpp +++ b/src/msw/brush.cpp @@ -127,6 +127,7 @@ bool wxBrush::RealizeResource(void) // - could choose white always for a quick solution break; ***/ +#ifndef __WXMICROWIN__ case wxBDIAGONAL_HATCH: M_BRUSHDATA->m_hBrush = (WXHBRUSH) CreateHatchBrush(HS_BDIAGONAL,ms_colour) ; break ; @@ -157,6 +158,7 @@ bool wxBrush::RealizeResource(void) else M_BRUSHDATA->m_hBrush = (WXHBRUSH) CreateSolidBrush(ms_colour) ; break ; +#endif case wxSOLID: default: M_BRUSHDATA->m_hBrush = (WXHBRUSH) CreateSolidBrush(ms_colour) ; diff --git a/src/msw/cursor.cpp b/src/msw/cursor.cpp index 0409580d2d..2d93aa7419 100644 --- a/src/msw/cursor.cpp +++ b/src/msw/cursor.cpp @@ -39,7 +39,9 @@ #include "wx/module.h" #include "wx/msw/private.h" +#ifndef __WXMICROWIN__ #include "wx/msw/dib.h" +#endif #if wxUSE_RESOURCE_LOADING_IN_MSW #include "wx/msw/curico.h" @@ -101,8 +103,10 @@ void wxCursorRefData::Free() { if ( m_hCursor ) { +#ifndef __WXMICROWIN__ if ( m_destroyCursor ) ::DestroyCursor((HCURSOR)m_hCursor); +#endif m_hCursor = 0; } @@ -128,6 +132,9 @@ wxCursor::wxCursor(const wxString& cursor_file, long flags, int hotSpotX, int hotSpotY) { +#ifdef __WXMICROWIN__ + m_refData = NULL; +#else wxCursorRefData *refData = new wxCursorRefData; m_refData = refData; @@ -181,11 +188,16 @@ wxCursor::wxCursor(const wxString& cursor_file, #if WXWIN_COMPATIBILITY_2 refData->SetOk(); #endif // WXWIN_COMPATIBILITY_2 + +#endif } // Cursors by stock number wxCursor::wxCursor(int cursor_type) { +#ifdef __WXMICROWIN__ + m_refData = NULL; +#else wxCursorRefData *refData = new wxCursorRefData; m_refData = refData; @@ -308,6 +320,7 @@ wxCursor::wxCursor(int cursor_type) refData->m_hCursor = (WXHCURSOR) LoadCursor((HINSTANCE) NULL, IDC_ARROW); break; } +#endif } wxCursor::~wxCursor() @@ -327,7 +340,9 @@ void wxSetCursor(const wxCursor& cursor) { if ( cursor.Ok() ) { +#ifndef __WXMICROWIN__ ::SetCursor(GetHcursorOf(cursor)); +#endif if ( gs_globalCursor ) *gs_globalCursor = cursor; diff --git a/src/msw/dc.cpp b/src/msw/dc.cpp index f0135c90d9..0887188c47 100644 --- a/src/msw/dc.cpp +++ b/src/msw/dc.cpp @@ -343,10 +343,15 @@ bool wxDC::CanDrawBitmap() const bool wxDC::CanGetTextExtent() const { +#ifdef __WXMICROWIN__ + // TODO Extend MicroWindows' GetDeviceCaps function + return TRUE; +#else // What sort of display is it? int technology = ::GetDeviceCaps(GetHdc(), TECHNOLOGY); return (technology == DT_RASDISPLAY) || (technology == DT_RASPRINTER); +#endif } int wxDC::GetDepth() const @@ -516,7 +521,7 @@ void wxDC::DoDrawCheckMark(wxCoord x1, wxCoord y1, wxCoord x2 = x1 + width, y2 = y1 + height; -#if defined(__WIN32__) && !defined(__SC__) +#if defined(__WIN32__) && !defined(__SC__) && !defined(__WXMICROWIN__) RECT rect; rect.left = x1; rect.top = y1; @@ -901,6 +906,7 @@ void wxDC::DoDrawRotatedText(const wxString& text, { DoDrawText(text, x, y); } +#ifndef __WXMICROWIN__ else { // NB: don't take DEFAULT_GUI_FONT because it's not TrueType and so @@ -951,6 +957,7 @@ void wxDC::DoDrawRotatedText(const wxString& text, CalcBoundingBox(x, y); CalcBoundingBox(x + h*sin(rad), y + h*cos(rad)); } +#endif } // --------------------------------------------------------------------------- diff --git a/src/msw/dialog.cpp b/src/msw/dialog.cpp index 78d54abe46..5b2aaf7a99 100644 --- a/src/msw/dialog.cpp +++ b/src/msw/dialog.cpp @@ -624,6 +624,7 @@ long wxDialog::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) processed = !Close(); break; +#ifndef __WXMICROWIN__ case WM_SETCURSOR: // we want to override the busy cursor for modal dialogs: // typically, wxBeginBusyCursor() is called and then a modal dialog @@ -649,6 +650,7 @@ long wxDialog::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) rc = FALSE; } break; +#endif } if ( !processed ) diff --git a/src/msw/font.cpp b/src/msw/font.cpp index 87ab343794..1800a135c0 100644 --- a/src/msw/font.cpp +++ b/src/msw/font.cpp @@ -86,9 +86,9 @@ public: Init(size, family, style, weight, underlined, faceName, encoding); } - wxFontRefData(const wxNativeFontInfo& info) + wxFontRefData(const wxNativeFontInfo& info, WXHFONT hFont = 0) { - Init(info); + Init(info, hFont); } virtual ~wxFontRefData(); @@ -103,7 +103,7 @@ protected: const wxString& faceName, wxFontEncoding encoding); - void Init(const wxNativeFontInfo& info); + void Init(const wxNativeFontInfo& info, WXHFONT hFont = 0); // If TRUE, the pointer to the actual font is temporary and SHOULD NOT BE // DELETED by destructor @@ -161,7 +161,7 @@ void wxFontRefData::Init(int pointSize, m_nativeFontInfoOk = FALSE; } -void wxFontRefData::Init(const wxNativeFontInfo& info) +void wxFontRefData::Init(const wxNativeFontInfo& info, WXHFONT hFont) { // extract family from pitch-and-family int lfFamily = info.lf.lfPitchAndFamily; @@ -230,7 +230,11 @@ void wxFontRefData::Init(const wxNativeFontInfo& info) m_fontId = 0; m_temporary = FALSE; - m_hFont = 0; + // hFont may be zero, or it be passed in case we really want to + // use the exact font created in the underlying system + // (for example where we can't guarantee conversion from HFONT + // to LOGFONT back to HFONT) + m_hFont = hFont; m_nativeFontInfoOk = TRUE; m_nativeFontInfo = info; @@ -370,11 +374,11 @@ void wxFont::Init() wxTheFontList->Append(this); } -bool wxFont::Create(const wxNativeFontInfo& info) +bool wxFont::Create(const wxNativeFontInfo& info, WXHFONT hFont) { UnRef(); - m_refData = new wxFontRefData(info); + m_refData = new wxFontRefData(info, hFont); RealizeResource(); diff --git a/src/msw/fontenum.cpp b/src/msw/fontenum.cpp index 60f38ac3fa..1f7305a937 100644 --- a/src/msw/fontenum.cpp +++ b/src/msw/fontenum.cpp @@ -93,8 +93,10 @@ private: // private functions // ---------------------------------------------------------------------------- +#ifndef __WXMICROWIN__ int CALLBACK wxFontEnumeratorProc(LPLOGFONT lplf, LPTEXTMETRIC lptm, DWORD dwStyle, LONG lParam); +#endif // ============================================================================ // implementation @@ -147,6 +149,7 @@ bool wxFontEnumeratorHelper::SetEncoding(wxFontEncoding encoding) void wxFontEnumeratorHelper::DoEnumerate() { +#ifndef __WXMICROWIN__ HDC hDC = ::GetDC(NULL); #ifdef __WIN32__ @@ -167,6 +170,7 @@ void wxFontEnumeratorHelper::DoEnumerate() #endif // Win32/16 ::ReleaseDC(NULL, hDC); +#endif } bool wxFontEnumeratorHelper::OnFont(const LPLOGFONT lf, @@ -246,6 +250,7 @@ bool wxFontEnumerator::EnumerateEncodings(const wxString& family) // Windows callbacks // ---------------------------------------------------------------------------- +#ifndef __WXMICROWIN__ int CALLBACK wxFontEnumeratorProc(LPLOGFONT lplf, LPTEXTMETRIC lptm, DWORD dwStyle, LONG lParam) { @@ -260,5 +265,6 @@ int CALLBACK wxFontEnumeratorProc(LPLOGFONT lplf, LPTEXTMETRIC lptm, return fontEnum->OnFont(lplf, lptm); } +#endif #endif // wxUSE_FONTMAP diff --git a/src/msw/fontutil.cpp b/src/msw/fontutil.cpp index 003dd85a7e..22d308ceec 100644 --- a/src/msw/fontutil.cpp +++ b/src/msw/fontutil.cpp @@ -123,7 +123,7 @@ bool wxGetNativeFontEncoding(wxFontEncoding encoding, info->charset = ANSI_CHARSET; break; -#if !defined(__WIN16__) +#if !defined(__WIN16__) && !defined(__WXMICROWIN__) case wxFONTENCODING_CP1250: info->charset = EASTEUROPE_CHARSET; break; @@ -213,7 +213,7 @@ wxFontEncoding wxGetFontEncFromCharSet(int cs) fontEncoding = wxFONTENCODING_CP1252; break; -#ifdef __WIN32__ +#if defined(__WIN32__) && !defined(__WXMICROWIN__) case EASTEUROPE_CHARSET: fontEncoding = wxFONTENCODING_CP1250; break; diff --git a/src/msw/frame.cpp b/src/msw/frame.cpp index 2a738679e0..f7b9b64311 100644 --- a/src/msw/frame.cpp +++ b/src/msw/frame.cpp @@ -380,21 +380,31 @@ void wxFrameMSW::Restore() bool wxFrameMSW::IsIconized() const { +#ifdef __WXMICROWIN__ + // TODO + return FALSE; +#else ((wxFrameMSW *)this)->m_iconized = (::IsIconic(GetHwnd()) != 0); return m_iconized; +#endif } // Is it maximized? bool wxFrameMSW::IsMaximized() const { +#ifdef __WXMICROWIN__ + // TODO + return FALSE; +#else return (::IsZoomed(GetHwnd()) != 0); +#endif } void wxFrameMSW::SetIcon(const wxIcon& icon) { wxFrameBase::SetIcon(icon); -#if defined(__WIN95__) +#if defined(__WIN95__) && !defined(__WXMICROWIN__) if ( m_icon.Ok() ) { SendMessage(GetHwnd(), WM_SETICON, @@ -533,10 +543,12 @@ void wxFrameMSW::SetMenuBar(wxMenuBar *menubar) void wxFrameMSW::InternalSetMenuBar() { +#ifndef __WXMICROWIN__ if ( !::SetMenu(GetHwnd(), (HMENU)m_hMenu) ) { wxLogLastError(wxT("SetMenu")); } +#endif } #endif // wxUSE_MENUS_NATIVE @@ -585,8 +597,10 @@ bool wxFrameMSW::ShowFullScreen(bool show, long style) } #endif // wxUSE_TOOLBAR +#ifndef __WXMICROWIN__ if (style & wxFULLSCREEN_NOMENUBAR) SetMenu((HWND)GetHWND(), (HMENU) NULL); +#endif #if wxUSE_STATUSBAR wxStatusBar *theStatusBar = GetStatusBar(); @@ -676,8 +690,10 @@ bool wxFrameMSW::ShowFullScreen(bool show, long style) } #endif // wxUSE_STATUSBAR +#ifndef __WXMICROWIN__ if ((m_fsStyle & wxFULLSCREEN_NOMENUBAR) && (m_hMenu != 0)) SetMenu((HWND)GetHWND(), (HMENU)m_hMenu); +#endif Maximize(m_fsIsMaximized); SetWindowLong((HWND)GetHWND(),GWL_STYLE, m_fsOldWindowStyle); @@ -956,6 +972,7 @@ bool wxFrameMSW::HandlePaint() RECT rect; if ( GetUpdateRect(GetHwnd(), &rect, FALSE) ) { +#ifndef __WXMICROWIN__ if ( m_iconized ) { HICON hIcon = m_icon.Ok() ? GetHiconOf(m_icon) @@ -989,6 +1006,7 @@ bool wxFrameMSW::HandlePaint() return TRUE; } else + #endif { return wxWindow::HandlePaint(); } @@ -1003,6 +1021,7 @@ bool wxFrameMSW::HandlePaint() bool wxFrameMSW::HandleSize(int x, int y, WXUINT id) { bool processed = FALSE; +#ifndef __WXMICROWIN__ switch ( id ) { @@ -1033,6 +1052,7 @@ bool wxFrameMSW::HandleSize(int x, int y, WXUINT id) m_iconized = TRUE; break; } +#endif if ( !m_iconized ) { @@ -1092,10 +1112,12 @@ bool wxFrameMSW::HandleMenuSelect(WXWORD nItem, WXWORD flags, WXHMENU hMenu) // menu was removed from screen item = -1; } +#ifndef __WXMICROWIN__ else if ( !(flags & MF_POPUP) && !(flags & MF_SEPARATOR) ) { item = nItem; } +#endif else { #if wxUSE_STATUSBAR @@ -1147,6 +1169,7 @@ long wxFrameMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) } break; +#ifndef __WXMICROWIN__ case WM_MENUSELECT: { WXWORD item, flags; @@ -1156,11 +1179,13 @@ long wxFrameMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) processed = HandleMenuSelect(item, flags, hmenu); } break; +#endif case WM_PAINT: processed = HandlePaint(); break; +#ifndef __WXMICROWIN__ case WM_QUERYDRAGICON: { HICON hIcon = m_icon.Ok() ? GetHiconOf(m_icon) @@ -1169,6 +1194,7 @@ long wxFrameMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) processed = rc != 0; } break; +#endif case WM_SIZE: processed = HandleSize(LOWORD(lParam), HIWORD(lParam), wParam); diff --git a/src/msw/gdiimage.cpp b/src/msw/gdiimage.cpp index 215ddda18d..000238864c 100644 --- a/src/msw/gdiimage.cpp +++ b/src/msw/gdiimage.cpp @@ -37,7 +37,10 @@ #include "wx/app.h" +#ifndef __WXMICROWIN__ #include "wx/msw/dib.h" +#endif + #include "wx/msw/bitmap.h" #include "wx/msw/gdiimage.h" #include "wx/bitmap.h" @@ -50,6 +53,8 @@ // private classes // ---------------------------------------------------------------------------- +#ifndef __WXMICROWIN__ + // all image handlers are declared/defined in this file because the outside // world doesn't have to know about them (but only about wxBITMAP_TYPE_XXX ids) @@ -180,6 +185,8 @@ private: // ---------------------------------------------------------------------------- static wxSize GetHiconSize(HICON hicon); +#endif + // __MICROWIN__ // ============================================================================ // implementation @@ -295,12 +302,16 @@ void wxGDIImage::CleanUpHandlers() void wxGDIImage::InitStandardHandlers() { +#ifndef __WXMICROWIN__ AddHandler(new wxBMPResourceHandler); AddHandler(new wxBMPFileHandler); AddHandler(new wxICOResourceHandler); AddHandler(new wxICOFileHandler); +#endif } +#ifndef __WXMICROWIN__ + // ---------------------------------------------------------------------------- // wxBitmap handlers // ---------------------------------------------------------------------------- @@ -533,3 +544,5 @@ static wxSize GetHiconSize(HICON hicon) return size; } +#endif + // __WXMICROWIN__ diff --git a/src/msw/icon.cpp b/src/msw/icon.cpp index fa2c11ffaf..8f27b61324 100644 --- a/src/msw/icon.cpp +++ b/src/msw/icon.cpp @@ -63,7 +63,9 @@ void wxIconRefData::Free() { if ( m_hIcon ) { +#ifndef __WXMICROWIN__ ::DestroyIcon((HICON) m_hIcon); +#endif m_hIcon = 0; } @@ -94,6 +96,7 @@ wxIcon::~wxIcon() void wxIcon::CopyFromBitmap(const wxBitmap& bmp) { +#ifndef __WXMICROWIN__ #ifdef __WIN32__ wxMask *mask = bmp.GetMask(); if ( !mask ) @@ -154,6 +157,7 @@ void wxIcon::CopyFromBitmap(const wxBitmap& bmp) // wxFAIL_MSG("Bitmap to icon conversion (including use of XPMs for icons) not implemented"); #endif // Win32/16 +#endif } void wxIcon::CreateIconFromXpm(const char **data) diff --git a/src/msw/main.cpp b/src/msw/main.cpp index 1ee977b104..f9a4ae5e65 100644 --- a/src/msw/main.cpp +++ b/src/msw/main.cpp @@ -66,7 +66,7 @@ HINSTANCE wxhInstance = 0; #if !defined(_WINDLL) -#if defined(__TWIN32__) || defined(__WXWINE__) +#if defined(__TWIN32__) || defined(__WXWINE__) || defined(__WXMICROWIN__) #define HINSTANCE HANDLE extern "C" diff --git a/src/msw/makefile.mic b/src/msw/makefile.mic new file mode 100644 index 0000000000..2de5b50152 --- /dev/null +++ b/src/msw/makefile.mic @@ -0,0 +1,337 @@ +############################################################################## +# Microwindows template Makefile +# Copyright (c) 2000 Martin Jolicoeur, Greg Haerr +############################################################################## + +TOP=/home/julians/microwindows/microwin/src +CONFIG = $(TOP)/config +WXDIR = ../.. +OBJSUFF = o +SRCSUFF = cpp +WXLIB=$(WXDIR)/lib/libwx.a +AROPTIONS = ruv +RANLIB = ranlib +RM = rm -f + +GENDIR = $(WXDIR)/src/generic +COMMDIR = $(WXDIR)/src/common +HTMLDIR = $(WXDIR)/src/html +ZLIBDIR = $(WXDIR)/src/zlib +PNGDIR = $(WXDIR)/src/png +JPEGDIR = $(WXDIR)/src/jpeg +TIFFDIR = $(WXDIR)/src/tiff +OLEDIR = $(WXDIR)/src/msw/ole +MICROWINDIR = $(WXDIR)/src/msw +UNIXDIR = $(WXDIR)/src/unix +UNIVDIR = $(WXDIR)/src/univ + +ZLIBLIB = $(WXDIR)/lib/libzlib.a +PNGLIB = $(WXDIR)/lib/libpng.a +JPEGLIB = $(WXDIR)/lib/libjpeg.a +TIFFLIB = $(WXDIR)/lib/libtiff.a + +GENERICOBJS_ORIG = \ + $(GENDIR)/busyinfo.$(OBJSUFF) \ + $(GENDIR)/calctrl.$(OBJSUFF) \ + $(GENDIR)/choicdgg.$(OBJSUFF) \ + $(GENDIR)/dirctrlg.$(OBJSUFF) \ + $(GENDIR)/dragimgg.$(OBJSUFF) \ + $(GENDIR)/grid.$(OBJSUFF) \ + $(GENDIR)/gridsel.$(OBJSUFF) \ + $(GENDIR)/laywin.$(OBJSUFF) \ + $(GENDIR)/logg.$(OBJSUFF) \ + $(GENDIR)/numdlgg.$(OBJSUFF) \ + $(GENDIR)/panelg.$(OBJSUFF) \ + $(GENDIR)/progdlgg.$(OBJSUFF) \ + $(GENDIR)/prop.$(OBJSUFF) \ + $(GENDIR)/propform.$(OBJSUFF) \ + $(GENDIR)/proplist.$(OBJSUFF) \ + $(GENDIR)/sashwin.$(OBJSUFF) \ + $(GENDIR)/scrolwin.$(OBJSUFF) \ + $(GENDIR)/splash.$(OBJSUFF) \ + $(GENDIR)/splitter.$(OBJSUFF) \ + $(GENDIR)/statusbr.$(OBJSUFF) \ + $(GENDIR)/tbarsmpl.$(OBJSUFF) \ + $(GENDIR)/textdlgg.$(OBJSUFF) \ + $(GENDIR)/tipdlg.$(OBJSUFF) \ + $(GENDIR)/tipwin.$(OBJSUFF) \ + $(GENDIR)/treectlg.$(OBJSUFF) \ + $(GENDIR)/treelay.$(OBJSUFF) \ + $(GENDIR)/wizard.$(OBJSUFF) + +GENERICOBJS = \ + $(GENDIR)/laywin.$(OBJSUFF) \ + $(GENDIR)/logg.$(OBJSUFF) \ + $(GENDIR)/panelg.$(OBJSUFF) \ + $(GENDIR)/sashwin.$(OBJSUFF) \ + $(GENDIR)/scrolwin.$(OBJSUFF) \ + $(GENDIR)/splash.$(OBJSUFF) \ + $(GENDIR)/splitter.$(OBJSUFF) \ + $(GENDIR)/statusbr.$(OBJSUFF) \ + $(GENDIR)/tbarsmpl.$(OBJSUFF) \ + $(GENDIR)/tipwin.$(OBJSUFF) + +COMMONOBJS_OTHER=\ + $(COMMDIR)/choiccmn.$(OBJSUFF) \ + $(COMMDIR)/ctrlsub.$(OBJSUFF) \ + $(COMMDIR)/dobjcmn.$(OBJSUFF) \ + $(COMMDIR)/lboxcmn.$(OBJSUFF) \ + $(COMMDIR)/textcmn.$(OBJSUFF) \ + +COMMONOBJS = \ + $(COMMDIR)/appcmn.$(OBJSUFF) \ + $(COMMDIR)/clipcmn.$(OBJSUFF) \ + $(COMMDIR)/cmdline.$(OBJSUFF) \ + $(COMMDIR)/cmndata.$(OBJSUFF) \ + $(COMMDIR)/config.$(OBJSUFF) \ + $(COMMDIR)/cshelp.$(OBJSUFF) \ + $(COMMDIR)/ctrlcmn.$(OBJSUFF) \ + $(COMMDIR)/datetime.$(OBJSUFF) \ + $(COMMDIR)/datstrm.$(OBJSUFF) \ + $(COMMDIR)/dcbase.$(OBJSUFF) \ + $(COMMDIR)/dlgcmn.$(OBJSUFF) \ + $(COMMDIR)/dynarray.$(OBJSUFF) \ + $(COMMDIR)/dynlib.$(OBJSUFF) \ + $(COMMDIR)/effects.$(OBJSUFF) \ + $(COMMDIR)/encconv.$(OBJSUFF) \ + $(COMMDIR)/event.$(OBJSUFF) \ + $(COMMDIR)/extended.$(OBJSUFF) \ + $(COMMDIR)/ffile.$(OBJSUFF) \ + $(COMMDIR)/file.$(OBJSUFF) \ + $(COMMDIR)/fileconf.$(OBJSUFF) \ + $(COMMDIR)/filefn.$(OBJSUFF) \ + $(COMMDIR)/filename.$(OBJSUFF) \ + $(COMMDIR)/filesys.$(OBJSUFF) \ + $(COMMDIR)/fontcmn.$(OBJSUFF) \ + $(COMMDIR)/fontmap.$(OBJSUFF) \ + $(COMMDIR)/framecmn.$(OBJSUFF) \ + $(COMMDIR)/gdicmn.$(OBJSUFF) \ + $(COMMDIR)/geometry.$(OBJSUFF) \ + $(COMMDIR)/gifdecod.$(OBJSUFF) \ + $(COMMDIR)/hash.$(OBJSUFF) \ + $(COMMDIR)/helpbase.$(OBJSUFF) \ + $(COMMDIR)/imagall.$(OBJSUFF) \ + $(COMMDIR)/imagbmp.$(OBJSUFF) \ + $(COMMDIR)/image.$(OBJSUFF) \ + $(COMMDIR)/imaggif.$(OBJSUFF) \ + $(COMMDIR)/imagjpeg.$(OBJSUFF) \ + $(COMMDIR)/imagpcx.$(OBJSUFF) \ + $(COMMDIR)/imagpng.$(OBJSUFF) \ + $(COMMDIR)/imagpnm.$(OBJSUFF) \ + $(COMMDIR)/imagtiff.$(OBJSUFF) \ + $(COMMDIR)/imagxpm.$(OBJSUFF) \ + $(COMMDIR)/intl.$(OBJSUFF) \ + $(COMMDIR)/layout.$(OBJSUFF) \ + $(COMMDIR)/list.$(OBJSUFF) \ + $(COMMDIR)/log.$(OBJSUFF) \ + $(COMMDIR)/longlong.$(OBJSUFF) \ + $(COMMDIR)/matrix.$(OBJSUFF) \ + $(COMMDIR)/memory.$(OBJSUFF) \ + $(COMMDIR)/menucmn.$(OBJSUFF) \ + $(COMMDIR)/module.$(OBJSUFF) \ + $(COMMDIR)/mstream.$(OBJSUFF) \ + $(COMMDIR)/object.$(OBJSUFF) \ + $(COMMDIR)/objstrm.$(OBJSUFF) \ + $(COMMDIR)/paper.$(OBJSUFF) \ + $(COMMDIR)/prntbase.$(OBJSUFF) \ + $(COMMDIR)/process.$(OBJSUFF) \ + $(COMMDIR)/quantize.$(OBJSUFF) \ + $(COMMDIR)/resource.$(OBJSUFF) \ + $(COMMDIR)/sizer.$(OBJSUFF) \ + $(COMMDIR)/strconv.$(OBJSUFF) \ + $(COMMDIR)/stream.$(OBJSUFF) \ + $(COMMDIR)/string.$(OBJSUFF) \ + $(COMMDIR)/tbarbase.$(OBJSUFF) \ + $(COMMDIR)/textfile.$(OBJSUFF) \ + $(COMMDIR)/timercmn.$(OBJSUFF) \ + $(COMMDIR)/tokenzr.$(OBJSUFF) \ + $(COMMDIR)/treebase.$(OBJSUFF) \ + $(COMMDIR)/txtstrm.$(OBJSUFF) \ + $(COMMDIR)/utilscmn.$(OBJSUFF) \ + $(UNIXDIR)/utilsunx.$(OBJSUFF) \ + $(COMMDIR)/valgen.$(OBJSUFF) \ + $(COMMDIR)/validate.$(OBJSUFF) \ + $(COMMDIR)/valtext.$(OBJSUFF) \ + $(COMMDIR)/variant.$(OBJSUFF) \ + $(COMMDIR)/wfstream.$(OBJSUFF) \ + $(COMMDIR)/wincmn.$(OBJSUFF) \ + $(COMMDIR)/wxchar.$(OBJSUFF) \ + $(COMMDIR)/xpmdecod.$(OBJSUFF) + +HTMLOBJS = \ + $(HTMLDIR)/helpctrl.$(OBJSUFF) \ + $(HTMLDIR)/helpdata.$(OBJSUFF) \ + $(HTMLDIR)/helpfrm.$(OBJSUFF) \ + $(HTMLDIR)/htmlcell.$(OBJSUFF) \ + $(HTMLDIR)/htmlfilt.$(OBJSUFF) \ + $(HTMLDIR)/htmlpars.$(OBJSUFF) \ + $(HTMLDIR)/htmltag.$(OBJSUFF) \ + $(HTMLDIR)/htmlwin.$(OBJSUFF) \ + $(HTMLDIR)/htmprint.$(OBJSUFF) \ + $(HTMLDIR)/m_dflist.$(OBJSUFF) \ + $(HTMLDIR)/m_fonts.$(OBJSUFF) \ + $(HTMLDIR)/m_hline.$(OBJSUFF) \ + $(HTMLDIR)/m_image.$(OBJSUFF) \ + $(HTMLDIR)/m_layout.$(OBJSUFF) \ + $(HTMLDIR)/m_links.$(OBJSUFF) \ + $(HTMLDIR)/m_list.$(OBJSUFF) \ + $(HTMLDIR)/m_meta.$(OBJSUFF) \ + $(HTMLDIR)/m_pre.$(OBJSUFF) \ + $(HTMLDIR)/m_tables.$(OBJSUFF) \ + $(HTMLDIR)/winpars.$(OBJSUFF) + +MSWOBJS = \ + $(MICROWINDIR)/accel.$(OBJSUFF) \ + $(MICROWINDIR)/app.$(OBJSUFF) \ + $(MICROWINDIR)/bitmap.$(OBJSUFF) \ + $(MICROWINDIR)/brush.$(OBJSUFF) \ + $(MICROWINDIR)/caret.$(OBJSUFF) \ + $(MICROWINDIR)/clipbrd.$(OBJSUFF) \ + $(MICROWINDIR)/colour.$(OBJSUFF) \ + $(MICROWINDIR)/cursor.$(OBJSUFF) \ + $(MICROWINDIR)/data.$(OBJSUFF) \ + $(MICROWINDIR)/dc.$(OBJSUFF) \ + $(MICROWINDIR)/dcclient.$(OBJSUFF) \ + $(MICROWINDIR)/dcmemory.$(OBJSUFF) \ + $(MICROWINDIR)/dcprint.$(OBJSUFF) \ + $(MICROWINDIR)/dcscreen.$(OBJSUFF) \ + $(MICROWINDIR)/dde.$(OBJSUFF) \ + $(MICROWINDIR)/dialog.$(OBJSUFF) \ + $(MICROWINDIR)/dialup.$(OBJSUFF) \ + $(UNIXDIR)/dir.$(OBJSUFF) \ + $(MICROWINDIR)/font.$(OBJSUFF) \ + $(MICROWINDIR)/fontenum.$(OBJSUFF) \ + $(MICROWINDIR)/fontutil.$(OBJSUFF) \ + $(MICROWINDIR)/frame.$(OBJSUFF) \ + $(MICROWINDIR)/gdiimage.$(OBJSUFF) \ + $(MICROWINDIR)/gdiobj.$(OBJSUFF) \ + $(MICROWINDIR)/icon.$(OBJSUFF) \ + $(MICROWINDIR)/main.$(OBJSUFF) \ + $(MICROWINDIR)/menu.$(OBJSUFF) \ + $(MICROWINDIR)/menuitem.$(OBJSUFF) \ + $(MICROWINDIR)/microwin.$(OBJSUFF) \ + $(MICROWINDIR)/msgdlg.$(OBJSUFF) \ + $(MICROWINDIR)/palette.$(OBJSUFF) \ + $(MICROWINDIR)/pen.$(OBJSUFF) \ + $(MICROWINDIR)/regconf.$(OBJSUFF) \ + $(MICROWINDIR)/region.$(OBJSUFF) \ + $(MICROWINDIR)/settings.$(OBJSUFF) \ + $(MICROWINDIR)/thread.$(OBJSUFF) \ + $(MICROWINDIR)/timer.$(OBJSUFF) \ + $(MICROWINDIR)/utils.$(OBJSUFF) \ + $(MICROWINDIR)/window.$(OBJSUFF) + +UNIVOBJS = \ + $(UNIVDIR)/bmpbuttn.$(OBJSUFF) \ + $(UNIVDIR)/button.$(OBJSUFF) \ + $(UNIVDIR)/checkbox.$(OBJSUFF) \ + $(UNIVDIR)/checklst.$(OBJSUFF) \ + $(UNIVDIR)/choice.$(OBJSUFF) \ + $(UNIVDIR)/colordlg.$(OBJSUFF) \ + $(UNIVDIR)/colschem.$(OBJSUFF) \ + $(UNIVDIR)/control.$(OBJSUFF) \ + $(UNIVDIR)/frameuniv.$(OBJSUFF) \ + $(UNIVDIR)/gauge.$(OBJSUFF) \ + $(UNIVDIR)/inphand.$(OBJSUFF) \ + $(UNIVDIR)/listbox.$(OBJSUFF) \ + $(UNIVDIR)/menu.$(OBJSUFF) \ + $(UNIVDIR)/notebook.$(OBJSUFF) \ + $(UNIVDIR)/radiobox.$(OBJSUFF) \ + $(UNIVDIR)/radiobut.$(OBJSUFF) \ + $(UNIVDIR)/renderer.$(OBJSUFF) \ + $(UNIVDIR)/scrarrow.$(OBJSUFF) \ + $(UNIVDIR)/scrolbar.$(OBJSUFF) \ + $(UNIVDIR)/scrthumb.$(OBJSUFF) \ + $(UNIVDIR)/slider.$(OBJSUFF) \ + $(UNIVDIR)/spinbutt.$(OBJSUFF) \ + $(UNIVDIR)/spinctrl.$(OBJSUFF) \ + $(UNIVDIR)/statbmp.$(OBJSUFF) \ + $(UNIVDIR)/statbox.$(OBJSUFF) \ + $(UNIVDIR)/statline.$(OBJSUFF) \ + $(UNIVDIR)/stattext.$(OBJSUFF) \ + $(UNIVDIR)/textctrl.$(OBJSUFF) \ + $(UNIVDIR)/theme.$(OBJSUFF) \ + $(UNIVDIR)/winuniv.$(OBJSUFF) \ + $(UNIVDIR)/themes/gtk.$(OBJSUFF) \ + $(UNIVDIR)/themes/win32.$(OBJSUFF) + +include $(CONFIG) + +######################## Additional Flags section ############################ + +# Directories list for header files +INCLUDEDIRS += -I$(WXDIR)/include +# Defines for preprocessor +DEFINES += -DMWIN -D__WXMSW__ -D__WXMICROWIN__ -D__WXUNIVERSAL__ -D__WIN32__ -D__WIN95__ -DHAVE_BOOL -DMICROWIN_TODO=1 -D__UNIX__ -DHAVE_NANOSLEEP -DMICROWIN_NOCONTROLS -D__WXDEBUG__ + +# Compilation flags for C files OTHER than include directories +CFLAGS += +# Preprocessor flags OTHER than defines +CPPFLAGS += +# Linking flags +LDFLAGS += + +############################# targets section ################################ + +# If you want to create a library with the objects files, define the name here +LIBNAME = + +# If we put it below OBJS=, Makefile.rules includes .depend +# and it continually looks for .c files to satisfy .o.cpp +# dependency. What's going on there? +include $(TOP)/Makefile.rules + +# List of objects to compile +OBJS = $(COMMONOBJS) $(MSWOBJS) $(GENERICOBJS) + +all: $(WXLIB) + +######################### Makefile.rules section ############################# + + + +######################## Tools targets section ############################### + +#ntest: $(OBJS) $(NANOXCLIENTLIBS) $(TOP)/config +# $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@ $(NANOXCLIENTLIBS) + +$(WXLIB): $(OBJS) + ar $(AROPTIONS) $@ $(OBJS) + $(RANLIB) $@ + +#.SUFFIXES: .cpp .cxx .c + +#.c.o: +# $(CC) -c $(CFLAGS) $(CFLAGS) -o $@ $*.c + +.cxx.o: + $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $*.cxx + +.cpp.o: + $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $*.cpp + +#$(COMMDIR)/appcmn.o: $(COMMDIR)/appcmn.cpp +# $(CC) -c $(CPPFLAGS) -o $@ $*.cpp + +#appcmn.o: $(COMMDIR)/appcmn.cpp +# $(CC) $(CPPFLAGS) -c -o $@ $< + +cleanwx: + -$(RM) *.o + -$(RM) *.bak + -$(RM) core + -$(RM) ../common/y_tab.c + -$(RM) ../common/lex_yy.c + -$(RM) ../common/*.o + -$(RM) ../common/*.bak + -$(RM) ../generic/*.o + -$(RM) ../generic/*.bak + -$(RM) ../html/*.o + -$(RM) ../zlib/*.o + -$(RM) ../zlib/*.bak + -$(RM) ../png/*.o + -$(RM) ../png/*.bak + -$(RM) ../jpeg/*.o + -$(RM) ../jpeg/*.bak + -$(RM) ../tiff/*.o + -$(RM) ../tiff/*.bak diff --git a/src/msw/palette.cpp b/src/msw/palette.cpp index 724140c3aa..7d88c7fe72 100644 --- a/src/msw/palette.cpp +++ b/src/msw/palette.cpp @@ -75,7 +75,7 @@ bool wxPalette::Create(int n, const unsigned char *red, const unsigned char *gre { UnRef(); -#ifdef __WXWINE__ +#if defined(__WXWINE__) || defined(__WXMICROWIN__) return (FALSE); @@ -108,14 +108,21 @@ bool wxPalette::Create(int n, const unsigned char *red, const unsigned char *gre int wxPalette::GetPixel(const unsigned char red, const unsigned char green, const unsigned char blue) const { +#ifdef __WXMICROWIN__ + return FALSE; +#else if ( !m_refData ) return FALSE; return ::GetNearestPaletteIndex((HPALETTE) M_PALETTEDATA->m_hPalette, PALETTERGB(red, green, blue)); +#endif } bool wxPalette::GetRGB(int index, unsigned char *red, unsigned char *green, unsigned char *blue) const { +#ifdef __WXMICROWIN__ + return FALSE; +#else if ( !m_refData ) return FALSE; @@ -131,6 +138,7 @@ bool wxPalette::GetRGB(int index, unsigned char *red, unsigned char *green, unsi return TRUE; } else return FALSE; +#endif } void wxPalette::SetHPALETTE(WXHPALETTE pal) diff --git a/src/msw/pen.cpp b/src/msw/pen.cpp index b764f03bea..e07b7a1e76 100644 --- a/src/msw/pen.cpp +++ b/src/msw/pen.cpp @@ -157,7 +157,7 @@ bool wxPen::RealizeResource() // Join style, Cap style, Pen Stippling only on Win32. // Currently no time to find equivalent on Win3.1, sorry // [if such equiv exist!!] -#ifdef __WIN32__ +#if defined(__WIN32__) && !defined(__WXMICROWIN__) if (M_PENDATA->m_join==wxJOIN_ROUND && M_PENDATA->m_cap==wxCAP_ROUND && M_PENDATA->m_style!=wxUSER_DASH && @@ -405,6 +405,7 @@ int wx2msPenStyle(int wx_style) int cstyle; switch (wx_style) { +#if !defined(__WXMICROWIN__) case wxDOT: cstyle = PS_DOT; break; @@ -421,8 +422,10 @@ int wx2msPenStyle(int wx_style) case wxTRANSPARENT: cstyle = PS_NULL; break; +#endif case wxUSER_DASH: +#if !defined(__WXMICROWIN__) #ifdef __WIN32__ // Win32s doesn't have PS_USERSTYLE if (wxGetOsVersion()==wxWINDOWS_NT || wxGetOsVersion()==wxWIN95) @@ -431,6 +434,7 @@ int wx2msPenStyle(int wx_style) cstyle = PS_DOT; // We must make a choice... This is mine! #else cstyle = PS_DASH; +#endif #endif break; case wxSOLID: diff --git a/src/msw/region.cpp b/src/msw/region.cpp index cb214071d0..e051bb1277 100644 --- a/src/msw/region.cpp +++ b/src/msw/region.cpp @@ -43,7 +43,7 @@ public: wxRegionRefData(const wxRegionRefData& data) { -#if defined(__WIN32__) +#if defined(__WIN32__) && !defined(__WXMICROWIN__) DWORD noBytes = ::GetRegionData(data.m_region, 0, NULL); RGNDATA *rgnData = (RGNDATA*) new char[noBytes]; ::GetRegionData(data.m_region, noBytes, rgnData); diff --git a/src/msw/settings.cpp b/src/msw/settings.cpp index 133c23ab95..9c52e55569 100644 --- a/src/msw/settings.cpp +++ b/src/msw/settings.cpp @@ -40,6 +40,7 @@ #include "wx/window.h" #include "wx/msw/private.h" #include "wx/module.h" +#include "wx/fontutil.h" // ---------------------------------------------------------------------------- // private classes @@ -117,16 +118,8 @@ wxColour wxSystemSettings::GetSystemColour(int index) } } -wxFont wxSystemSettings::GetSystemFont(int index) +wxFont wxCreateFontFromStockObject(int index) { - // wxWindow ctor calls GetSystemFont(wxSYS_DEFAULT_GUI_FONT) so we're - // called fairly often - this is why we cache this particular font - bool isDefaultRequested = index == wxSYS_DEFAULT_GUI_FONT; - if ( isDefaultRequested && gs_fontDefault ) - { - return *gs_fontDefault; - } - wxFont font; HFONT hFont = (HFONT) ::GetStockObject(index); @@ -135,7 +128,16 @@ wxFont wxSystemSettings::GetSystemFont(int index) LOGFONT lf; if ( ::GetObject(hFont, sizeof(LOGFONT), &lf) != 0 ) { - font = wxCreateFontFromLogFont(&lf); + wxNativeFontInfo info; + info.lf = lf; + // Under MicroWindows we pass the HFONT as well + // because it's hard to convert HFONT -> LOGFONT -> HFONT + // It's OK to delete stock objects, the delete will be ignored. +#ifdef __WXMICROWIN__ + font.Create(info, (WXHFONT) hFont); +#else + font.Create(info); +#endif } else { @@ -146,6 +148,20 @@ wxFont wxSystemSettings::GetSystemFont(int index) { wxFAIL_MSG( _T("stock font not found") ); } + return font; +} + +wxFont wxSystemSettings::GetSystemFont(int index) +{ + // wxWindow ctor calls GetSystemFont(wxSYS_DEFAULT_GUI_FONT) so we're + // called fairly often - this is why we cache this particular font + bool isDefaultRequested = index == wxSYS_DEFAULT_GUI_FONT; + if ( isDefaultRequested && gs_fontDefault ) + { + return *gs_fontDefault; + } + + wxFont font = wxCreateFontFromStockObject(index); if ( isDefaultRequested ) { @@ -159,6 +175,10 @@ wxFont wxSystemSettings::GetSystemFont(int index) // Get a system metric, e.g. scrollbar size int wxSystemSettings::GetSystemMetric(int index) { +#ifdef __WXMICROWIN__ + // TODO: probably use wxUniv themes functionality + return 0; +#else switch ( index) { #ifdef __WIN32__ @@ -250,6 +270,8 @@ int wxSystemSettings::GetSystemMetric(int index) default: return 0; } +#endif + // __WXMICROWIN__ } // Option functions (arbitrary name/value mapping) diff --git a/src/msw/timer.cpp b/src/msw/timer.cpp index e999fd6924..17f1c17552 100644 --- a/src/msw/timer.cpp +++ b/src/msw/timer.cpp @@ -82,11 +82,18 @@ bool wxTimer::Start(int milliseconds, bool oneShot) wxCHECK_MSG( m_milli > 0, FALSE, wxT("invalid value for timer timeour") ); wxTimerList.DeleteObject(this); + +#ifdef __WXMICROWIN__ + m_id = SetTimer(NULL, (UINT)(m_id ? m_id : 1), + (UINT)milliseconds, (TIMERPROC) wxTimerProc); +#else TIMERPROC wxTimerProcInst = (TIMERPROC) MakeProcInstance((FARPROC)wxTimerProc, wxGetInstance()); m_id = SetTimer(NULL, (UINT)(m_id ? m_id : 1), (UINT)milliseconds, wxTimerProcInst); +#endif + if ( m_id > 0 ) { wxTimerList.Append(m_id, this); diff --git a/src/msw/utils.cpp b/src/msw/utils.cpp index dea7aeb352..b117cb09c1 100644 --- a/src/msw/utils.cpp +++ b/src/msw/utils.cpp @@ -41,7 +41,7 @@ // #include "wx/msw/private.h" which itself includes , as this // one in turn includes unless we define WIN32_LEAN_AND_MEAN. // -#if defined(__WIN32__) && !defined(__TWIN32__) && ! (defined(__GNUWIN32__) && !defined(__MINGW32__)) +#if defined(__WIN32__) && !defined(__TWIN32__) && !defined(__WXMICROWIN__) && ! (defined(__GNUWIN32__) && !defined(__MINGW32__)) extern "C" { #include // we use socket functions in wxGetFullHostName() } @@ -51,7 +51,7 @@ extern "C" { #include "wx/timer.h" -#if !defined(__GNUWIN32__) && !defined(__WXWINE__) && !defined(__SALFORDC__) +#if !defined(__GNUWIN32__) && !defined(__WXWINE__) && !defined(__SALFORDC__) && !defined(__WXMICROWIN__) #include #ifndef __MWERKS__ @@ -80,7 +80,7 @@ extern "C" { #include #endif // USE_NET_API -#if defined(__WIN32__) && !defined(__WXWINE__) +#if defined(__WIN32__) && !defined(__WXWINE__) && !defined(__WXMICROWIN__) #include #ifndef __GNUWIN32__ @@ -131,11 +131,13 @@ static const wxChar WX_SECTION[] = wxT("wxWindows"); static const wxChar eUSERNAME[] = wxT("UserName"); // these are only used under Win16 -#ifndef __WIN32__ +#if !defined(__WIN32__) && !defined(__WXMICROWIN__) static const wxChar eHOSTNAME[] = wxT("HostName"); static const wxChar eUSERID[] = wxT("UserId"); #endif // !Win32 +#ifndef __WXMICROWIN__ + // ============================================================================ // implementation // ============================================================================ @@ -147,7 +149,7 @@ static const wxChar eUSERID[] = wxT("UserId"); // Get hostname only (without domain name) bool wxGetHostName(wxChar *buf, int maxSize) { -#if defined(__WIN32__) && !defined(__TWIN32__) +#if defined(__WIN32__) && !defined(__TWIN32__) && !defined(__WXMICROWIN__) DWORD nSize = maxSize; if ( !::GetComputerName(buf, &nSize) ) { @@ -173,7 +175,7 @@ bool wxGetHostName(wxChar *buf, int maxSize) // get full hostname (with domain name if possible) bool wxGetFullHostName(wxChar *buf, int maxSize) { -#if defined(__WIN32__) && !defined(__TWIN32__) && ! (defined(__GNUWIN32__) && !defined(__MINGW32__)) +#if defined(__WIN32__) && !defined(__TWIN32__) && !defined(__WXMICROWIN__) && ! (defined(__GNUWIN32__) && !defined(__MINGW32__)) // TODO should use GetComputerNameEx() when available WSADATA wsa; if ( WSAStartup(MAKEWORD(1, 1), &wsa) == 0 ) @@ -218,7 +220,7 @@ bool wxGetFullHostName(wxChar *buf, int maxSize) // Get user ID e.g. jacs bool wxGetUserId(wxChar *buf, int maxSize) { -#if defined(__WIN32__) && !defined(__win32s__) && !defined(__TWIN32__) +#if defined(__WIN32__) && !defined(__win32s__) && !defined(__TWIN32__) && !defined(__WXMICROWIN__) DWORD nSize = maxSize; if ( ::GetUserName(buf, &nSize) == 0 ) { @@ -423,7 +425,9 @@ wxChar *wxGetUserHome(const wxString& WXUNUSED(user)) bool wxDirExists(const wxString& dir) { -#if defined(__WIN32__) +#ifdef __WXMICROWIN__ + return wxPathExist(dir); +#elif defined(__WIN32__) DWORD attribs = GetFileAttributes(dir); return ((attribs != (DWORD)-1) && (attribs & FILE_ATTRIBUTE_DIRECTORY)); #else // Win16 @@ -926,6 +930,8 @@ void wxSleep(int nSecs) } #endif // wxUSE_GUI/!wxUSE_GUI +#endif + // __WXMICROWIN__ // ---------------------------------------------------------------------------- // deprecated (in favour of wxLog) log functions @@ -934,6 +940,7 @@ void wxSleep(int nSecs) #if wxUSE_GUI // Output a debug mess., in a system dependent fashion. +#ifndef __WXMICROWIN__ void wxDebugMsg(const wxChar *fmt ...) { va_list ap; @@ -965,6 +972,7 @@ void wxFatalError(const wxString& msg, const wxString& title) wxSprintf(wxBuffer, wxT("%s: %s"), WXSTRINGCAST title, WXSTRINGCAST msg); FatalAppExit(0, (LPCTSTR)wxBuffer); } +#endif // __WXMICROWIN__ // ---------------------------------------------------------------------------- // functions to work with .INI files @@ -1091,7 +1099,9 @@ void wxBeginBusyCursor(wxCursor *cursor) if ( gs_wxBusyCursorCount++ == 0 ) { gs_wxBusyCursor = (HCURSOR)cursor->GetHCURSOR(); +#ifndef __WXMICROWIN__ gs_wxBusyCursorOld = ::SetCursor(gs_wxBusyCursor); +#endif } //else: nothing to do, already set } @@ -1104,8 +1114,9 @@ void wxEndBusyCursor() if ( --gs_wxBusyCursorCount == 0 ) { +#ifndef __WXMICROWIN__ ::SetCursor(gs_wxBusyCursorOld); - +#endif gs_wxBusyCursorOld = 0; } } @@ -1135,6 +1146,7 @@ bool wxCheckForInterrupt(wxWindow *wnd) // MSW only: get user-defined resource from the .res file. // Returns NULL or newly-allocated memory, so use delete[] to clean up. +#ifndef __WXMICROWIN__ wxChar *wxLoadUserResource(const wxString& resourceName, const wxString& resourceType) { HRSRC hResource = ::FindResource(wxGetInstance(), resourceName, resourceType); @@ -1168,6 +1180,7 @@ wxChar *wxLoadUserResource(const wxString& resourceName, const wxString& resourc return s; } +#endif // ---------------------------------------------------------------------------- // get display info @@ -1186,6 +1199,10 @@ void wxGetMousePosition( int* x, int* y ) // Return TRUE if we have a colour display bool wxColourDisplay() { +#ifdef __WXMICROWIN__ + // MICROWIN_TODO + return TRUE; +#else // this function is called from wxDC ctor so it is called a *lot* of times // hence we optimize it a bit but doign the check only once // @@ -1202,6 +1219,7 @@ bool wxColourDisplay() } return s_isColour != 0; +#endif } // Returns depth of screen @@ -1214,23 +1232,33 @@ int wxDisplayDepth() // Get size of display void wxDisplaySize(int *width, int *height) { +#ifdef __WXMICROWIN__ + // MICROWIN_TODO + *width = 0; * height = 0; +#else ScreenHDC dc; if ( width ) *width = GetDeviceCaps(dc, HORZRES); if ( height ) *height = GetDeviceCaps(dc, VERTRES); +#endif } void wxDisplaySizeMM(int *width, int *height) { +#ifdef __WXMICROWIN__ + // MICROWIN_TODO + *width = 0; * height = 0; +#else ScreenHDC dc; if ( width ) *width = GetDeviceCaps(dc, HORZSIZE); if ( height ) *height = GetDeviceCaps(dc, VERTSIZE); +#endif } void wxClientDisplayRect(int *x, int *y, int *width, int *height) { -#ifdef __WIN16__ +#if defined(__WIN16__) || defined(__WXMICROWIN__) *x = 0; *y = 0; wxDisplaySize(width, height); #else @@ -1263,6 +1291,10 @@ wxString WXDLLEXPORT wxGetWindowText(WXHWND hWnd) wxString WXDLLEXPORT wxGetWindowClass(WXHWND hWnd) { +#ifdef __WXMICROWIN__ + // MICROWIN_TODO + return wxEmptyString; +#else wxString str; int len = 256; // some starting value @@ -1302,6 +1334,7 @@ wxString WXDLLEXPORT wxGetWindowClass(WXHWND hWnd) } return str; +#endif } WXWORD WXDLLEXPORT wxGetWindowId(WXHWND hWnd) @@ -1576,4 +1609,13 @@ void wxRedirectIOToConsole() } #endif +#ifdef __WXMICROWIN__ +int wxGetOsVersion(int *majorVsn, int *minorVsn) +{ + // MICROWIN_TODO + if (majorVsn) *majorVsn = 0; + if (minorVsn) *minorVsn = 0; + return wxUNIX; +} +#endif diff --git a/src/msw/utilsexc.cpp b/src/msw/utilsexc.cpp index 628d647ac2..e63bb93ba0 100644 --- a/src/msw/utilsexc.cpp +++ b/src/msw/utilsexc.cpp @@ -45,7 +45,7 @@ #include -#if !defined(__GNUWIN32__) && !defined(__WXWINE__) && !defined(__SALFORDC__) +#if !defined(__GNUWIN32__) && !defined(__WXWINE__) && !defined(__SALFORDC__) && !defined(__WXMICROWIN__) #include #ifndef __MWERKS__ #include @@ -57,7 +57,7 @@ #include #endif -#if defined(__WIN32__) && !defined(__WXWINE__) +#if defined(__WIN32__) && !defined(__WXWINE__) && !defined(__WXMICROWIN__) #include #ifndef __GNUWIN32__ diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 814fb2bf6e..91191899b5 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -84,7 +84,7 @@ #include -#if !defined(__GNUWIN32_OLD__) || defined(__CYGWIN10__) +#if (!defined(__GNUWIN32_OLD__) && !defined(__WXMICROWIN__)) || defined(__CYGWIN10__) #include #include #endif @@ -93,11 +93,11 @@ #include #endif -#if (!defined(__GNUWIN32_OLD__) && !defined(__TWIN32__)) || defined(__CYGWIN10__) +#if (!defined(__GNUWIN32_OLD__) && !defined(__TWIN32__) && !defined(__WXMICROWIN__)) || defined(__CYGWIN10__) #ifdef __WIN95__ #include #endif -#else // broken compiler +#elif !defined(__WXMICROWIN__) // broken compiler #ifndef __TWIN32__ #include "wx/msw/gnuwin32/extra.h" #endif @@ -740,7 +740,11 @@ int wxWindowMSW::GetScrollPos(int orient) const HWND hWnd = GetHwnd(); if ( hWnd ) { +#ifdef __WXMICROWIN__ + return ::GetScrollPosWX(hWnd, wOrient); +#else return ::GetScrollPos(hWnd, wOrient); +#endif } else return 0; @@ -1883,9 +1887,11 @@ void wxWindowMSW::UnpackScroll(WXWPARAM wParam, WXLPARAM lParam, void wxWindowMSW::UnpackCtlColor(WXWPARAM wParam, WXLPARAM lParam, WXWORD *nCtlColor, WXHDC *hdc, WXHWND *hwnd) { +#ifndef __WXMICROWIN__ *nCtlColor = CTLCOLOR_BTN; *hwnd = (WXHWND)lParam; *hdc = (WXHDC)wParam; +#endif } void wxWindowMSW::UnpackMenuSelect(WXWPARAM wParam, WXLPARAM lParam, @@ -2145,6 +2151,7 @@ long wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam wParam); break; +#ifdef MM_JOY1MOVE // __WXMICROWIN__ case MM_JOY1MOVE: case MM_JOY2MOVE: case MM_JOY1ZMOVE: @@ -2158,6 +2165,7 @@ long wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam GET_Y_LPARAM(lParam), wParam); break; +#endif case WM_SYSCOMMAND: processed = HandleSysCommand(wParam, lParam); @@ -2180,6 +2188,7 @@ long wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam #endif // Win95 // for these messages we must return TRUE if process the message +#ifdef WM_DRAWITEM // __WXMICROWIN__ case WM_DRAWITEM: case WM_MEASUREITEM: { @@ -2199,7 +2208,7 @@ long wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam rc.result = TRUE; } break; - +#endif case WM_GETDLGCODE: if ( m_lDlgCode ) { @@ -2307,7 +2316,8 @@ long wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam break; // CTLCOLOR messages are sent by children to query the parent for their - // colors + // colors#ifndef __WXMICROWIN__ +#ifndef __WXMICROWIN__ #ifdef __WIN32__ case WM_CTLCOLORMSGBOX: case WM_CTLCOLOREDIT: @@ -2334,6 +2344,7 @@ long wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam lParam); } break; +#endif // the return value for this message is ignored case WM_SYSCOLORCHANGE: @@ -2397,7 +2408,7 @@ long wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam } break; -#ifdef __WIN32__ +#if defined(__WIN32__) && defined(WM_HELP) case WM_HELP: { HELPINFO* info = (HELPINFO*) lParam; @@ -2636,6 +2647,7 @@ bool wxWindowMSW::MSWCreate(int id, if ( dialog_template ) { +#ifndef __WXMICROWIN__ // for the dialogs without wxDIALOG_NO_PARENT style, use the top level // app window as parent - this avoids creating modal dialogs without // parent @@ -2707,6 +2719,9 @@ bool wxWindowMSW::MSWCreate(int id, { wxLogLastError(wxT("MoveWindow")); } +#endif + // __WXMICROWIN__ + } else // creating a normal window, not a dialog { @@ -2779,6 +2794,7 @@ bool wxWindowMSW::MSWCreate(int id, // FIXME: VZ: I'm not sure at all that the order of processing is correct bool wxWindowMSW::HandleNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) { +#ifndef __WXMICROWIN__ LPNMHDR hdr = (LPNMHDR)lParam; HWND hWnd = hdr->hwndFrom; wxWindow *win = wxFindWinFromHandle((WXHWND)hWnd); @@ -2804,6 +2820,9 @@ bool wxWindowMSW::HandleNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) // finally try this window too (catches toolbar case) return MSWOnNotify(idCtrl, lParam, result); +#else + return FALSE; +#endif } bool wxWindowMSW::MSWOnNotify(int WXUNUSED(idCtrl), @@ -3004,6 +3023,7 @@ bool wxWindowMSW::HandleInitDialog(WXHWND WXUNUSED(hWndFocus)) bool wxWindowMSW::HandleDropFiles(WXWPARAM wParam) { +#ifndef __WXMICROWIN__ HDROP hFilesInfo = (HDROP) wParam; POINT dropPoint; DragQueryPoint(hFilesInfo, (LPPOINT) &dropPoint); @@ -3035,12 +3055,16 @@ bool wxWindowMSW::HandleDropFiles(WXWPARAM wParam) delete[] files; return rc; +#else + return FALSE; +#endif } bool wxWindowMSW::HandleSetCursor(WXHWND WXUNUSED(hWnd), short nHitTest, int WXUNUSED(mouseMsg)) { +#ifndef __WXMICROWIN__ // the logic is as follows: // -1. don't set cursor for non client area, including but not limited to // the title bar, scrollbars, &c @@ -3117,7 +3141,7 @@ bool wxWindowMSW::HandleSetCursor(WXHWND WXUNUSED(hWnd), // cursor set, stop here return TRUE; } - +#endif // pass up the window chain return FALSE; } @@ -3213,6 +3237,7 @@ bool wxWindowMSW::HandleCtlColor(WXHBRUSH *brush, WXWPARAM wParam, WXLPARAM lParam) { +#ifndef __WXMICROWIN__ WXHBRUSH hBrush = 0; if ( nCtlColor == CTLCOLOR_DLG ) @@ -3232,6 +3257,9 @@ bool wxWindowMSW::HandleCtlColor(WXHBRUSH *brush, *brush = hBrush; return hBrush != 0; +#else + return FALSE; +#endif } // Define for each class of dialog and control @@ -4222,6 +4250,8 @@ extern wxWindow *wxGetWindowFromHWND(WXHWND hWnd) return win; } +#ifndef __WXMICROWIN__ + // Windows keyboard hook. Allows interception of e.g. F1, ESCAPE // in active frames and dialogs, regardless of where the focus is. static HHOOK wxTheKeyboardHook = 0; @@ -4298,6 +4328,7 @@ wxKeyboardHook(int nCode, WORD wParam, DWORD lParam) return (int)CallNextHookEx(wxTheKeyboardHook, nCode, wParam, lParam); } +#endif #ifdef __WXDEBUG__ const char *wxGetMessageName(int message) -- 2.45.2