merged 2.2 branch
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@7748 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -16,6 +16,8 @@
|
||||
#include <stdio.h>
|
||||
#include "wx/setup.h"
|
||||
#include "wx/window.h"
|
||||
#include "wx/app.h"
|
||||
#include "wx/frame.h"
|
||||
#endif
|
||||
|
||||
#include "wx/os2/accel.h"
|
||||
@@ -42,59 +44,127 @@ protected:
|
||||
|
||||
wxAcceleratorRefData::wxAcceleratorRefData()
|
||||
{
|
||||
// TODO
|
||||
/*
|
||||
HACCEL m_hAccel;
|
||||
*/
|
||||
}
|
||||
m_ok = FALSE;
|
||||
m_hAccel = 0;
|
||||
} // end of wxAcceleratorRefData::wxAcceleratorRefData
|
||||
|
||||
wxAcceleratorRefData::~wxAcceleratorRefData()
|
||||
{
|
||||
/*
|
||||
if (m_hAccel)
|
||||
{
|
||||
DestroyAcceleratorTable((HACCEL) m_hAccel);
|
||||
}
|
||||
m_hAccel = 0 ;
|
||||
*/
|
||||
}
|
||||
if (m_hAccel)
|
||||
{
|
||||
WinDestroyAccelTable((HACCEL) m_hAccel);
|
||||
}
|
||||
m_hAccel = 0 ;
|
||||
} // end of wxAcceleratorRefData::~wxAcceleratorRefData
|
||||
|
||||
wxAcceleratorTable::wxAcceleratorTable()
|
||||
{
|
||||
m_refData = NULL;
|
||||
}
|
||||
m_refData = NULL;
|
||||
} // end of wxAcceleratorTable::wxAcceleratorTable
|
||||
|
||||
wxAcceleratorTable::~wxAcceleratorTable()
|
||||
{
|
||||
}
|
||||
} // end of wxAcceleratorTable::~wxAcceleratorTable
|
||||
|
||||
// Load from .rc resource
|
||||
wxAcceleratorTable::wxAcceleratorTable(const wxString& resource)
|
||||
wxAcceleratorTable::wxAcceleratorTable(
|
||||
const wxString& rResource
|
||||
)
|
||||
{
|
||||
HACCEL hAccel;
|
||||
ULONG ulId;
|
||||
|
||||
m_refData = new wxAcceleratorRefData;
|
||||
|
||||
/* TODO: load acelerator from resource, if appropriate for your platform
|
||||
ulId = atol((char*)rResource.c_str());
|
||||
hAccel = ::WinLoadAccelTable( vHabmain
|
||||
,NULL // resources always in .exe
|
||||
,(ULONG)ulId
|
||||
);
|
||||
if (wxTheApp->GetTopWindow() != NULL)
|
||||
{
|
||||
//
|
||||
// If we have accelerators the top window is the frame
|
||||
//
|
||||
wxFrame* pFrame = (wxFrame*)wxTheApp->GetTopWindow();
|
||||
|
||||
::WinSetAccelTable( vHabmain
|
||||
,(HWND)pFrame->GetFrame()
|
||||
,hAccel
|
||||
);
|
||||
}
|
||||
M_ACCELDATA->m_hAccel = hAccel;
|
||||
M_ACCELDATA->m_ok = (hAccel != 0);
|
||||
*/
|
||||
}
|
||||
|
||||
extern int wxCharCodeWXToOS2(int id, bool *isVirtual);
|
||||
extern int wxCharCodeWXToOS2(
|
||||
int nId
|
||||
, bool* pbIsVirtual
|
||||
);
|
||||
|
||||
// Create from an array
|
||||
wxAcceleratorTable::wxAcceleratorTable(int n, wxAcceleratorEntry entries[])
|
||||
wxAcceleratorTable::wxAcceleratorTable(
|
||||
int n
|
||||
, wxAcceleratorEntry vaEntries[]
|
||||
)
|
||||
{
|
||||
m_refData = new wxAcceleratorRefData;
|
||||
int nAccelLength = ((sizeof(ACCEL) * n) + sizeof(ACCELTABLE));
|
||||
PACCELTABLE pArr;
|
||||
int i;
|
||||
|
||||
/* TODO: create table from entries
|
||||
*/
|
||||
}
|
||||
m_refData = new wxAcceleratorRefData;
|
||||
pArr = (PACCELTABLE) new BYTE[nAccelLength];
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
USHORT uVirt = AF_CHAR;
|
||||
|
||||
if (vaEntries[i].GetFlags() & wxACCEL_ALT)
|
||||
uVirt |= AF_ALT;
|
||||
if (vaEntries[i].GetFlags() & wxACCEL_SHIFT)
|
||||
uVirt |= AF_SHIFT;
|
||||
if (vaEntries[i].GetFlags() & wxACCEL_CTRL)
|
||||
uVirt |= AF_CONTROL;
|
||||
|
||||
bool bIsVirtual;
|
||||
USHORT uKey = wxCharCodeWXToOS2( vaEntries[i].GetKeyCode()
|
||||
,&bIsVirtual
|
||||
);
|
||||
if (bIsVirtual)
|
||||
uVirt = AF_CHAR | AF_VIRTUALKEY;
|
||||
|
||||
USHORT uCmd = vaEntries[i].GetCommand();
|
||||
|
||||
pArr->aaccel[i].fs = uVirt;
|
||||
pArr->aaccel[i].key = uKey;
|
||||
pArr->aaccel[i].cmd = uCmd;
|
||||
}
|
||||
pArr->codepage = 437; // default to english Fix???
|
||||
pArr->cAccel = (USHORT)n;
|
||||
M_ACCELDATA->m_hAccel = ::WinCreateAccelTable( vHabmain
|
||||
,pArr
|
||||
);
|
||||
if (wxTheApp->GetTopWindow() != NULL)
|
||||
{
|
||||
//
|
||||
// If we have accelerators the top window is the frame
|
||||
//
|
||||
wxFrame* pFrame = (wxFrame*)wxTheApp->GetTopWindow();
|
||||
|
||||
::WinSetAccelTable( vHabmain
|
||||
,(HWND)pFrame->GetFrame()
|
||||
,M_ACCELDATA->m_hAccel
|
||||
);
|
||||
}
|
||||
|
||||
delete[] pArr;
|
||||
M_ACCELDATA->m_ok = (M_ACCELDATA->m_hAccel != 0);
|
||||
} // end of wxAcceleratorTable::wxAcceleratorTable
|
||||
|
||||
bool wxAcceleratorTable::Ok() const
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
return(M_ACCELDATA && (M_ACCELDATA->m_ok));
|
||||
} // end of wxAcceleratorTable::Ok
|
||||
|
||||
void wxAcceleratorTable::SetHACCEL(WXHACCEL hAccel)
|
||||
{
|
||||
@@ -111,14 +181,17 @@ WXHACCEL wxAcceleratorTable::GetHACCEL() const
|
||||
return (WXHACCEL) M_ACCELDATA->m_hAccel;
|
||||
}
|
||||
|
||||
bool wxAcceleratorTable::Translate(wxWindow *window, WXMSG *wxmsg) const
|
||||
bool wxAcceleratorTable::Translate(
|
||||
WXHWND hWnd
|
||||
, WXMSG* pWxmsg
|
||||
) const
|
||||
{
|
||||
// TODO:
|
||||
/*
|
||||
MSG *msg = (MSG *)wxmsg;
|
||||
PQMSG pMsg = (PQMSG)pWxmsg;
|
||||
|
||||
return Ok() && ::TranslateAccelerator(GetHwndOf(window), GetHaccel(), msg);
|
||||
*/
|
||||
return FALSE;
|
||||
}
|
||||
return Ok() && ::WinTranslateAccel( vHabmain
|
||||
,(HWND)hWnd
|
||||
,GetHaccel()
|
||||
,pMsg
|
||||
);
|
||||
} // end of wxAcceleratorTable::Translate
|
||||
|
||||
|
||||
@@ -63,7 +63,6 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
extern wxChar* wxBuffer;
|
||||
extern wxChar* wxOsVersion;
|
||||
extern wxList* wxWinHandleList;
|
||||
extern wxList WXDLLEXPORT wxPendingDelete;
|
||||
extern wxCursor* g_globalCursor;
|
||||
@@ -136,10 +135,6 @@ bool wxApp::Initialize(
|
||||
|
||||
wxClassInfo::InitializeClasses();
|
||||
|
||||
#if wxUSE_RESOURCES
|
||||
wxGetResource(wxT("wxWindows"), wxT("OsVersion"), &wxOsVersion);
|
||||
#endif
|
||||
|
||||
#if wxUSE_THREADS
|
||||
wxPendingEventsLocker = new wxCriticalSection;
|
||||
#endif
|
||||
@@ -189,7 +184,7 @@ bool wxApp::RegisterWindowClasses(
|
||||
if (!::WinRegisterClass( vHab
|
||||
,wxFrameClassName
|
||||
,(PFNWP)wxWndProc
|
||||
,CS_SIZEREDRAW | CS_SYNCPAINT
|
||||
,CS_SIZEREDRAW | CS_MOVENOTIFY | CS_SYNCPAINT
|
||||
,sizeof(ULONG)
|
||||
))
|
||||
{
|
||||
@@ -215,7 +210,7 @@ bool wxApp::RegisterWindowClasses(
|
||||
if (!::WinRegisterClass( vHab
|
||||
,wxMDIFrameClassName
|
||||
,(PFNWP)wxWndProc
|
||||
,CS_SIZEREDRAW | CS_SYNCPAINT
|
||||
,CS_SIZEREDRAW | CS_MOVENOTIFY | CS_SYNCPAINT
|
||||
,0
|
||||
))
|
||||
{
|
||||
@@ -555,7 +550,7 @@ bool wxApp::DoMessage()
|
||||
{
|
||||
BOOL bRc = ::WinGetMsg(vHabmain, &svCurrentMsg, HWND(NULL), 0, 0);
|
||||
|
||||
wxUsleep(1000);
|
||||
// wxUsleep(1000);
|
||||
if (bRc == 0)
|
||||
{
|
||||
// got WM_QUIT
|
||||
@@ -703,8 +698,8 @@ bool wxApp::ProcessMessage(
|
||||
WXMSG* pWxmsg
|
||||
)
|
||||
{
|
||||
QMSG* vMsg = (PQMSG)pWxmsg;
|
||||
HWND hWnd = vMsg->hwnd;
|
||||
QMSG* pMsg = (PQMSG)pWxmsg;
|
||||
HWND hWnd = pMsg->hwnd;
|
||||
wxWindow* pWndThis = wxFindWinFromHandle((WXHWND)hWnd);
|
||||
wxWindow* pWnd;
|
||||
|
||||
@@ -713,7 +708,7 @@ bool wxApp::ProcessMessage(
|
||||
// We must relay WM_MOUSEMOVE events to the tooltip ctrl if we want it to
|
||||
// popup the tooltip bubbles
|
||||
//
|
||||
if (pWndThis && (vMsg->msg == WM_MOUSEMOVE))
|
||||
if (pWndThis && (pMsg->msg == WM_MOUSEMOVE))
|
||||
{
|
||||
wxToolTip* pToolTip = pWndThis->GetToolTip();
|
||||
if (pToolTip)
|
||||
@@ -734,6 +729,18 @@ bool wxApp::ProcessMessage(
|
||||
pWndThis = wxFindWinFromHandle((WXHWND)hWnd);
|
||||
}
|
||||
|
||||
//
|
||||
// Try translations first; find the youngest window with
|
||||
// a translation table.
|
||||
//
|
||||
#if 0
|
||||
for (pWnd = pWndThis; pWnd; pWnd = pWnd->GetParent() )
|
||||
{
|
||||
if (pMsg->msg == WM_CHAR)
|
||||
if (pWnd->OS2TranslateMessage(pWxmsg))
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
//
|
||||
// Anyone for a non-translation message? Try youngest descendants first.
|
||||
//
|
||||
|
||||
@@ -36,12 +36,6 @@ wxCursor *g_globalCursor = NULL;
|
||||
// Message Strings for Internationalization
|
||||
char **wx_msg_str = (char**)NULL;
|
||||
|
||||
// Custom OS version, as optionally placed in wx.ini/.wxrc
|
||||
// Currently this can be Win95, Windows, Win32s, WinNT.
|
||||
// For some systems, you can't tell until run-time what services you
|
||||
// have. See wxGetOsVersion, which uses this string if present.
|
||||
char *wxOsVersion = NULL;
|
||||
|
||||
int wxPageNumber;
|
||||
|
||||
// GDI Object Lists
|
||||
|
||||
191
src/os2/dc.cpp
191
src/os2/dc.cpp
@@ -42,6 +42,18 @@ static const int VIEWPORT_EXTENT = 1000;
|
||||
static const int MM_POINTS = 9;
|
||||
static const int MM_METRIC = 10;
|
||||
|
||||
// usually this is defined in math.h
|
||||
#ifndef M_PI
|
||||
static const double M_PI = 3.14159265358979323846;
|
||||
#endif // M_PI
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// private functions
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// convert degrees to radians
|
||||
static inline double DegToRad(double deg) { return (deg * M_PI) / 180.0; }
|
||||
|
||||
// ===========================================================================
|
||||
// implementation
|
||||
// ===========================================================================
|
||||
@@ -52,17 +64,17 @@ static const int MM_METRIC = 10;
|
||||
|
||||
wxDC::wxDC(void)
|
||||
{
|
||||
m_canvas = NULL;
|
||||
m_pCanvas = NULL;
|
||||
|
||||
m_oldBitmap = 0;
|
||||
m_oldPen = 0;
|
||||
m_oldBrush = 0;
|
||||
m_oldFont = 0;
|
||||
m_oldPalette = 0;
|
||||
m_hOldBitmap = 0;
|
||||
m_hOldPen = 0;
|
||||
m_hOldBrush = 0;
|
||||
m_hOldFont = 0;
|
||||
m_hOldPalette = 0;
|
||||
|
||||
m_bOwnsDC = FALSE;
|
||||
m_hDC = 0;
|
||||
m_hDCCount = 0;
|
||||
m_bOwnsDC = FALSE;
|
||||
m_hDC = 0;
|
||||
m_nDCCount = 0;
|
||||
};
|
||||
|
||||
wxDC::~wxDC(void)
|
||||
@@ -77,52 +89,59 @@ void wxDC::SelectOldObjects(WXHDC dc)
|
||||
{
|
||||
if (dc)
|
||||
{
|
||||
if (m_oldBitmap)
|
||||
if (m_hOldBitmap)
|
||||
{
|
||||
// ::SelectObject((HDC) dc, (HBITMAP) m_oldBitmap);
|
||||
if (m_selectedBitmap.Ok())
|
||||
if (m_vSelectedBitmap.Ok())
|
||||
{
|
||||
m_selectedBitmap.SetSelectedInto(NULL);
|
||||
m_vSelectedBitmap.SetSelectedInto(NULL);
|
||||
}
|
||||
}
|
||||
m_oldBitmap = 0;
|
||||
if (m_oldPen)
|
||||
m_hOldBitmap = 0;
|
||||
if (m_hOldPen)
|
||||
{
|
||||
// ::SelectObject((HDC) dc, (HPEN) m_oldPen);
|
||||
}
|
||||
m_oldPen = 0;
|
||||
if (m_oldBrush)
|
||||
m_hOldPen = 0;
|
||||
if (m_hOldBrush)
|
||||
{
|
||||
// ::SelectObject((HDC) dc, (HBRUSH) m_oldBrush);
|
||||
}
|
||||
m_oldBrush = 0;
|
||||
if (m_oldFont)
|
||||
m_hOldBrush = 0;
|
||||
if (m_hOldFont)
|
||||
{
|
||||
// ::SelectObject((HDC) dc, (HFONT) m_oldFont);
|
||||
}
|
||||
m_oldFont = 0;
|
||||
if (m_oldPalette)
|
||||
m_hOldFont = 0;
|
||||
if (m_hOldPalette)
|
||||
{
|
||||
// ::SelectPalette((HDC) dc, (HPALETTE) m_oldPalette, TRUE);
|
||||
}
|
||||
m_oldPalette = 0;
|
||||
m_hOldPalette = 0;
|
||||
}
|
||||
|
||||
m_brush = wxNullBrush;
|
||||
m_pen = wxNullPen;
|
||||
m_palette = wxNullPalette;
|
||||
m_font = wxNullFont;
|
||||
m_brush = wxNullBrush;
|
||||
m_pen = wxNullPen;
|
||||
m_palette = wxNullPalette;
|
||||
m_font = wxNullFont;
|
||||
m_backgroundBrush = wxNullBrush;
|
||||
m_selectedBitmap = wxNullBitmap;
|
||||
m_vSelectedBitmap = wxNullBitmap;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// clipping
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
void wxDC::DoSetClippingRegionAsRegion(const wxRegion& region)
|
||||
{
|
||||
// TODO
|
||||
#define DO_SET_CLIPPING_BOX() \
|
||||
{ \
|
||||
RECT rect; \
|
||||
\
|
||||
GetClipBox(GetHdc(), &rect); \
|
||||
\
|
||||
m_clipX1 = (wxCoord) XDEV2LOG(rect.left); \
|
||||
m_clipY1 = (wxCoord) YDEV2LOG(rect.top); \
|
||||
m_clipX2 = (wxCoord) XDEV2LOG(rect.right); \
|
||||
m_clipY2 = (wxCoord) YDEV2LOG(rect.bottom); \
|
||||
}
|
||||
|
||||
void wxDC::DoSetClippingRegion( wxCoord x, wxCoord y
|
||||
@@ -132,14 +151,9 @@ void wxDC::DoSetClippingRegion( wxCoord x, wxCoord y
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxDC::DoClipping(WXHDC dc)
|
||||
void wxDC::DoSetClippingRegionAsRegion(const wxRegion& region)
|
||||
{
|
||||
if (m_clipping && dc)
|
||||
{
|
||||
// TODO:
|
||||
// IntersectClipRect((HDC) dc, XLOG2DEV(m_clipX1), YLOG2DEV(m_clipY1),
|
||||
// XLOG2DEV(m_clipX2), YLOG2DEV(m_clipY2));
|
||||
}
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxDC::DestroyClippingRegion(void)
|
||||
@@ -213,6 +227,12 @@ void wxDC::DoDrawArc( wxCoord x1, wxCoord y1
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxDC::DoDrawCheckMark(wxCoord x1, wxCoord y1,
|
||||
wxCoord width, wxCoord height)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxDC::DoDrawPoint(wxCoord x, wxCoord y)
|
||||
{
|
||||
// TODO
|
||||
@@ -280,6 +300,11 @@ void wxDC::DoDrawText(const wxString& text, wxCoord x, wxCoord y)
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxDC::DrawAnyText(const wxString& text, wxCoord x, wxCoord y)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxDC::DoDrawRotatedText(const wxString& text,
|
||||
wxCoord x, wxCoord y,
|
||||
double angle)
|
||||
@@ -345,9 +370,39 @@ void wxDC::SetPalette(const wxPalette& palette)
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxDC::SetFont(const wxFont& font)
|
||||
void wxDC::SetFont(
|
||||
const wxFont& rFont
|
||||
)
|
||||
{
|
||||
// TODO
|
||||
//
|
||||
// Set the old object temporarily, in case the assignment deletes an object
|
||||
// that's not yet selected out.
|
||||
//
|
||||
if (m_hOldFont)
|
||||
{
|
||||
// ::SelectObject(GetHdc(), (HFONT) m_hOldFont);
|
||||
m_hOldFont = 0;
|
||||
}
|
||||
|
||||
m_font = rFont;
|
||||
|
||||
if (!rFont.Ok())
|
||||
{
|
||||
if (m_hOldFont)
|
||||
// ::SelectObject(GetHdc(), (HFONT) m_hOldFont);
|
||||
m_hOldFont = 0;
|
||||
}
|
||||
|
||||
if (m_font.Ok() && m_font.GetResourceHandle())
|
||||
{
|
||||
HFONT hFont = (HFONT)0; //::SelectObject(GetHdc(), (HFONT) m_font.GetResourceHandle());
|
||||
if (hFont == (HFONT) NULL)
|
||||
{
|
||||
wxLogDebug(wxT("::SelectObject failed in wxDC::SetFont."));
|
||||
}
|
||||
if (!m_hOldFont)
|
||||
m_hOldFont = (WXHFONT) hFont;
|
||||
}
|
||||
}
|
||||
|
||||
void wxDC::SetPen(const wxPen& pen)
|
||||
@@ -496,71 +551,43 @@ void wxDC::SetDeviceOrigin( wxCoord x, wxCoord y )
|
||||
|
||||
wxCoord wxDCBase::DeviceToLogicalX(wxCoord x) const
|
||||
{
|
||||
wxCoord new_x = x - m_deviceOriginX;
|
||||
if (new_x > 0)
|
||||
return (wxCoord)((double)(new_x) / m_scaleX + 0.5) * m_signX + m_logicalOriginX;
|
||||
else
|
||||
return (wxCoord)((double)(new_x) / m_scaleX - 0.5) * m_signX + m_logicalOriginX;
|
||||
};
|
||||
return (wxCoord) (((x) - m_deviceOriginX)/(m_logicalScaleX*m_userScaleX*m_signX*m_scaleX) - m_logicalOriginX);
|
||||
}
|
||||
|
||||
wxCoord wxDCBase::DeviceToLogicalXRel(wxCoord x) const
|
||||
{
|
||||
if (x > 0)
|
||||
return (wxCoord)((double)(x) / m_scaleX + 0.5);
|
||||
else
|
||||
return (wxCoord)((double)(x) / m_scaleX - 0.5);
|
||||
};
|
||||
return (wxCoord) ((x)/(m_logicalScaleX*m_userScaleX*m_signX*m_scaleX));
|
||||
}
|
||||
|
||||
wxCoord wxDCBase::DeviceToLogicalY(wxCoord y) const
|
||||
{
|
||||
wxCoord new_y = y - m_deviceOriginY;
|
||||
if (new_y > 0)
|
||||
return (wxCoord)((double)(new_y) / m_scaleY + 0.5) * m_signY + m_logicalOriginY;
|
||||
else
|
||||
return (wxCoord)((double)(new_y) / m_scaleY - 0.5) * m_signY + m_logicalOriginY;
|
||||
};
|
||||
return (wxCoord) (((y) - m_deviceOriginY)/(m_logicalScaleY*m_userScaleY*m_signY*m_scaleY) - m_logicalOriginY);
|
||||
}
|
||||
|
||||
wxCoord wxDCBase::DeviceToLogicalYRel(wxCoord y) const
|
||||
{
|
||||
if (y > 0)
|
||||
return (wxCoord)((double)(y) / m_scaleY + 0.5);
|
||||
else
|
||||
return (wxCoord)((double)(y) / m_scaleY - 0.5);
|
||||
};
|
||||
return (wxCoord) ((y)/(m_logicalScaleY*m_userScaleY*m_signY*m_scaleY));
|
||||
}
|
||||
|
||||
wxCoord wxDCBase::LogicalToDeviceX(wxCoord x) const
|
||||
{
|
||||
wxCoord new_x = x - m_logicalOriginX;
|
||||
if (new_x > 0)
|
||||
return (wxCoord)((double)(new_x) * m_scaleX + 0.5) * m_signX + m_deviceOriginX;
|
||||
else
|
||||
return (wxCoord)((double)(new_x) * m_scaleX - 0.5) * m_signX + m_deviceOriginX;
|
||||
};
|
||||
return (wxCoord) ((x - m_logicalOriginX)*m_logicalScaleX*m_userScaleX*m_signX*m_scaleX + m_deviceOriginX);
|
||||
}
|
||||
|
||||
wxCoord wxDCBase::LogicalToDeviceXRel(wxCoord x) const
|
||||
{
|
||||
if (x > 0)
|
||||
return (wxCoord)((double)(x) * m_scaleX + 0.5);
|
||||
else
|
||||
return (wxCoord)((double)(x) * m_scaleX - 0.5);
|
||||
};
|
||||
return (wxCoord) (x*m_logicalScaleX*m_userScaleX*m_signX*m_scaleX);
|
||||
}
|
||||
|
||||
wxCoord wxDCBase::LogicalToDeviceY(wxCoord y) const
|
||||
{
|
||||
wxCoord new_y = y - m_logicalOriginY;
|
||||
if (new_y > 0)
|
||||
return (wxCoord)((double)(new_y) * m_scaleY + 0.5) * m_signY + m_deviceOriginY;
|
||||
else
|
||||
return (wxCoord)((double)(new_y) * m_scaleY - 0.5) * m_signY + m_deviceOriginY;
|
||||
};
|
||||
return (wxCoord) ((y - m_logicalOriginY)*m_logicalScaleY*m_userScaleY*m_signY*m_scaleY + m_deviceOriginY);
|
||||
}
|
||||
|
||||
wxCoord wxDCBase::LogicalToDeviceYRel(wxCoord y) const
|
||||
{
|
||||
if (y > 0)
|
||||
return (wxCoord)((double)(y) * m_scaleY + 0.5);
|
||||
else
|
||||
return (wxCoord)((double)(y) * m_scaleY - 0.5);
|
||||
};
|
||||
return (wxCoord) (y*m_logicalScaleY*m_userScaleY*m_signY*m_scaleY);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// bit blit
|
||||
|
||||
@@ -82,14 +82,14 @@ static RECT g_paintStruct;
|
||||
|
||||
wxWindowDC::wxWindowDC()
|
||||
{
|
||||
m_canvas = NULL;
|
||||
m_pCanvas = NULL;
|
||||
}
|
||||
|
||||
wxWindowDC::wxWindowDC(wxWindow *the_canvas)
|
||||
{
|
||||
m_canvas = the_canvas;
|
||||
m_pCanvas = the_canvas;
|
||||
m_hDC = (WXHDC) ::WinOpenWindowDC(GetWinHwnd(the_canvas) );
|
||||
m_hDCCount++;
|
||||
m_nDCCount++;
|
||||
//
|
||||
// default under PM is that Window and Client DC's are the same
|
||||
// so we offer a separate Presentation Space to use for the
|
||||
@@ -103,12 +103,12 @@ wxWindowDC::wxWindowDC(wxWindow *the_canvas)
|
||||
);
|
||||
::GpiAssociate(m_hPS, NULLHANDLE);
|
||||
::GpiAssociate(m_hPS, m_hDC);
|
||||
SetBackground(wxBrush(m_canvas->GetBackgroundColour(), wxSOLID));
|
||||
SetBackground(wxBrush(m_pCanvas->GetBackgroundColour(), wxSOLID));
|
||||
}
|
||||
|
||||
wxWindowDC::~wxWindowDC()
|
||||
{
|
||||
if (m_canvas && m_hDC)
|
||||
if (m_pCanvas && m_hDC)
|
||||
{
|
||||
SelectOldObjects(m_hDC);
|
||||
|
||||
@@ -123,7 +123,7 @@ wxWindowDC::~wxWindowDC()
|
||||
m_hDC = NULLHANDLE;
|
||||
}
|
||||
|
||||
m_hDCCount--;
|
||||
m_nDCCount--;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -132,12 +132,12 @@ wxWindowDC::~wxWindowDC()
|
||||
|
||||
wxClientDC::wxClientDC()
|
||||
{
|
||||
m_canvas = NULL;
|
||||
m_pCanvas = NULL;
|
||||
}
|
||||
|
||||
wxClientDC::wxClientDC(wxWindow *the_canvas)
|
||||
{
|
||||
m_canvas = the_canvas;
|
||||
m_pCanvas = the_canvas;
|
||||
|
||||
//
|
||||
// default under PM is that Window and Client DC's are the same
|
||||
@@ -147,12 +147,12 @@ wxClientDC::wxClientDC(wxWindow *the_canvas)
|
||||
//
|
||||
// Default mode is BM_LEAVEALONE so we make no call Set the mix
|
||||
//
|
||||
SetBackground(wxBrush(m_canvas->GetBackgroundColour(), wxSOLID));
|
||||
SetBackground(wxBrush(m_pCanvas->GetBackgroundColour(), wxSOLID));
|
||||
}
|
||||
|
||||
wxClientDC::~wxClientDC()
|
||||
{
|
||||
if ( m_canvas && GetHdc() )
|
||||
if ( m_pCanvas && GetHdc() )
|
||||
{
|
||||
SelectOldObjects(m_hDC);
|
||||
|
||||
@@ -187,7 +187,7 @@ wxArrayDCInfo wxPaintDC::ms_cache;
|
||||
|
||||
wxPaintDC::wxPaintDC()
|
||||
{
|
||||
m_canvas = NULL;
|
||||
m_pCanvas = NULL;
|
||||
m_hDC = 0;
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ wxPaintDC::wxPaintDC(wxWindow *canvas)
|
||||
}
|
||||
#endif // __WXDEBUG__
|
||||
|
||||
m_canvas = canvas;
|
||||
m_pCanvas = canvas;
|
||||
|
||||
// do we have a DC for this window in the cache?
|
||||
wxPaintDCInfo *info = FindInCache();
|
||||
@@ -215,10 +215,10 @@ wxPaintDC::wxPaintDC(wxWindow *canvas)
|
||||
}
|
||||
else // not in cache, create a new one
|
||||
{
|
||||
m_hDC = (WXHDC)::WinBeginPaint(GetWinHwnd(m_canvas), NULLHANDLE, &g_paintStruct);
|
||||
ms_cache.Add(new wxPaintDCInfo(m_canvas, this));
|
||||
m_hDC = (WXHDC)::WinBeginPaint(GetWinHwnd(m_pCanvas), NULLHANDLE, &g_paintStruct);
|
||||
ms_cache.Add(new wxPaintDCInfo(m_pCanvas, this));
|
||||
}
|
||||
SetBackground(wxBrush(m_canvas->GetBackgroundColour(), wxSOLID));
|
||||
SetBackground(wxBrush(m_pCanvas->GetBackgroundColour(), wxSOLID));
|
||||
}
|
||||
|
||||
wxPaintDC::~wxPaintDC()
|
||||
@@ -252,7 +252,7 @@ wxPaintDCInfo *wxPaintDC::FindInCache(size_t *index) const
|
||||
for ( size_t n = 0; n < nCache; n++ )
|
||||
{
|
||||
info = &ms_cache[n];
|
||||
if ( info->hwnd == m_canvas->GetHWND() )
|
||||
if ( info->hwnd == m_pCanvas->GetHWND() )
|
||||
{
|
||||
if ( index )
|
||||
*index = n;
|
||||
|
||||
@@ -77,13 +77,13 @@ void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
|
||||
|
||||
void wxMemoryDC::DoGetSize( int *width, int *height ) const
|
||||
{
|
||||
if (!m_selectedBitmap.Ok())
|
||||
if (!m_vSelectedBitmap.Ok())
|
||||
{
|
||||
*width = 0; *height = 0;
|
||||
return;
|
||||
}
|
||||
*width = m_selectedBitmap.GetWidth();
|
||||
*height = m_selectedBitmap.GetHeight();
|
||||
*width = m_vSelectedBitmap.GetWidth();
|
||||
*height = m_vSelectedBitmap.GetHeight();
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -36,8 +36,6 @@
|
||||
|
||||
#ifdef __EMX__
|
||||
#include <dirent.h>
|
||||
#else
|
||||
#include <direct.h>
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
197
src/os2/font.cpp
197
src/os2/font.cpp
@@ -183,6 +183,9 @@ wxFont::~wxFont()
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// real implementation
|
||||
// Boris' Kovalenko comments:
|
||||
// Because OS/2 fonts are associated with PS we can not create the font
|
||||
// here, but we may check that font definition is true
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool wxFont::RealizeResource()
|
||||
@@ -196,7 +199,24 @@ bool wxFont::RealizeResource()
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int ff_family = 0;
|
||||
HPS hps;
|
||||
FATTRS fAttrs;
|
||||
FACENAMEDESC fName;
|
||||
LONG fLid;
|
||||
|
||||
fAttrs.usRecordLength = sizeof(FATTRS);
|
||||
fAttrs.fsFontUse = FATTR_FONTUSE_OUTLINE | // only outline fonts allowed
|
||||
FATTR_FONTUSE_TRANSFORMABLE; // may be transformed
|
||||
fAttrs.fsType = 0;
|
||||
fAttrs.lMaxBaselineExt = fAttrs.lAveCharWidth = 0;
|
||||
fAttrs.idRegistry = 0;
|
||||
fAttrs.lMatch = 0;
|
||||
|
||||
fName.usSize = sizeof(FACENAMEDESC);
|
||||
fName.usWidthClass = FWIDTH_NORMAL;
|
||||
fName.usReserved = 0;
|
||||
fName.flOptions = 0;
|
||||
|
||||
wxString ff_face;
|
||||
|
||||
// OS/2 combines the family with styles to give a facename
|
||||
@@ -204,42 +224,27 @@ bool wxFont::RealizeResource()
|
||||
switch ( M_FONTDATA->m_family )
|
||||
{
|
||||
case wxSCRIPT:
|
||||
// ff_family = FF_SCRIPT ;
|
||||
ff_face = wxT("Script") ;
|
||||
break ;
|
||||
|
||||
case wxDECORATIVE:
|
||||
// ff_family = FF_DECORATIVE;
|
||||
break;
|
||||
|
||||
case wxROMAN:
|
||||
// ff_family = FF_ROMAN;
|
||||
ff_face = wxT("Times New Roman") ;
|
||||
break;
|
||||
|
||||
case wxTELETYPE:
|
||||
case wxMODERN:
|
||||
// ff_family = FF_MODERN;
|
||||
ff_face = wxT("Courier New") ;
|
||||
ff_face = wxT("Courier") ;
|
||||
break;
|
||||
|
||||
case wxSWISS:
|
||||
// ff_family = FF_SWISS;
|
||||
ff_face = wxT("Arial") ;
|
||||
break;
|
||||
|
||||
case wxDEFAULT:
|
||||
default:
|
||||
// ff_family = FF_SWISS;
|
||||
ff_face = wxT("Arial") ;
|
||||
ff_face = wxT("Helvetica") ;
|
||||
}
|
||||
|
||||
BYTE ff_italic;
|
||||
switch ( M_FONTDATA->m_style )
|
||||
{
|
||||
case wxITALIC:
|
||||
case wxSLANT:
|
||||
ff_italic = 1;
|
||||
fAttrs.fsSelection = FATTR_SEL_ITALIC;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -247,10 +252,9 @@ bool wxFont::RealizeResource()
|
||||
// fall through
|
||||
|
||||
case wxNORMAL:
|
||||
ff_italic = 0;
|
||||
fAttrs.fsSelection = 0;
|
||||
}
|
||||
|
||||
int ff_weight = 0;
|
||||
switch ( M_FONTDATA->m_weight )
|
||||
{
|
||||
default:
|
||||
@@ -258,68 +262,20 @@ bool wxFont::RealizeResource()
|
||||
// fall through
|
||||
|
||||
case wxNORMAL:
|
||||
// ff_weight = FW_NORMAL;
|
||||
fName.usWeightClass = FWEIGHT_NORMAL;
|
||||
break;
|
||||
|
||||
case wxLIGHT:
|
||||
// ff_weight = FW_LIGHT;
|
||||
fName.usWeightClass = FWEIGHT_LIGHT;
|
||||
break;
|
||||
|
||||
case wxBOLD:
|
||||
// ff_weight = FW_BOLD;
|
||||
fName.usWeightClass = FWEIGHT_BOLD;
|
||||
break;
|
||||
}
|
||||
|
||||
const wxChar* pzFace;
|
||||
if ( M_FONTDATA->m_faceName.IsEmpty() )
|
||||
pzFace = ff_face;
|
||||
else
|
||||
pzFace = M_FONTDATA->m_faceName ;
|
||||
|
||||
#if 0
|
||||
/* Always calculate fonts using the screen DC (is this the best strategy?)
|
||||
* There may be confusion if a font is selected into a printer
|
||||
* DC (say), because the height will be calculated very differently.
|
||||
*/
|
||||
// What sort of display is it?
|
||||
int technology = ::GetDeviceCaps(dc, TECHNOLOGY);
|
||||
|
||||
int nHeight;
|
||||
|
||||
if (technology != DT_RASDISPLAY && technology != DT_RASPRINTER)
|
||||
{
|
||||
// Have to get screen DC Caps, because a metafile will return 0.
|
||||
HDC dc2 = ::GetDC(NULL);
|
||||
nHeight = M_FONTDATA->m_pointSize*GetDeviceCaps(dc2, LOGPIXELSY)/72;
|
||||
::ReleaseDC(NULL, dc2);
|
||||
}
|
||||
else
|
||||
{
|
||||
nHeight = M_FONTDATA->m_pointSize*GetDeviceCaps(dc, LOGPIXELSY)/72;
|
||||
}
|
||||
#endif // 0
|
||||
|
||||
#if 0
|
||||
// Have to get screen DC Caps, because a metafile will return 0.
|
||||
HDC dc2 = ::GetDC(NULL);
|
||||
ppInch = ::GetDeviceCaps(dc2, LOGPIXELSY);
|
||||
::ReleaseDC(NULL, dc2);
|
||||
#endif // 0
|
||||
|
||||
// New behaviour: apparently ppInch varies according to Large/Small Fonts
|
||||
// setting in Windows. This messes up fonts. So, set ppInch to a constant
|
||||
// 96 dpi.
|
||||
static const int ppInch = 96;
|
||||
|
||||
#if wxFONT_SIZE_COMPATIBILITY
|
||||
// Incorrect, but compatible with old wxWindows behaviour
|
||||
int nHeight = (M_FONTDATA->m_pointSize*ppInch/72);
|
||||
#else
|
||||
// Correct for Windows compatibility
|
||||
int nHeight = - (M_FONTDATA->m_pointSize*ppInch/72);
|
||||
#endif
|
||||
|
||||
BYTE ff_underline = M_FONTDATA->m_underlined;
|
||||
|
||||
if( M_FONTDATA->m_underlined )
|
||||
fAttrs.fsSelection |= FATTR_SEL_UNDERSCORE;
|
||||
|
||||
wxFontEncoding encoding = M_FONTDATA->m_encoding;
|
||||
if ( encoding == wxFONTENCODING_DEFAULT )
|
||||
@@ -327,52 +283,51 @@ bool wxFont::RealizeResource()
|
||||
encoding = wxFont::GetDefaultEncoding();
|
||||
}
|
||||
|
||||
DWORD charset;
|
||||
switch ( encoding )
|
||||
{
|
||||
case wxFONTENCODING_ISO8859_1:
|
||||
case wxFONTENCODING_ISO8859_15:
|
||||
case wxFONTENCODING_CP1250:
|
||||
// charset = ANSI_CHARSET;
|
||||
fAttrs.usCodePage = 1250;
|
||||
break;
|
||||
|
||||
case wxFONTENCODING_ISO8859_2:
|
||||
case wxFONTENCODING_CP1252:
|
||||
// charset = EASTEUROPE_CHARSET;
|
||||
fAttrs.usCodePage = 1252;
|
||||
break;
|
||||
|
||||
case wxFONTENCODING_ISO8859_4:
|
||||
case wxFONTENCODING_ISO8859_10:
|
||||
// charset = BALTIC_CHARSET;
|
||||
fAttrs.usCodePage = 850; // what is baltic?
|
||||
break;
|
||||
|
||||
case wxFONTENCODING_ISO8859_5:
|
||||
case wxFONTENCODING_CP1251:
|
||||
// charset = RUSSIAN_CHARSET;
|
||||
fAttrs.usCodePage = 1251;
|
||||
break;
|
||||
|
||||
case wxFONTENCODING_ISO8859_6:
|
||||
// charset = ARABIC_CHARSET;
|
||||
fAttrs.usCodePage = 850; // what is arabic?
|
||||
break;
|
||||
|
||||
case wxFONTENCODING_ISO8859_7:
|
||||
// charset = GREEK_CHARSET;
|
||||
fAttrs.usCodePage = 850; // what is greek
|
||||
break;
|
||||
|
||||
case wxFONTENCODING_ISO8859_8:
|
||||
// charset = HEBREW_CHARSET;
|
||||
fAttrs.usCodePage = 850; // what is hebrew?
|
||||
break;
|
||||
|
||||
case wxFONTENCODING_ISO8859_9:
|
||||
// charset = TURKISH_CHARSET;
|
||||
fAttrs.usCodePage = 857;
|
||||
break;
|
||||
|
||||
case wxFONTENCODING_ISO8859_11:
|
||||
// charset = THAI_CHARSET;
|
||||
fAttrs.usCodePage = 850; // what is thai
|
||||
break;
|
||||
|
||||
case wxFONTENCODING_CP437:
|
||||
// charset = OEM_CHARSET;
|
||||
fAttrs.usCodePage = 437;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -380,32 +335,58 @@ bool wxFont::RealizeResource()
|
||||
// fall through
|
||||
|
||||
case wxFONTENCODING_SYSTEM:
|
||||
// charset = ANSI_CHARSET;
|
||||
fAttrs.usCodePage = 850; // what is ANSI?
|
||||
break;
|
||||
}
|
||||
|
||||
// TODO:
|
||||
WXHFONT hFont = 0;
|
||||
// HFONT hFont = ::CreateFont
|
||||
// (
|
||||
// nHeight, // height
|
||||
// 0, // width (choose best)
|
||||
// 0, // escapement
|
||||
// 0, // orientation
|
||||
// ff_weight, // weight
|
||||
// ff_italic, // italic?
|
||||
// ff_underline, // underlined?
|
||||
// 0, // strikeout?
|
||||
// charset, // charset
|
||||
// OUT_DEFAULT_PRECIS, // precision
|
||||
// CLIP_DEFAULT_PRECIS, // clip precision
|
||||
// PROOF_QUALITY, // quality of match
|
||||
// DEFAULT_PITCH | // fixed or variable
|
||||
// ff_family, // family id
|
||||
// pzFace // face name
|
||||
// );
|
||||
// Now cheking
|
||||
fLid = 1;
|
||||
hps = ::WinGetPS( HWND_DESKTOP );
|
||||
|
||||
long numLids = ::GpiQueryNumberSetIds( hps );
|
||||
long gpiError;
|
||||
|
||||
// First we should generate unique id
|
||||
if( numLids )
|
||||
{
|
||||
long Types[255];
|
||||
STR8 Names[255];
|
||||
long lIds[255];
|
||||
|
||||
if( !GpiQuerySetIds(hps, numLids, Types, Names, lIds) )
|
||||
{
|
||||
::WinReleasePS( hps );
|
||||
return 0;
|
||||
}
|
||||
|
||||
for(unsigned long LCNum = 0; LCNum < numLids; LCNum++)
|
||||
if(lIds[LCNum] == fLid)
|
||||
++fLid;
|
||||
if(fLid > 254) // wow, no id available!
|
||||
{
|
||||
::WinReleasePS( hps );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// now building facestring
|
||||
if(::GpiQueryFaceString(hps, ff_face.c_str(), &fName, FACESIZE, fAttrs.szFacename) == GPI_ERROR)
|
||||
{
|
||||
::WinReleasePS( hps );
|
||||
return 0;
|
||||
}
|
||||
|
||||
// now creating font
|
||||
WXHFONT hFont = (WXHFONT)0;
|
||||
|
||||
if(::GpiCreateLogFont(hps, NULL, fLid, &fAttrs) != GPI_ERROR)
|
||||
M_FONTDATA->m_hFont = hFont = (WXHFONT)1;
|
||||
|
||||
if( hFont )
|
||||
::GpiDeleteSetId(hps, fLid);
|
||||
|
||||
::WinReleasePS( hps );
|
||||
|
||||
M_FONTDATA->m_hFont = (WXHFONT)hFont;
|
||||
if ( !hFont )
|
||||
{
|
||||
wxLogLastError("CreateFont");
|
||||
|
||||
@@ -485,17 +485,63 @@ wxStatusBar* wxFrame::OnCreateStatusBar(
|
||||
)
|
||||
{
|
||||
wxStatusBar* pStatusBar = NULL;
|
||||
SWP vSwp;
|
||||
ERRORID vError;
|
||||
wxString sError;
|
||||
HWND hWnd;
|
||||
|
||||
pStatusBar = wxFrameBase::OnCreateStatusBar( nNumber
|
||||
,lulStyle
|
||||
,vId
|
||||
,rName
|
||||
);
|
||||
//
|
||||
// The default parent set for the Statusbar is m_hWnd which, of course,
|
||||
// is the handle to the client window of the frame. We don't want that,
|
||||
// so we have to set the parent to actually be the Frame.
|
||||
//
|
||||
hWnd = pStatusBar->GetHWND();
|
||||
if (!::WinSetParent(hWnd, m_hFrame, FALSE))
|
||||
{
|
||||
vError = ::WinGetLastError(vHabmain);
|
||||
sError = wxPMErrorToStr(vError);
|
||||
wxLogError("Error setting parent for statusbar. Error: %s\n", sError);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//
|
||||
// Also we need to reset it positioning to enable the SHOW attribute
|
||||
//
|
||||
if (!::WinQueryWindowPos((HWND)pStatusBar->GetHWND(), &vSwp))
|
||||
{
|
||||
vError = ::WinGetLastError(vHabmain);
|
||||
sError = wxPMErrorToStr(vError);
|
||||
wxLogError("Error querying frame for statusbar position. Error: %s\n", sError);
|
||||
return NULL;
|
||||
}
|
||||
if (!::WinSetWindowPos( (HWND)pStatusBar->GetHWND()
|
||||
,HWND_TOP
|
||||
,vSwp.cx
|
||||
,vSwp.cy
|
||||
,vSwp.x
|
||||
,vSwp.y
|
||||
,SWP_SIZE | SWP_MOVE | SWP_SHOW | SWP_ZORDER
|
||||
))
|
||||
{
|
||||
vError = ::WinGetLastError(vHabmain);
|
||||
sError = wxPMErrorToStr(vError);
|
||||
wxLogError("Error setting statusbar position. Error: %s\n", sError);
|
||||
return NULL;
|
||||
}
|
||||
return pStatusBar;
|
||||
} // end of wxFrame::OnCreateStatusBar
|
||||
|
||||
void wxFrame::PositionStatusBar()
|
||||
{
|
||||
SWP vSwp;
|
||||
ERRORID vError;
|
||||
wxString sError;
|
||||
|
||||
//
|
||||
// Native status bar positions itself
|
||||
//
|
||||
@@ -525,6 +571,27 @@ void wxFrame::PositionStatusBar()
|
||||
,nWidth
|
||||
,nStatbarHeight
|
||||
);
|
||||
if (!::WinQueryWindowPos(m_frameStatusBar->GetHWND(), &vSwp))
|
||||
{
|
||||
vError = ::WinGetLastError(vHabmain);
|
||||
sError = wxPMErrorToStr(vError);
|
||||
wxLogError("Error setting parent for submenu. Error: %s\n", sError);
|
||||
return;
|
||||
}
|
||||
if (!::WinSetWindowPos( m_frameStatusBar->GetHWND()
|
||||
,HWND_TOP
|
||||
,nStatbarWidth
|
||||
,nStatbarHeight
|
||||
,vSwp.x
|
||||
,vSwp.y
|
||||
,SWP_SIZE | SWP_MOVE | SWP_SHOW | SWP_ZORDER
|
||||
))
|
||||
{
|
||||
vError = ::WinGetLastError(vHabmain);
|
||||
sError = wxPMErrorToStr(vError);
|
||||
wxLogError("Error setting parent for submenu. Error: %s\n", sError);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} // end of wxFrame::PositionStatusBar
|
||||
#endif // wxUSE_STATUSBAR
|
||||
@@ -817,7 +884,7 @@ bool wxFrame::OS2Create(
|
||||
|
||||
if (ulStyle == wxDEFAULT_FRAME_STYLE)
|
||||
ulCreateFlags = FCF_SIZEBORDER | FCF_TITLEBAR | FCF_SYSMENU |
|
||||
FCF_MINMAX | FCF_VERTSCROLL | FCF_HORZSCROLL | FCF_TASKLIST;
|
||||
FCF_MINMAX | FCF_TASKLIST;
|
||||
else
|
||||
{
|
||||
if ((ulStyle & wxCAPTION) == wxCAPTION)
|
||||
@@ -825,6 +892,10 @@ bool wxFrame::OS2Create(
|
||||
else
|
||||
ulCreateFlags = FCF_NOMOVEWITHOWNER;
|
||||
|
||||
if ((ulStyle & wxVSCROLL) == wxVSCROLL)
|
||||
ulCreateFlags |= FCF_VERTSCROLL;
|
||||
if ((ulStyle & wxHSCROLL) == wxHSCROLL)
|
||||
ulCreateFlags |= FCF_HORZSCROLL;
|
||||
if (ulStyle & wxMINIMIZE_BOX)
|
||||
ulCreateFlags |= FCF_MINBUTTON;
|
||||
if (ulStyle & wxMAXIMIZE_BOX)
|
||||
@@ -884,7 +955,7 @@ bool wxFrame::OS2Create(
|
||||
,HWND_TOP // Sibling
|
||||
,(ULONG)nId // ID
|
||||
,(PVOID)&vFrameCtlData // Creation data
|
||||
,NULL // Window Pres Params
|
||||
,NULL // Window Pres Params
|
||||
)) == 0L)
|
||||
{
|
||||
return FALSE;
|
||||
@@ -917,7 +988,7 @@ bool wxFrame::OS2Create(
|
||||
,nY
|
||||
,nWidth
|
||||
,nHeight
|
||||
,SWP_SIZE | SWP_MOVE | SWP_ACTIVATE
|
||||
,SWP_SIZE | SWP_MOVE | SWP_ACTIVATE | SWP_ZORDER
|
||||
))
|
||||
return FALSE;
|
||||
|
||||
@@ -1129,8 +1200,6 @@ bool wxFrame::OS2TranslateMessage(
|
||||
WXMSG* pMsg
|
||||
)
|
||||
{
|
||||
if (wxWindow::OS2TranslateMessage(pMsg))
|
||||
return TRUE;
|
||||
//
|
||||
// try the menu bar accels
|
||||
//
|
||||
@@ -1140,7 +1209,7 @@ bool wxFrame::OS2TranslateMessage(
|
||||
return FALSE;
|
||||
|
||||
const wxAcceleratorTable& rAcceleratorTable = pMenuBar->GetAccelTable();
|
||||
return rAcceleratorTable.Translate(this, pMsg);
|
||||
return rAcceleratorTable.Translate(m_hFrame, pMsg);
|
||||
} // end of wxFrame::OS2TranslateMessage
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -1195,6 +1264,13 @@ bool wxFrame::HandlePaint()
|
||||
}
|
||||
else
|
||||
{
|
||||
HPS hPS;
|
||||
RECTL vRect;
|
||||
|
||||
hPS = WinBeginPaint(GetHwnd(), 0L, &vRect);
|
||||
WinFillRect(hPS, &vRect, SYSCLR_WINDOW);
|
||||
WinEndPaint(hPS);
|
||||
|
||||
return wxWindow::HandlePaint();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -335,7 +335,9 @@ void wxGDIImage::CleanUpHandlers()
|
||||
wxNode* pNext = pNode->Next();
|
||||
|
||||
delete pHandler;
|
||||
#if (!(defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 )))
|
||||
delete pNode;
|
||||
#endif
|
||||
pNode = pNext;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -989,20 +989,16 @@ $(WXDIR)\lib\wx.lib: \
|
||||
|
||||
!else
|
||||
|
||||
# Update the import library
|
||||
$(WXDIR)\lib\wx214.lib: $(OBJECTS)
|
||||
implib $(WXDIR)\lib\wx214.lib $(WXDIR)\lib\wx214.def
|
||||
|
||||
# Update the dynamic link library
|
||||
$(WXDIR)\lib\wx214.dll: $(OBJECTS)
|
||||
$(WXDIR)\lib\wx22.dll: $(OBJECTS)
|
||||
icc @<<
|
||||
/B" $(LINKFLAGS)" /Fe$@
|
||||
$(LIBS)
|
||||
$(DUMMYOBJ)
|
||||
$(OBJECTS)
|
||||
$(WXDIR)\lib\wx214.def
|
||||
$(WXDIR)\lib\wx22.def
|
||||
<<
|
||||
implib $(WXDIR)\lib\wx214.lib $(WXDIR)\lib\wx214.def
|
||||
implib $(WXDIR)\lib\wx22.lib $(WXDIR)\lib\wx22.def
|
||||
|
||||
!endif
|
||||
|
||||
@@ -1098,7 +1094,7 @@ clean: $(PERIPH_CLEAN_TARGET) clean_png clean_zlib clean_jpeg clean_xpm clean_t
|
||||
rd ..\os2\$D
|
||||
del $(LIBTARGET)
|
||||
!if "$(WXMAKINGDLL)" == "1"
|
||||
erase /N ..\..\lib\wx214.lib
|
||||
erase /N ..\..\lib\wx22.lib
|
||||
!endif
|
||||
|
||||
cleanall: clean
|
||||
|
||||
@@ -996,7 +996,7 @@ MRESULT wxMDIChildFrame::OS2DefWindowProc(WXUINT message, WXWPARAM wParam, WXLPA
|
||||
|
||||
bool wxMDIChildFrame::OS2TranslateMessage(WXMSG* msg)
|
||||
{
|
||||
return m_acceleratorTable.Translate(GetParent(), msg);
|
||||
return m_acceleratorTable.Translate(GetParent()->GetHWND(), msg);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
129
src/os2/menu.cpp
129
src/os2/menu.cpp
@@ -49,6 +49,15 @@ extern wxMenu* wxCurrentPopupMenu;
|
||||
//
|
||||
static const int idMenuTitle = -2;
|
||||
|
||||
//
|
||||
// The unique ID for Menus
|
||||
//
|
||||
#ifdef __VISAGECPP__
|
||||
USHORT wxMenu::m_nextMenuId = 0;
|
||||
#else
|
||||
static USHORT wxMenu::m_nextMenuId = 0;
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// macros
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -73,7 +82,7 @@ static wxString TextToLabel(const wxString& rTitle)
|
||||
pc++;
|
||||
Title << wxT('&');
|
||||
}
|
||||
else
|
||||
else
|
||||
Title << wxT('~');
|
||||
}
|
||||
// else if (*pc == wxT('/'))
|
||||
@@ -113,7 +122,7 @@ void wxMenu::Init()
|
||||
// Create the menu (to be used as a submenu or a popup)
|
||||
//
|
||||
if ((m_hMenu = ::WinCreateWindow( HWND_DESKTOP
|
||||
,(const wxChar*)WC_MENU
|
||||
,WC_MENU
|
||||
,"Menu"
|
||||
,0L
|
||||
,0L
|
||||
@@ -132,7 +141,7 @@ void wxMenu::Init()
|
||||
m_vMenuData.iPosition = 0;
|
||||
m_vMenuData.afStyle = MIS_SUBMENU | MIS_TEXT;
|
||||
m_vMenuData.afAttribute = (USHORT)0;
|
||||
m_vMenuData.id = (USHORT)0;
|
||||
m_vMenuData.id = m_nextMenuId++;
|
||||
m_vMenuData.hwndSubMenu = m_hMenu;
|
||||
m_vMenuData.hItem = NULLHANDLE;
|
||||
|
||||
@@ -169,7 +178,9 @@ wxMenu::~wxMenu()
|
||||
//
|
||||
// Delete accels
|
||||
//
|
||||
#if (!(defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 )))
|
||||
WX_CLEAR_ARRAY(m_vAccels);
|
||||
#endif
|
||||
#endif // wxUSE_ACCEL
|
||||
} // end of wxMenu::~wxMenu
|
||||
|
||||
@@ -254,13 +265,24 @@ bool wxMenu::DoInsertOrAppend(
|
||||
{
|
||||
ERRORID vError;
|
||||
wxString sError;
|
||||
MENUITEM vItem;
|
||||
|
||||
#if wxUSE_ACCEL
|
||||
UpdateAccel(pItem);
|
||||
#endif // wxUSE_ACCEL
|
||||
|
||||
memset(&vItem, '\0', sizeof(vItem));
|
||||
//
|
||||
// rItem is the member MENUITEM for the menu items and the submenu's
|
||||
// MENUITEM for submenus as required by ::MM_INSERTITEM message API
|
||||
//
|
||||
|
||||
wxMenu* pSubmenu = pItem->GetSubMenu();
|
||||
MENUITEM &rItem = (pSubmenu != NULL)?pSubmenu->m_vMenuData:
|
||||
pItem->m_vMenuData;
|
||||
if(pSubmenu != NULL)
|
||||
{
|
||||
wxASSERT_MSG(pSubmenu->GetHMenu(), wxT("invalid submenu"));
|
||||
pSubmenu->SetParent(this);
|
||||
rItem.afStyle |= MIS_SUBMENU | MIS_TEXT;
|
||||
}
|
||||
|
||||
//
|
||||
// If "Break" has just been called, insert a menu break before this item
|
||||
@@ -268,16 +290,10 @@ bool wxMenu::DoInsertOrAppend(
|
||||
//
|
||||
if (m_bDoBreak)
|
||||
{
|
||||
vItem.afStyle |= MIS_BREAK;
|
||||
rItem.afStyle |= MIS_BREAK;
|
||||
m_bDoBreak = FALSE;
|
||||
}
|
||||
|
||||
//
|
||||
// Menu items that are being inserted into a submenu MUST have a
|
||||
// MENUITEM structure separate from the parent menu so we must use
|
||||
// a local vItem not the object's m_vMenuItem as that is the MENUITEM
|
||||
// associated with the parent submenu.
|
||||
//
|
||||
if (pItem->IsSeparator())
|
||||
{
|
||||
vItem.afStyle |= MIS_SEPARATOR;
|
||||
@@ -314,7 +330,7 @@ bool wxMenu::DoInsertOrAppend(
|
||||
// item draws itself, pass pointer to it in data parameter
|
||||
// Will eventually need to set the image handle somewhere into vItem.hItem
|
||||
//
|
||||
vItem.afStyle |= MIS_OWNERDRAW;
|
||||
rItem.afStyle |= MIS_OWNERDRAW;
|
||||
pData = (BYTE*)pItem;
|
||||
// vItem.hItem = ????
|
||||
}
|
||||
@@ -328,24 +344,22 @@ bool wxMenu::DoInsertOrAppend(
|
||||
pData = (char*)pItem->GetText().c_str();
|
||||
}
|
||||
|
||||
APIRET rc;
|
||||
|
||||
if (pSubmenu == NULL)
|
||||
if (nPos == (size_t)-1)
|
||||
{
|
||||
//
|
||||
// -1 means append at end
|
||||
//
|
||||
if (nPos == (size_t)-1)
|
||||
{
|
||||
vItem.iPosition = MIT_END;
|
||||
}
|
||||
else
|
||||
{
|
||||
vItem.iPosition = nPos;
|
||||
}
|
||||
rItem.iPosition = MIT_END;
|
||||
}
|
||||
else
|
||||
{
|
||||
rItem.iPosition = nPos;
|
||||
}
|
||||
|
||||
rc = (APIRET)::WinSendMsg(GetHmenu(), MM_INSERTITEM, (MPARAM)&vItem, (MPARAM)pData);
|
||||
APIRET rc;
|
||||
|
||||
rc = (APIRET)::WinSendMsg( GetHmenu()
|
||||
,MM_INSERTITEM
|
||||
,(MPARAM)&rItem
|
||||
,(MPARAM)pData
|
||||
);
|
||||
if (rc == MIT_MEMERROR || rc == MIT_ERROR)
|
||||
{
|
||||
vError = ::WinGetLastError(vHabmain);
|
||||
@@ -665,7 +679,6 @@ WXHMENU wxMenuBar::Create()
|
||||
{
|
||||
MENUITEM vItem;
|
||||
HWND hFrame;
|
||||
HWND hMenuBar = NULLHANDLE;
|
||||
|
||||
if (m_hMenu != 0 )
|
||||
return m_hMenu;
|
||||
@@ -682,39 +695,39 @@ WXHMENU wxMenuBar::Create()
|
||||
//
|
||||
// Create an empty menu and then fill it with insertions
|
||||
//
|
||||
if (!wxWindow::OS2Create( hFrame
|
||||
,WC_MENU
|
||||
,"Menu"
|
||||
,MS_ACTIONBAR | WS_SYNCPAINT | WS_VISIBLE
|
||||
,0L
|
||||
,0L
|
||||
,0L
|
||||
,0L
|
||||
,hFrame
|
||||
,HWND_TOP
|
||||
,FID_MENU
|
||||
,(PVOID)NULL
|
||||
,(PVOID)NULL
|
||||
))
|
||||
if ((m_hMenu = ::WinCreateWindow( hFrame
|
||||
,WC_MENU
|
||||
,(PSZ)NULL
|
||||
,MS_ACTIONBAR | WS_SYNCPAINT | WS_VISIBLE
|
||||
,0L
|
||||
,0L
|
||||
,0L
|
||||
,0L
|
||||
,hFrame
|
||||
,HWND_TOP
|
||||
,FID_MENU
|
||||
,NULL
|
||||
,NULL
|
||||
)) == 0)
|
||||
{
|
||||
wxLogLastError("CreateMenu");
|
||||
wxLogLastError("WinLoadMenu");
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t nCount = GetMenuCount();
|
||||
|
||||
hMenuBar = GetHwnd();
|
||||
for (size_t i = 0; i < nCount; i++)
|
||||
{
|
||||
APIRET rc;
|
||||
ERRORID vError;
|
||||
wxString sError;
|
||||
MENUITEM vItem;
|
||||
HWND hSubMenu;
|
||||
|
||||
//
|
||||
// Set the parent and owner of the submenues to be the menubar, not the desktop
|
||||
//
|
||||
if (!::WinSetParent(m_menus[i]->m_vMenuData.hwndSubMenu, hMenuBar, FALSE))
|
||||
hSubMenu = m_menus[i]->m_vMenuData.hwndSubMenu;
|
||||
if (!::WinSetParent(m_menus[i]->m_vMenuData.hwndSubMenu, m_hMenu, FALSE))
|
||||
{
|
||||
vError = ::WinGetLastError(vHabmain);
|
||||
sError = wxPMErrorToStr(vError);
|
||||
@@ -722,7 +735,7 @@ WXHMENU wxMenuBar::Create()
|
||||
return NULLHANDLE;
|
||||
}
|
||||
|
||||
if (!::WinSetOwner(m_menus[i]->m_vMenuData.hwndSubMenu, hMenuBar))
|
||||
if (!::WinSetOwner(m_menus[i]->m_vMenuData.hwndSubMenu, m_hMenu))
|
||||
{
|
||||
vError = ::WinGetLastError(vHabmain);
|
||||
sError = wxPMErrorToStr(vError);
|
||||
@@ -732,7 +745,7 @@ WXHMENU wxMenuBar::Create()
|
||||
|
||||
m_menus[i]->m_vMenuData.iPosition = i;
|
||||
|
||||
rc = (APIRET)::WinSendMsg(hMenuBar, MM_INSERTITEM, (MPARAM)&m_menus[i]->m_vMenuData, (MPARAM)m_titles[i].c_str());
|
||||
rc = (APIRET)::WinSendMsg(m_hMenu, MM_INSERTITEM, (MPARAM)&m_menus[i]->m_vMenuData, (MPARAM)m_titles[i].c_str());
|
||||
if (rc == MIT_MEMERROR || rc == MIT_ERROR)
|
||||
{
|
||||
vError = ::WinGetLastError(vHabmain);
|
||||
@@ -742,7 +755,7 @@ WXHMENU wxMenuBar::Create()
|
||||
}
|
||||
}
|
||||
}
|
||||
return hMenuBar;
|
||||
return m_hMenu;
|
||||
} // end of wxMenuBar::Create
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -771,7 +784,7 @@ void wxMenuBar::EnableTop(
|
||||
wxLogLastError("LogLastError");
|
||||
return;
|
||||
}
|
||||
::WinSendMsg((HWND)m_hMenu, MM_SETITEMATTR, MPFROM2SHORT(nId, TRUE), MPFROM2SHORT(uFlag, uFlag));
|
||||
::WinSendMsg((HWND)m_hMenu, MM_SETITEMATTR, MPFROM2SHORT(nId, TRUE), MPFROM2SHORT(MIA_DISABLED, uFlag));
|
||||
Refresh();
|
||||
} // end of wxMenuBar::EnableTop
|
||||
|
||||
@@ -852,7 +865,7 @@ wxMenu* wxMenuBar::Replace(
|
||||
m_titles[nPos] = Title;
|
||||
if (IsAttached())
|
||||
{
|
||||
::WinSendMsg((HWND)m_hMenu, MM_DELETEITEM, MPFROM2SHORT(nId, TRUE), (MPARAM)0);
|
||||
::WinSendMsg((HWND)m_hMenu, MM_REMOVEITEM, MPFROM2SHORT(nId, TRUE), (MPARAM)0);
|
||||
::WinSendMsg((HWND)m_hMenu, MM_INSERTITEM, (MPARAM)&pMenu->m_vMenuData, (MPARAM)Title.c_str());
|
||||
|
||||
#if wxUSE_ACCEL
|
||||
@@ -955,7 +968,7 @@ wxMenu* wxMenuBar::Remove(
|
||||
}
|
||||
if (IsAttached())
|
||||
{
|
||||
::WinSendMsg((HWND)GetHmenu(), MM_DELETEITEM, MPFROM2SHORT(nId, TRUE), (MPARAM)0);
|
||||
::WinSendMsg((HWND)GetHmenu(), MM_REMOVEITEM, MPFROM2SHORT(nId, TRUE), (MPARAM)0);
|
||||
pMenu->Detach();
|
||||
|
||||
#if wxUSE_ACCEL
|
||||
@@ -1016,6 +1029,14 @@ void wxMenuBar::Attach(
|
||||
|
||||
#if wxUSE_ACCEL
|
||||
RebuildAccelTable();
|
||||
//
|
||||
// Ensure the accelerator table is set to the frame (not the client!)
|
||||
//
|
||||
if (!::WinSetAccelTable( vHabmain
|
||||
,(HWND)pFrame->GetFrame()
|
||||
,m_vAccelTable.GetHACCEL()
|
||||
))
|
||||
wxLogLastError("WinSetAccelTable");
|
||||
#endif // wxUSE_ACCEL
|
||||
} // end of wxMenuBar::Attach
|
||||
|
||||
|
||||
@@ -155,6 +155,8 @@ wxMenuItem::wxMenuItem(
|
||||
m_text = TextToLabel(rText);
|
||||
m_isCheckable = bCheckable;
|
||||
m_help = rStrHelp;
|
||||
memset(&m_vMenuData, '\0', sizeof(m_vMenuData));
|
||||
m_vMenuData.id= nId;
|
||||
} // end of wxMenuItem::wxMenuItem
|
||||
|
||||
wxMenuItem::~wxMenuItem()
|
||||
@@ -233,13 +235,13 @@ void wxMenuItem::Enable(
|
||||
bOk = (bool)::WinSendMsg( GetHMenuOf(m_parentMenu)
|
||||
,MM_SETITEMATTR
|
||||
,MPFROM2SHORT(GetRealId(), TRUE)
|
||||
,MPFROM2SHORT(MIA_DISABLED, MIA_DISABLED)
|
||||
,MPFROM2SHORT(MIA_DISABLED, FALSE)
|
||||
);
|
||||
else
|
||||
bOk = (bool)::WinSendMsg( GetHMenuOf(m_parentMenu)
|
||||
,MM_SETITEMATTR
|
||||
,MPFROM2SHORT(GetRealId(), TRUE)
|
||||
,MPFROM2SHORT(MIA_DISABLED, FALSE)
|
||||
,MPFROM2SHORT(MIA_DISABLED, MIA_DISABLED)
|
||||
);
|
||||
if (!bOk)
|
||||
{
|
||||
@@ -271,7 +273,7 @@ void wxMenuItem::Check(
|
||||
);
|
||||
if (!bOk)
|
||||
{
|
||||
wxLogLastError("EnableMenuItem");
|
||||
wxLogLastError("CheckMenuItem");
|
||||
}
|
||||
wxMenuItemBase::Check(bCheck);
|
||||
} // end of wxMenuItem::Check
|
||||
|
||||
@@ -269,8 +269,8 @@ void wxMetafileDC::SetMapMode(int mode)
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_windowExtX = 100;
|
||||
m_windowExtY = 100;
|
||||
m_nWindowExtX = 100;
|
||||
m_nWindowExtY = 100;
|
||||
}
|
||||
|
||||
#ifdef __WIN32__
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "wx/defs.h"
|
||||
#include "wx/utils.h"
|
||||
#include "wx/dialog.h"
|
||||
#include "wx/app.h"
|
||||
#include "wx/msgdlg.h"
|
||||
#endif
|
||||
|
||||
@@ -35,18 +36,105 @@
|
||||
|
||||
IMPLEMENT_CLASS(wxMessageDialog, wxDialog)
|
||||
|
||||
wxMessageDialog::wxMessageDialog(wxWindow *parent, const wxString& message, const wxString& caption,
|
||||
long style, const wxPoint& pos)
|
||||
wxMessageDialog::wxMessageDialog(
|
||||
wxWindow* pParent
|
||||
, const wxString& rsMessage
|
||||
, const wxString& rsCaption
|
||||
, long lStyle
|
||||
, const wxPoint& pPos
|
||||
)
|
||||
{
|
||||
m_caption = caption;
|
||||
m_message = message;
|
||||
m_dialogStyle = style;
|
||||
m_parent = parent;
|
||||
}
|
||||
m_sCaption = rsCaption;
|
||||
m_sMessage = rsMessage;
|
||||
m_lDialogStyle = lStyle;
|
||||
m_pParent = NULL; // pParent;
|
||||
} // end of wxMessageDialog::wxMessageDialog
|
||||
|
||||
int wxMessageDialog::ShowModal()
|
||||
{
|
||||
// TODO
|
||||
return wxID_CANCEL;
|
||||
}
|
||||
HWND hWnd = 0;
|
||||
ULONG ulStyle = MB_OK;
|
||||
int nAns = wxOK;
|
||||
|
||||
if (!wxTheApp->GetTopWindow())
|
||||
{
|
||||
//
|
||||
// when the message box is shown from wxApp::OnInit() (i.e. before the
|
||||
// message loop is entered), this must be done or the next message box
|
||||
// will never be shown - just try putting 2 calls to wxMessageBox() in
|
||||
// OnInit() to see it
|
||||
//
|
||||
while (wxTheApp->Pending())
|
||||
wxTheApp->Dispatch();
|
||||
}
|
||||
|
||||
if (m_pParent)
|
||||
hWnd = (HWND) m_pParent->GetHWND();
|
||||
else
|
||||
hWnd = HWND_DESKTOP;
|
||||
if (m_lDialogStyle & wxYES_NO)
|
||||
{
|
||||
if (m_lDialogStyle & wxCANCEL)
|
||||
ulStyle = MB_YESNOCANCEL;
|
||||
else
|
||||
ulStyle = MB_YESNO;
|
||||
|
||||
if (m_lDialogStyle & wxNO_DEFAULT)
|
||||
ulStyle |= MB_DEFBUTTON2;
|
||||
}
|
||||
|
||||
if (m_lDialogStyle & wxOK)
|
||||
{
|
||||
if (m_lDialogStyle & wxCANCEL)
|
||||
ulStyle = MB_OKCANCEL;
|
||||
else
|
||||
ulStyle = MB_OK;
|
||||
}
|
||||
if (m_lDialogStyle & wxICON_EXCLAMATION)
|
||||
ulStyle |= MB_ICONEXCLAMATION;
|
||||
else if (m_lDialogStyle & wxICON_HAND)
|
||||
ulStyle |= MB_ICONHAND;
|
||||
else if (m_lDialogStyle & wxICON_INFORMATION)
|
||||
ulStyle |= MB_ICONEXCLAMATION;
|
||||
else if (m_lDialogStyle & wxICON_QUESTION)
|
||||
ulStyle |= MB_ICONQUESTION;
|
||||
|
||||
if (hWnd != HWND_DESKTOP)
|
||||
ulStyle |= MB_APPLMODAL;
|
||||
else
|
||||
ulStyle |= MB_SYSTEMMODAL;
|
||||
|
||||
//
|
||||
// This little line of code is get message boxes under OS/2 to
|
||||
// behve like the other ports. In OS/2 if the parent is a window
|
||||
// it displays, clipped, in the window. This centers it on the
|
||||
// desktop, like the other ports but still allows control over modality
|
||||
//
|
||||
hWnd = HWND_DESKTOP;
|
||||
|
||||
ULONG ulAns = ::WinMessageBox( hWnd
|
||||
,hWnd
|
||||
,(PSZ)m_sMessage.c_str()
|
||||
,(PSZ)m_sCaption.c_str()
|
||||
,0L
|
||||
,ulStyle);
|
||||
switch (ulAns)
|
||||
{
|
||||
case MBID_CANCEL:
|
||||
nAns = wxID_CANCEL;
|
||||
break;
|
||||
case MBID_OK:
|
||||
nAns = wxID_OK;
|
||||
break;
|
||||
case MBID_YES:
|
||||
nAns = wxID_YES;
|
||||
break;
|
||||
case MBID_NO:
|
||||
nAns = wxID_NO;
|
||||
break;
|
||||
default:
|
||||
nAns = wxID_CANCEL;
|
||||
}
|
||||
return nAns;
|
||||
} // end of wxMessageDialog::ShowModal
|
||||
|
||||
|
||||
@@ -746,11 +746,15 @@ void wxThreadModule::OnExit()
|
||||
if (gs_pCritsectGui)
|
||||
{
|
||||
gs_pCritsectGui->Leave();
|
||||
#if (!(defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 )))
|
||||
delete gs_pCritsectGui;
|
||||
#endif
|
||||
gs_pCritsectGui = NULL;
|
||||
}
|
||||
|
||||
#if (!(defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 )))
|
||||
wxDELETE(gs_pCritsectWaitingForGui);
|
||||
#endif
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
@@ -26,8 +26,6 @@
|
||||
#include <ctype.h>
|
||||
#ifdef __EMX__
|
||||
#include <dirent.h>
|
||||
#else
|
||||
#include <direct.h>
|
||||
#endif
|
||||
|
||||
#include "wx/log.h"
|
||||
|
||||
@@ -35,8 +35,6 @@
|
||||
#include <ctype.h>
|
||||
#ifdef __EMX__
|
||||
#include <dirent.h>
|
||||
#else
|
||||
#include <direct.h>
|
||||
#endif
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
@@ -1699,7 +1699,7 @@ bool wxWindow::OS2TranslateMessage(
|
||||
WXMSG* pMsg
|
||||
)
|
||||
{
|
||||
return m_acceleratorTable.Translate(this, pMsg);
|
||||
return m_acceleratorTable.Translate(m_hWnd, pMsg);
|
||||
} // end of wxWindow::OS2TranslateMessage
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -1813,7 +1813,7 @@ MRESULT EXPENTRY wxWndProc(
|
||||
{
|
||||
if (pWnd)
|
||||
rc = pWnd->OS2WindowProc(ulMsg, wParam, lParam);
|
||||
else
|
||||
if (!rc)
|
||||
rc = ::WinDefWindowProc(hWnd, ulMsg, wParam, lParam);
|
||||
}
|
||||
return rc;
|
||||
@@ -1954,7 +1954,6 @@ MRESULT wxWindow::OS2WindowProc(
|
||||
bProcessed = HandleMouseEvent(uMsg, x, y, (WXUINT)wParam);
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_SYSCOMMAND:
|
||||
bProcessed = HandleSysCommand(wParam, lParam);
|
||||
break;
|
||||
@@ -2154,7 +2153,7 @@ MRESULT wxWindow::OS2WindowProc(
|
||||
|
||||
// wxFrame specific message
|
||||
case WM_MINMAXFRAME:
|
||||
bProcessed = HandleGetMinMaxInfo((PSWP)lParam);
|
||||
bProcessed = HandleGetMinMaxInfo((PSWP)wParam);
|
||||
break;
|
||||
|
||||
case WM_SYSVALUECHANGED:
|
||||
@@ -2395,6 +2394,7 @@ bool wxWindow::OS2Create(
|
||||
wxLogError("Can't create window of class %s!. Error: %s\n", zClass, sError);
|
||||
return FALSE;
|
||||
}
|
||||
::WinSetWindowULong(m_hWnd, QWL_USER, (ULONG) this);
|
||||
wxWndHook = NULL;
|
||||
|
||||
#ifdef __WXDEBUG__
|
||||
|
||||
Reference in New Issue
Block a user