Fixed compilation for when not including <windows.h>

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1599 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
1999-02-04 21:12:30 +00:00
parent 45b776d452
commit 17b74d79ad
6 changed files with 56 additions and 46 deletions

View File

@@ -81,36 +81,10 @@ public:
// without having to deal with nasty IDispatch pointers. // without having to deal with nasty IDispatch pointers.
bool GetObject(wxAutomationObject& obj, const wxString& property, int noArgs = 0, wxVariant args[] = (wxVariant*) NULL) const; bool GetObject(wxAutomationObject& obj, const wxString& property, int noArgs = 0, wxVariant args[] = (wxVariant*) NULL) const;
// Convert variants
static bool ConvertVariantToOle(const wxVariant& variant, VARIANTARG& oleVariant) ;
static bool ConvertOleToVariant(const VARIANTARG& oleVariant, wxVariant& variant) ;
public: public:
WXIDISPATCH* m_dispatchPtr; WXIDISPATCH* m_dispatchPtr;
}; };
// wrapper around BSTR type (by Vadim Zeitlin)
class WXDLLEXPORT BasicString
{
public:
// ctors & dtor
BasicString(const char *sz);
~BasicString();
// accessors
// just get the string
operator BSTR() const { return m_wzBuf; }
// retrieve a copy of our string - caller must SysFreeString() it later!
BSTR Get() const { return SysAllocString(m_wzBuf); }
private:
// @@@ not implemented (but should be)
BasicString(const BasicString&);
BasicString& operator=(const BasicString&);
OLECHAR *m_wzBuf; // actual string
};
#endif #endif
// _WX_AUTOMTN_H_ // _WX_AUTOMTN_H_

View File

@@ -31,7 +31,7 @@
// Comment this out if you don't mind slower compilation of the wxWindows // Comment this out if you don't mind slower compilation of the wxWindows
// library // library
#if !defined(__WXMAC__) && !defined(__SALFORDC__) #if !defined(__WXMAC__) && !defined(__SALFORDC__)
#include <windows.h> // #include <windows.h>
#endif #endif
#ifdef GetClassInfo #ifdef GetClassInfo

View File

@@ -42,9 +42,7 @@
#pragma hdrstop #pragma hdrstop
#endif #endif
#ifndef WX_PRECOMP
#include "wx/wx.h" #include "wx/wx.h"
#endif
#ifdef new #ifdef new
#undef new #undef new
@@ -60,8 +58,6 @@
#include "mfctest.h" #include "mfctest.h"
#include "wx/wx.h"
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// theApp: // theApp:
@@ -95,7 +91,7 @@ class MyChild: public wxFrame
MyCanvas *canvas; MyCanvas *canvas;
MyChild(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size, const long style); MyChild(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size, const long style);
~MyChild(void); ~MyChild(void);
Bool OnClose(void); bool OnClose(void);
void OnQuit(wxCommandEvent& event); void OnQuit(wxCommandEvent& event);
void OnNew(wxCommandEvent& event); void OnNew(wxCommandEvent& event);
@@ -269,7 +265,7 @@ bool MyApp::OnInit(void)
wxFrame *MyApp::CreateFrame(void) wxFrame *MyApp::CreateFrame(void)
{ {
MyChild *subframe = new MyChild(NULL, "Canvas Frame", wxPoint(10, 10), wxSize(300, 300), MyChild *subframe = new MyChild(NULL, "Canvas Frame", wxPoint(10, 10), wxSize(300, 300),
wxDEFAULT_FRAME); wxDEFAULT_FRAME_STYLE);
subframe->SetTitle("wxWindows canvas frame"); subframe->SetTitle("wxWindows canvas frame");
@@ -294,7 +290,7 @@ wxFrame *MyApp::CreateFrame(void)
MyCanvas *canvas = new MyCanvas(subframe, wxPoint(0, 0), wxSize(width, height)); MyCanvas *canvas = new MyCanvas(subframe, wxPoint(0, 0), wxSize(width, height));
wxCursor *cursor = new wxCursor(wxCURSOR_PENCIL); wxCursor *cursor = new wxCursor(wxCURSOR_PENCIL);
canvas->SetCursor(cursor); canvas->SetCursor(*cursor);
subframe->canvas = canvas; subframe->canvas = canvas;
// Give it scrollbars // Give it scrollbars
@@ -321,13 +317,13 @@ void MyCanvas::OnPaint(wxPaintEvent& event)
{ {
wxPaintDC dc(this); wxPaintDC dc(this);
dc.SetFont(small_font); dc.SetFont(* small_font);
dc.SetPen(wxGREEN_PEN); dc.SetPen(* wxGREEN_PEN);
dc.DrawLine(0, 0, 200, 200); dc.DrawLine(0, 0, 200, 200);
dc.DrawLine(200, 0, 0, 200); dc.DrawLine(200, 0, 0, 200);
dc.SetBrush(wxCYAN_BRUSH); dc.SetBrush(* wxCYAN_BRUSH);
dc.SetPen(wxRED_PEN); dc.SetPen(* wxRED_PEN);
dc.DrawRectangle(100, 100, 100, 50); dc.DrawRectangle(100, 100, 100, 50);
dc.DrawRoundedRectangle(150, 150, 100, 50, 20); dc.DrawRoundedRectangle(150, 150, 100, 50, 20);
@@ -342,7 +338,7 @@ void MyCanvas::OnPaint(wxPaintEvent& event)
void MyCanvas::OnMouseEvent(wxMouseEvent& event) void MyCanvas::OnMouseEvent(wxMouseEvent& event)
{ {
wxClientDC dc(this); wxClientDC dc(this);
dc.SetPen(wxBLACK_PEN); dc.SetPen(* wxBLACK_PEN);
long x, y; long x, y;
event.Position(&x, &y); event.Position(&x, &y);
if (xpos > -1 && ypos > -1 && event.Dragging()) if (xpos > -1 && ypos > -1 && event.Dragging())
@@ -387,7 +383,7 @@ void MyChild::OnActivate(wxActivateEvent& event)
canvas->SetFocus(); canvas->SetFocus();
} }
Bool MyChild::OnClose(void) bool MyChild::OnClose(void)
{ {
return TRUE; return TRUE;
} }

View File

@@ -29,6 +29,37 @@
#include <math.h> #include <math.h>
#include <time.h> #include <time.h>
#ifdef GetObject
#undef GetObject
#endif
// wrapper around BSTR type (by Vadim Zeitlin)
class WXDLLEXPORT BasicString
{
public:
// ctors & dtor
BasicString(const char *sz);
~BasicString();
// accessors
// just get the string
operator BSTR() const { return m_wzBuf; }
// retrieve a copy of our string - caller must SysFreeString() it later!
BSTR Get() const { return SysAllocString(m_wzBuf); }
private:
// @@@ not implemented (but should be)
BasicString(const BasicString&);
BasicString& operator=(const BasicString&);
OLECHAR *m_wzBuf; // actual string
};
// Convert variants
static bool ConvertVariantToOle(const wxVariant& variant, VARIANTARG& oleVariant) ;
static bool ConvertOleToVariant(const VARIANTARG& oleVariant, wxVariant& variant) ;
// Convert string to Unicode // Convert string to Unicode
static BSTR ConvertStringToOle(const wxString& str); static BSTR ConvertStringToOle(const wxString& str);
@@ -484,7 +515,7 @@ bool wxAutomationObject::CreateInstance(const wxString& classId) const
} }
bool wxAutomationObject::ConvertVariantToOle(const wxVariant& variant, VARIANTARG& oleVariant) bool ConvertVariantToOle(const wxVariant& variant, VARIANTARG& oleVariant)
{ {
ClearVariant(&oleVariant); ClearVariant(&oleVariant);
if (variant.IsNull()) if (variant.IsNull())
@@ -601,7 +632,7 @@ bool wxAutomationObject::ConvertVariantToOle(const wxVariant& variant, VARIANTAR
#define VT_TYPEMASK 0xfff #define VT_TYPEMASK 0xfff
#endif #endif
bool wxAutomationObject::ConvertOleToVariant(const VARIANTARG& oleVariant, wxVariant& variant) bool ConvertOleToVariant(const VARIANTARG& oleVariant, wxVariant& variant)
{ {
switch (oleVariant.vt & VT_TYPEMASK) switch (oleVariant.vt & VT_TYPEMASK)
{ {

View File

@@ -32,15 +32,19 @@
#if defined(__WIN32__) && !defined(__GNUWIN32__) #if defined(__WIN32__) && !defined(__GNUWIN32__)
#include <wx/log.h> #include <wx/log.h>
#include <wx/msw/ole/oleutils.h> #include <wx/msw/ole/dataobj.h>
#include <wx/msw/ole/dataobj.h>
#include <windows.h>
#include <oleauto.h>
#ifndef __WIN32__ #ifndef __WIN32__
#include <ole2.h> #include <ole2.h>
#include <olestd.h> #include <olestd.h>
#endif #endif
#include <wx/msw/ole/oleutils.h>
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// functions // functions
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@@ -33,15 +33,20 @@
#if wxUSE_DRAG_AND_DROP #if wxUSE_DRAG_AND_DROP
#include <wx/log.h> #include <wx/log.h>
#include <wx/msw/ole/oleutils.h>
#include <wx/msw/ole/dataobj.h> #include <wx/msw/ole/dataobj.h>
#include <wx/msw/ole/dropsrc.h> #include <wx/msw/ole/dropsrc.h>
#include <windows.h>
#ifndef __WIN32__ #ifndef __WIN32__
#include <ole2.h> #include <ole2.h>
#include <olestd.h> #include <olestd.h>
#endif #endif
#include <oleauto.h>
#include <wx/msw/ole/oleutils.h>
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxIDropSource implementation of IDropSource interface // wxIDropSource implementation of IDropSource interface
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------