More OS/2 changes and fixes. Getting there.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3732 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -17,7 +17,7 @@ OS2LIBFLAGS=/NOL /NOE
|
||||
OS2LIBS=CPPOM30.lib CPPOOC3.LIB OS2386.LIB
|
||||
|
||||
# Change this to your WXWIN directory
|
||||
WXDIR=j:\dev\Wx2\wxwindows
|
||||
WXDIR=h:\dev\Wx2\wxwindows
|
||||
|
||||
WXSRC=$(WXDIR)\src\os2
|
||||
WXINC=$(WXDIR)\include
|
||||
|
@@ -21,7 +21,7 @@
|
||||
#include "wx/app.h"
|
||||
#include "wx/dcclient.h"
|
||||
#endif
|
||||
|
||||
#include "wx/os2/private.h"
|
||||
#include "wx/control.h"
|
||||
|
||||
#if !USE_SHARED_LIBRARY
|
||||
@@ -50,18 +50,18 @@ wxControl::~wxControl()
|
||||
|
||||
bool wxControl::OS2CreateControl(const wxChar *classname, WXDWORD style)
|
||||
{
|
||||
m_hWnd = (WXHWND)::CreateWindowEx
|
||||
(
|
||||
GetExStyle(style), // extended style
|
||||
classname, // the kind of control to create
|
||||
NULL, // the window name
|
||||
style, // the window style
|
||||
0, 0, 0, 0, // the window position and size
|
||||
GetHwndOf(GetParent()), // parent
|
||||
(HMENU)GetId(), // child id
|
||||
wxGetInstance(), // app instance
|
||||
NULL // creation parameters
|
||||
);
|
||||
m_hWnd = (WXHWND)::WinCreateWindow( GetHwndOf(GetParent())
|
||||
,classname
|
||||
,NULL
|
||||
,style
|
||||
,0,0,0,0
|
||||
,NULLHANDLE
|
||||
,HWND_TOP
|
||||
,(HMENU)GetId()
|
||||
,NULL
|
||||
,NULL
|
||||
);
|
||||
|
||||
|
||||
if ( !m_hWnd )
|
||||
{
|
||||
@@ -107,6 +107,7 @@ bool wxControl::OS2OnNotify(int idCtrl,
|
||||
{
|
||||
wxCommandEvent event(wxEVT_NULL, m_windowId);
|
||||
wxEventType eventType = wxEVT_NULL;
|
||||
/* TODO:
|
||||
NMHDR *hdr1 = (NMHDR*) lParam;
|
||||
switch ( hdr1->code )
|
||||
{
|
||||
@@ -141,7 +142,7 @@ bool wxControl::OS2OnNotify(int idCtrl,
|
||||
default:
|
||||
return wxWindow::OS2OnNotify(idCtrl, lParam, result);
|
||||
}
|
||||
|
||||
*/
|
||||
event.SetEventType(eventType);
|
||||
event.SetEventObject(this);
|
||||
|
||||
@@ -177,10 +178,12 @@ WXDWORD wxControl::GetExStyle(WXDWORD& style) const
|
||||
bool want3D;
|
||||
WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D) ;
|
||||
|
||||
// Even with extended styles, need to combine with WS_BORDER
|
||||
// for them to look right.
|
||||
// Even with extended styles, need to combine with FS_BORDER
|
||||
// for them to look right. Check it out later, base window style does
|
||||
// not designate BORDERS. Down in Frame and And controls.
|
||||
|
||||
if ( want3D || wxStyleHasBorder(m_windowStyle) )
|
||||
style |= WS_BORDER;
|
||||
style |= FS_BORDER;
|
||||
|
||||
return exStyle;
|
||||
}
|
||||
@@ -196,26 +199,26 @@ WXDWORD wxControl::GetExStyle(WXDWORD& style) const
|
||||
// to calculate largest bounding rectangle.
|
||||
void wxFindMaxSize(WXHWND wnd, RECT *rect)
|
||||
{
|
||||
int left = rect->left;
|
||||
int right = rect->right;
|
||||
int top = rect->top;
|
||||
int bottom = rect->bottom;
|
||||
int left = rect->xLeft;
|
||||
int right = rect->xRight;
|
||||
int top = rect->yTop;
|
||||
int bottom = rect->yBottom;
|
||||
|
||||
GetWindowRect((HWND) wnd, rect);
|
||||
::WinQueryWindowRect((HWND) wnd, rect);
|
||||
|
||||
if (left < 0)
|
||||
return;
|
||||
|
||||
if (left < rect->left)
|
||||
rect->left = left;
|
||||
if (left < rect->xLeft)
|
||||
rect->xLeft = left;
|
||||
|
||||
if (right > rect->right)
|
||||
rect->right = right;
|
||||
if (right > rect->xRight)
|
||||
rect->xRight = right;
|
||||
|
||||
if (top < rect->top)
|
||||
rect->top = top;
|
||||
if (top < rect->yTop)
|
||||
rect->yTop = top;
|
||||
|
||||
if (bottom > rect->bottom)
|
||||
rect->bottom = bottom;
|
||||
if (bottom > rect->yBottom)
|
||||
rect->yBottom = bottom;
|
||||
}
|
||||
|
||||
|
@@ -27,9 +27,6 @@
|
||||
#include "wx/timer.h"
|
||||
#include "wx/intl.h"
|
||||
|
||||
#define INCL_OS2
|
||||
#define INCL_PM
|
||||
|
||||
#include <ctype.h>
|
||||
#include <direct.h>
|
||||
|
||||
@@ -43,14 +40,17 @@
|
||||
#include <errno.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#define INCL_OS2
|
||||
#define INCL_PM
|
||||
#include <os2.h>
|
||||
#include<netdb.h>
|
||||
#include<upm.h>
|
||||
|
||||
// In the WIN.INI file
|
||||
static const wxChar WX_SECTION[] = "wxWindows";
|
||||
static const wxChar eHOSTNAME[] = "HostName";
|
||||
static const wxChar eUSERID[] = "UserId";
|
||||
static const wxChar eUSERNAME[] = "UserName";
|
||||
static const wxChar WX_SECTION[] = _T("wxWindows");
|
||||
static const wxChar eHOSTNAME[] = _T("HostName");
|
||||
static const wxChar eUSERID[] = _T("UserId");
|
||||
static const wxChar eUSERNAME[] = _T("UserName");
|
||||
|
||||
// For the following functions we SHOULD fill in support
|
||||
// for Windows-NT (which I don't know) as I assume it begin
|
||||
@@ -125,8 +125,8 @@ int wxKill(long pid, int sig)
|
||||
bool wxShell(const wxString& command)
|
||||
{
|
||||
wxChar *shell;
|
||||
if ((shell = wxGetenv("COMSPEC")) == NULL)
|
||||
shell = "\\CMD.EXE";
|
||||
if ((shell = wxGetenv(_T("COMSPEC"))) == NULL)
|
||||
shell = _T("\\CMD.EXE");
|
||||
|
||||
wxChar tmp[255];
|
||||
if (command != "")
|
||||
@@ -290,7 +290,7 @@ bool wxWriteResource(const wxString& section, const wxString& entry, int value,
|
||||
|
||||
bool wxGetResource(const wxString& section, const wxString& entry, wxChar **value, const wxString& file)
|
||||
{
|
||||
static const wxChar defunkt[] = "$$default";
|
||||
static const wxChar defunkt[] = _T("$$default");
|
||||
if (file != "")
|
||||
{
|
||||
int n = GetPrivateProfileString((PCSZ)WXSTRINGCAST section, (PCSZ)WXSTRINGCAST entry, (PCSZ)defunkt,
|
||||
@@ -373,7 +373,7 @@ void wxBeginBusyCursor(wxCursor *cursor)
|
||||
void wxEndBusyCursor()
|
||||
{
|
||||
wxCHECK_RET( gs_wxBusyCursorCount > 0,
|
||||
"no matching wxBeginBusyCursor() for wxEndBusyCursor()");
|
||||
_T("no matching wxBeginBusyCursor() for wxEndBusyCursor()"));
|
||||
|
||||
if ( --gs_wxBusyCursorCount == 0 )
|
||||
{
|
||||
@@ -420,10 +420,10 @@ wxChar *wxGetUserHome (const wxString& user)
|
||||
wxChar tmp[64];
|
||||
if (wxGetUserId(tmp, sizeof(tmp)/sizeof(char))) {
|
||||
// Guests belong in the temp dir
|
||||
if (wxStricmp(tmp, "annonymous") == 0) {
|
||||
if ((home = wxGetenv("TMP")) != NULL ||
|
||||
(home = wxGetenv("TMPDIR")) != NULL ||
|
||||
(home = wxGetenv("TEMP")) != NULL)
|
||||
if (wxStricmp(tmp, _T("annonymous")) == 0) {
|
||||
if ((home = wxGetenv(_T("TMP"))) != NULL ||
|
||||
(home = wxGetenv(_T("TMPDIR"))) != NULL ||
|
||||
(home = wxGetenv(_T("TEMP"))) != NULL)
|
||||
return *home ? home : (wxChar*)_T("\\");
|
||||
}
|
||||
if (wxStricmp(tmp, WXSTRINGCAST user1) == 0)
|
||||
@@ -431,7 +431,7 @@ wxChar *wxGetUserHome (const wxString& user)
|
||||
}
|
||||
}
|
||||
if (user1 == _T(""))
|
||||
if ((home = wxGetenv("HOME")) != NULL)
|
||||
if ((home = wxGetenv(_T("HOME"))) != NULL)
|
||||
{
|
||||
wxStrcpy(wxBuffer, home);
|
||||
Unix2DosFilename(wxBuffer);
|
||||
@@ -457,7 +457,7 @@ bool wxCheckForInterrupt(wxWindow *wnd)
|
||||
return TRUE;//*** temporary?
|
||||
}
|
||||
else{
|
||||
wxFAIL_MSG("wnd==NULL !!!");
|
||||
wxFAIL_MSG(_T("wnd==NULL !!!"));
|
||||
|
||||
return FALSE;//*** temporary?
|
||||
}
|
||||
|
@@ -173,8 +173,8 @@ wxWindow::~wxWindow()
|
||||
DestroyChildren();
|
||||
if (m_hWnd)
|
||||
{
|
||||
if(!WinDestroyWindow(GetHwnd()))
|
||||
wxLogLastError("DestroyWindow");
|
||||
if(!WinDestroyWindow(GetHWND()))
|
||||
wxLogLastError(_T("DestroyWindow"));
|
||||
// remove hWnd <-> wxWindow association
|
||||
wxRemoveHandleAssociation(this);
|
||||
}
|
||||
@@ -495,12 +495,6 @@ wxObject* wxWindow::GetChild(int number) const
|
||||
return((wxObject*)this);
|
||||
}
|
||||
|
||||
WXWidget wxWindow::GetHandle() const
|
||||
{
|
||||
// TODO:
|
||||
return((WXWidget)m_hWnd);
|
||||
}
|
||||
|
||||
void wxWindow::PMDetachWindowMenu()
|
||||
{
|
||||
if ( m_hMenu )
|
||||
@@ -553,3 +547,103 @@ void wxRemoveHandleAssociation(wxWindow *win)
|
||||
wxWinHandleList->DeleteObject(win);
|
||||
}
|
||||
|
||||
void wxWindow::SubclassWin(WXHWND hWnd)
|
||||
{
|
||||
wxASSERT_MSG( !m_oldWndProc, _T("subclassing window twice?") );
|
||||
|
||||
HWND hwnd = (HWND)hWnd;
|
||||
/*
|
||||
* TODO: implement something like this:
|
||||
* wxCHECK_RET( ::IsWindow(hwnd), _T("invalid HWND in SubclassWin") );
|
||||
*
|
||||
* wxAssociateWinWithHandle(hwnd, this);
|
||||
*
|
||||
* m_oldWndProc = (WXFARPROC) GetWindowLong(hwnd, GWL_WNDPROC);
|
||||
* SetWindowLong(hwnd, GWL_WNDPROC, (LONG) wxWndProc);
|
||||
*/
|
||||
}
|
||||
|
||||
void wxWindow::UnsubclassWin()
|
||||
{
|
||||
/*
|
||||
* TODO:
|
||||
|
||||
wxRemoveHandleAssociation(this);
|
||||
|
||||
// Restore old Window proc
|
||||
HWND hwnd = GetHwnd();
|
||||
if ( hwnd )
|
||||
{
|
||||
m_hWnd = 0;
|
||||
|
||||
wxCHECK_RET( ::IsWindow(hwnd), _T("invalid HWND in UnsubclassWin") );
|
||||
|
||||
FARPROC farProc = (FARPROC) GetWindowLong(hwnd, GWL_WNDPROC);
|
||||
if ( (m_oldWndProc != 0) && (farProc != (FARPROC) m_oldWndProc) )
|
||||
{
|
||||
SetWindowLong(hwnd, GWL_WNDPROC, (LONG) m_oldWndProc);
|
||||
m_oldWndProc = 0;
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
WXDWORD wxWindow::Determine3DEffects(WXDWORD defaultBorderStyle,
|
||||
bool *want3D) const
|
||||
{
|
||||
DWORD exStyle; // remove after implementation doe
|
||||
/* TODO: this ought to be fun
|
||||
*
|
||||
// If matches certain criteria, then assume no 3D effects
|
||||
// unless specifically requested (dealt with in MakeExtendedStyle)
|
||||
if ( !GetParent() || !IsKindOf(CLASSINFO(wxControl)) || (m_windowStyle & wxNO_BORDER) )
|
||||
{
|
||||
*want3D = FALSE;
|
||||
return MakeExtendedStyle(m_windowStyle, FALSE);
|
||||
}
|
||||
|
||||
// Determine whether we should be using 3D effects or not.
|
||||
bool nativeBorder = FALSE; // by default, we don't want a Win95 effect
|
||||
|
||||
// 1) App can specify global 3D effects
|
||||
*want3D = wxTheApp->GetAuto3D();
|
||||
|
||||
// 2) If the parent is being drawn with user colours, or simple border specified,
|
||||
// switch effects off. TODO: replace wxUSER_COLOURS with wxNO_3D
|
||||
if ( GetParent() && (GetParent()->GetWindowStyleFlag() & wxUSER_COLOURS) || (m_windowStyle & wxSIMPLE_BORDER) )
|
||||
*want3D = FALSE;
|
||||
|
||||
// 3) Control can override this global setting by defining
|
||||
// a border style, e.g. wxSUNKEN_BORDER
|
||||
if ( m_windowStyle & wxSUNKEN_BORDER )
|
||||
*want3D = TRUE;
|
||||
|
||||
// 4) If it's a special border, CTL3D can't cope so we want a native border
|
||||
if ( (m_windowStyle & wxDOUBLE_BORDER) || (m_windowStyle & wxRAISED_BORDER) ||
|
||||
(m_windowStyle & wxSTATIC_BORDER) )
|
||||
{
|
||||
*want3D = TRUE;
|
||||
nativeBorder = TRUE;
|
||||
}
|
||||
|
||||
// 5) If this isn't a Win95 app, and we are using CTL3D, remove border
|
||||
// effects from extended style
|
||||
#if wxUSE_CTL3D
|
||||
if ( *want3D )
|
||||
nativeBorder = FALSE;
|
||||
#endif
|
||||
|
||||
DWORD exStyle = MakeExtendedStyle(m_windowStyle, !nativeBorder);
|
||||
|
||||
// If we want 3D, but haven't specified a border here,
|
||||
// apply the default border style specified.
|
||||
// TODO what about non-Win95 WIN32? Does it have borders?
|
||||
#if defined(__WIN95__) && !wxUSE_CTL3D
|
||||
if ( defaultBorderStyle && (*want3D) && ! ((m_windowStyle & wxDOUBLE_BORDER) || (m_windowStyle & wxRAISED_BORDER ) ||
|
||||
(m_windowStyle & wxSTATIC_BORDER) || (m_windowStyle & wxSIMPLE_BORDER) ))
|
||||
exStyle |= defaultBorderStyle; // WS_EX_CLIENTEDGE;
|
||||
#endif
|
||||
*/
|
||||
return exStyle;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user