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:
@@ -1476,6 +1476,8 @@ typedef long WXLPARAM;
|
||||
#else
|
||||
# define WXWPARAM MPARAM
|
||||
# define WXLPARAM MPARAM
|
||||
# define RECT RECTL
|
||||
# define LOGFONT FATTRS
|
||||
#endif
|
||||
typedef unsigned long WXCOLORREF;
|
||||
typedef void * WXRGNDATA;
|
||||
|
@@ -63,10 +63,10 @@ typedef MRESULT (APIENTRY * WndProcCast) (HWND, ULONG, MPARAM, MPARAM);
|
||||
#define IBS_HORZCAPTION 0x4000L
|
||||
#define IBS_VERTCAPTION 0x8000L
|
||||
|
||||
UINT WINAPI ibGetCaptionSize( HWND hWnd ) ;
|
||||
UINT WINAPI ibSetCaptionSize( HWND hWnd, UINT nSize ) ;
|
||||
LRESULT WINAPI ibDefWindowProc( HWND hWnd, UINT uiMsg, WPARAM wParam, LPARAM lParam ) ;
|
||||
VOID WINAPI ibAdjustWindowRect( HWND hWnd, LPRECT lprc ) ;
|
||||
UINT APIENTRY ibGetCaptionSize( HWND hWnd ) ;
|
||||
UINT APIENTRY ibSetCaptionSize( HWND hWnd, UINT nSize ) ;
|
||||
MRESULT APIENTRY ibDefWindowProc( HWND hWnd, ULONG ulMsg, MPARAM wParam, MPARAM lParam ) ;
|
||||
VOID APIENTRY ibAdjustWindowRect( HWND hWnd, LPRECT lprc ) ;
|
||||
#endif // wxUSE_ITSY_BITSY
|
||||
|
||||
/*
|
||||
@@ -76,10 +76,10 @@ typedef MRESULT (APIENTRY * WndProcCast) (HWND, ULONG, MPARAM, MPARAM);
|
||||
|
||||
#define STATIC_CLASS _T("STATIC")
|
||||
#define STATIC_FLAGS (SS_TEXT|DT_LEFT|SS_LEFT|WS_VISIBLE)
|
||||
#define CHECK_CLASS "BUTTON"
|
||||
#define CHECK_CLASS _T("BUTTON")
|
||||
#define CHECK_FLAGS (BS_AUTOCHECKBOX|WS_TABSTOP)
|
||||
#define CHECK_IS_FAFA FALSE
|
||||
#define RADIO_CLASS "BUTTON"
|
||||
#define RADIO_CLASS _T("BUTTON" )
|
||||
#define RADIO_FLAGS (BS_AUTORADIOBUTTON|WS_VISIBLE)
|
||||
#define RADIO_SIZE 20
|
||||
#define RADIO_IS_FAFA FALSE
|
||||
@@ -107,8 +107,7 @@ typedef MRESULT (APIENTRY * WndProcCast) (HWND, ULONG, MPARAM, MPARAM);
|
||||
|
||||
// Generic subclass proc, for panel item moving/sizing and intercept
|
||||
// EDIT control VK_RETURN messages
|
||||
extern LONG APIENTRY _EXPORT
|
||||
wxSubclassedGenericControlProc(WXHWND hWnd, WXDWORD message, WXWPARAM wParam, WXLPARAM lParam);
|
||||
extern LONG APIENTRY wxSubclassedGenericControlProc(WXHWND hWnd, WXDWORD message, WXWPARAM wParam, WXLPARAM lParam);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// constants which might miss from some compilers' headers
|
||||
@@ -155,7 +154,7 @@ extern LONG APIENTRY _EXPORT
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// The MakeProcInstance version of the function wxSubclassedGenericControlProc
|
||||
WXDLLEXPORT_DATA(extern FARPROC) wxGenericControlSubClassProc;
|
||||
WXDLLEXPORT_DATA(extern) wxGenericControlSubClassProc;
|
||||
WXDLLEXPORT_DATA(extern wxChar*) wxBuffer;
|
||||
WXDLLEXPORT_DATA(extern HINSTANCE) wxhInstance;
|
||||
|
||||
|
@@ -146,7 +146,6 @@ public:
|
||||
// same as DoSetSize() for the client size
|
||||
virtual void DoSetClientSize(int width, int height);
|
||||
virtual bool DoPopupMenu( wxMenu *menu, int x, int y );
|
||||
virtual WXWidget GetHandle() const;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// wxWindowBase virtual implementations that need to be overriden
|
||||
@@ -225,6 +224,11 @@ public:
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
void OnIdle(wxIdleEvent& event);
|
||||
|
||||
// Accessors
|
||||
|
||||
WXHWND GetHWND() const { return m_hWnd; }
|
||||
void SetHWND(WXHWND hWnd) { m_hWnd = hWnd; }
|
||||
virtual WXWidget GetHandle() const { return GetHWND(); }
|
||||
|
||||
public:
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -239,14 +243,25 @@ public:
|
||||
// a toolbar that it manages itself).
|
||||
virtual void AdjustForParentClientOrigin(int& x, int& y, int sizeFlags);
|
||||
|
||||
// Windows subclassing
|
||||
void SubclassWin(WXHWND hWnd);
|
||||
void UnsubclassWin();
|
||||
|
||||
WXFARPROC OS2GetOldWndProc() const { return m_oldWndProc; }
|
||||
void OS2SetOldWndProc(WXFARPROC proc) { m_oldWndProc = proc; }
|
||||
|
||||
wxWindow *FindItem(long id) const;
|
||||
wxWindow *FindItemByHWND(WXHWND hWnd, bool controlOnly = FALSE) const;
|
||||
|
||||
// Determine whether 3D effects are wanted
|
||||
WXDWORD Determine3DEffects(WXDWORD defaultBorderStyle, bool *want3D) const;
|
||||
|
||||
// PM only: TRUE if this control is part of the main control
|
||||
virtual bool ContainsHWND(WXHWND WXUNUSED(hWnd)) const { return FALSE; };
|
||||
|
||||
// Executes the default message
|
||||
virtual long Default();
|
||||
|
||||
/* TODO: you may need something like this
|
||||
// Determine whether 3D effects are wanted
|
||||
virtual WXDWORD Determine3DEffects(WXDWORD defaultBorderStyle, bool *want3D);
|
||||
*/
|
||||
|
||||
// Constraint implementation
|
||||
void UnsetConstraints(wxLayoutConstraints *c);
|
||||
// Back-pointer to other windows we're involved with, so if we delete
|
||||
@@ -268,6 +283,7 @@ protected:
|
||||
wxButton * m_defaultItem;
|
||||
|
||||
public:
|
||||
WXFARPROC m_oldWndProc;
|
||||
int m_returnCode;
|
||||
bool m_isBeingDeleted;
|
||||
bool m_isShown;
|
||||
@@ -287,8 +303,6 @@ DECLARE_EVENT_TABLE()
|
||||
private:
|
||||
void Init();
|
||||
void PMDetachWindowMenu();
|
||||
WXHWND GetHwnd() const { return m_hWnd; }
|
||||
void SetHwnd(WXHWND hWnd) { m_hWnd = hWnd; }
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
@@ -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,19 +50,19 @@ 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 )
|
||||
{
|
||||
#ifdef __WXDEBUG__
|
||||
@@ -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