OS/2 bug fixes and new mod file

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13755 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Webster
2002-01-22 23:19:28 +00:00
parent 0c53263298
commit 54ffa10747
8 changed files with 120 additions and 45 deletions

View File

@@ -253,22 +253,6 @@ bool wxApp::Initialize(
#endif //wxUSE_CONSOLEDEBUG
#endif
//
// OS2 has to have an anchorblock
//
vHab = WinInitialize(0);
if (!vHab)
return FALSE;
else
vHabmain = vHab;
// Some people may wish to use this, but
// probably it shouldn't be here by default.
#ifdef __WXDEBUG__
// wxRedirectIOToConsole();
#endif
wxBuffer = new wxChar[1500]; // FIXME; why?
wxClassInfo::InitializeClasses();
@@ -289,7 +273,22 @@ bool wxApp::Initialize(
wxBitmap::InitStandardHandlers();
RegisterWindowClasses(vHab);
//
// OS2 has to have an anchorblock
//
vHab = WinInitialize(0);
if (!vHab)
return FALSE;
else
vHabmain = vHab;
// Some people may wish to use this, but
// probably it shouldn't be here by default.
#ifdef __WXDEBUG__
// wxRedirectIOToConsole();
#endif
wxWinHandleList = new wxList(wxKEY_INTEGER);
// This is to foil optimizations in Visual C++ that throw out dummy.obj.
@@ -304,6 +303,7 @@ bool wxApp::Initialize(
wxModule::RegisterModules();
if (!wxModule::InitializeModules())
return FALSE;
RegisterWindowClasses(vHab);
return TRUE;
} // end of wxApp::Initialize
@@ -413,7 +413,7 @@ bool wxApp::RegisterWindowClasses(
if (!::WinRegisterClass( vHab
,wxCanvasClassName
,wxWndProc
,CS_SIZEREDRAW | CS_HITTEST | CS_SYNCPAINT | CS_CLIPCHILDREN
,CS_SIZEREDRAW | CS_HITTEST | CS_SYNCPAINT
,sizeof(ULONG)
))
{
@@ -901,6 +901,16 @@ bool wxApp::ProcessMessage(
if (pMsg->msg == WM_TIMER)
wxTimerProc(NULL, 0, (int)pMsg->mp1, 0);
//
// Allow the window to prevent certain messages from being
// translated/processed (this is currently used by wxTextCtrl to always
// grab Ctrl-C/V/X, even if they are also accelerators in some parent)
//
if (pWndThis && !pWndThis->OS2ShouldPreProcessMessage(pWxmsg))
{
return FALSE;
}
//
// For some composite controls (like a combobox), wndThis might be NULL
// because the subcontrol is not a wxWindow, but only the control itself

View File

@@ -368,7 +368,7 @@ bool wxFontRefData::Alloc(
{
wxFillLogFont( &m_vNativeFontInfo.fa
,&m_vNativeFontInfo.fn
,m_hPS
,&m_hPS
,&flId
,sFaceName
,pFont
@@ -425,6 +425,8 @@ bool wxFontRefData::Alloc(
m_nFamily = wxSCRIPT;
else if (strcmp(m_vNativeFontInfo.fa.szFacename, "Courier New") == 0)
m_nFamily = wxMODERN;
else if (strcmp(m_vNativeFontInfo.fa.szFacename, "Courier") == 0)
m_nFamily = wxMODERN;
else
m_nFamily = wxSWISS;

View File

@@ -261,7 +261,7 @@ bool wxTestFontEncoding(
void wxFillLogFont(
LOGFONT* pFattrs // OS2 GPI FATTRS
, PFACENAMEDESC pFaceName
, HPS hPS
, HPS* phPS
, long* pflId
, wxString& sFaceName
, wxFont* pFont
@@ -269,7 +269,7 @@ void wxFillLogFont(
{
LONG lNumFonts = 0L; // For system font count
ERRORID vError; // For logging API errors
LONG lTemp;
LONG lTemp = 0L;
bool bInternalPS = FALSE; // if we have to create one
PFONTMETRICS pFM = NULL;
@@ -277,22 +277,30 @@ void wxFillLogFont(
// Initial house cleaning to free data buffers and ensure we have a
// functional PS to work with
//
if (!hPS)
if (!*phPS)
{
hPS = ::WinGetPS(HWND_DESKTOP);
*phPS = ::WinGetPS(HWND_DESKTOP);
bInternalPS = TRUE;
}
//
// Determine the number of fonts.
//
lNumFonts = ::GpiQueryFonts( hPS
if((lNumFonts = ::GpiQueryFonts( *phPS
,QF_PUBLIC
,NULL
,&lTemp
,(LONG) sizeof(FONTMETRICS)
,NULL
);
)) < 0L)
{
ERRORID vError;
wxString sError;
vError = ::WinGetLastError(wxGetInstance());
sError = wxPMErrorToStr(vError);
return;
}
//
// Allocate space for the font metrics.
@@ -303,7 +311,7 @@ void wxFillLogFont(
// Retrieve the font metrics.
//
lTemp = lNumFonts;
lTemp = ::GpiQueryFonts( hPS
lTemp = ::GpiQueryFonts( *phPS
,QF_PUBLIC
,NULL
,&lTemp
@@ -355,7 +363,7 @@ void wxFillLogFont(
// We should now have the correct FATTRS set with the selected
// font, so now we need to generate an ID
//
long lNumLids = ::GpiQueryNumberSetIds(hPS);
long lNumLids = ::GpiQueryNumberSetIds(*phPS);
long lGpiError;
if(lNumLids )
@@ -364,7 +372,7 @@ void wxFillLogFont(
STR8 azNames[255];
long alIds[255];
if(!::GpiQuerySetIds( hPS
if(!::GpiQuerySetIds( *phPS
,lNumLids
,alTypes
,azNames
@@ -372,7 +380,7 @@ void wxFillLogFont(
))
{
if (bInternalPS)
::WinReleasePS(hPS);
::WinReleasePS(*phPS);
return;
}
@@ -382,16 +390,17 @@ void wxFillLogFont(
if(*pflId > 254) // wow, no id available!
{
if (bInternalPS)
::WinReleasePS(hPS);
::WinReleasePS(*phPS);
return;
}
}
else
*pflId = 1L;
//
// Release and delete the current font
//
::GpiSetCharSet(hPS, LCID_DEFAULT);/* release the font before deleting */
::GpiDeleteSetId(hPS, 1L); /* delete the logical font */
::GpiSetCharSet(*phPS, LCID_DEFAULT);/* release the font before deleting */
::GpiDeleteSetId(*phPS, 1L); /* delete the logical font */
//
// Now build a facestring
@@ -400,7 +409,7 @@ void wxFillLogFont(
strcpy(zFacename, pFattrs->szFacename);
if(::GpiQueryFaceString( hPS
if(::GpiQueryFaceString( *phPS
,zFacename
,pFaceName
,FACESIZE

View File

@@ -248,6 +248,26 @@ wxStatusBar* wxFrame::OnCreateStatusBar(
if( !pStatusBar )
return NULL;
wxClientDC vDC(pStatusBar);
int nY;
//
// Set the height according to the font and the border size
//
vDC.SetFont(pStatusBar->GetFont()); // Screws up the menues for some reason
vDC.GetTextExtent( "X"
,NULL
,&nY
);
int nHeight = ((11 * nY) / 10 + 2 * pStatusBar->GetBorderY());
pStatusBar->SetSize( -1
,-1
,-1
,nHeight
);
::WinSetParent( pStatusBar->GetHWND()
,m_hFrame
,FALSE

View File

@@ -965,6 +965,13 @@ WXHBRUSH wxTextCtrl::OnCtlColor(
return (WXHBRUSH)pBackgroundBrush->GetResourceHandle();
} // end of wxTextCtrl::OnCtlColor
bool wxTextCtrl::OS2ShouldPreProcessMessage(
WXMSG* pMsg
)
{
return wxControl::OS2ShouldPreProcessMessage(pMsg);
} // end of wxTextCtrl::OS2ShouldPreProcessMessage
void wxTextCtrl::OnChar(
wxKeyEvent& rEvent
)

View File

@@ -351,7 +351,7 @@ bool wxTopLevelWindowOS2::CreateFrame(
wxAssociateWinWithHandle(m_hWnd, this);
wxAssociateWinWithHandle(m_hFrame, this);
m_backgroundColour.Set(wxString("GREY"));
m_backgroundColour.Set(wxString("DARK GREY"));
LONG lColor = (LONG)m_backgroundColour.GetPixel();
@@ -403,6 +403,14 @@ bool wxTopLevelWindowOS2::CreateFrame(
wxLogError("Error sizing frame. Error: %s\n", sError);
return FALSE;
}
lStyle = ::WinQueryWindowULong( m_hWnd
,QWL_STYLE
);
lStyle |= WS_CLIPCHILDREN;
::WinSetWindowULong( m_hWnd
,QWL_STYLE
,lStyle
);
return TRUE;
} // end of wxTopLevelWindowOS2::CreateFrame
@@ -584,7 +592,7 @@ void wxTopLevelWindowOS2::DoShowWindow(
int nShowCmd
)
{
::WinShowWindow(m_hFrame, (BOOL)nShowCmd);
::WinShowWindow(m_hFrame, (BOOL)(nShowCmd & SWP_SHOW));
m_bIconized = nShowCmd == SWP_MINIMIZE;
} // end of wxTopLevelWindowOS2::DoShowWindow
@@ -600,12 +608,12 @@ bool wxTopLevelWindowOS2::Show(
{
if (m_bMaximizeOnShow)
{
nShowCmd = SWP_SHOW;
nShowCmd = SWP_MAXIMIZE;
m_bMaximizeOnShow = FALSE;
}
else
{
nShowCmd = SWP_HIDE;
nShowCmd = SWP_SHOW;
}
}
else // hide

View File

@@ -2265,6 +2265,14 @@ bool wxWindowOS2::OS2TranslateMessage(
#endif //wxUSE_ACCEL
} // end of wxWindowOS2::OS2TranslateMessage
bool wxWindowOS2::OS2ShouldPreProcessMessage(
WXMSG* pMsg
)
{
// preprocess all messages by default
return TRUE;
} // end of wxWindowOS2::OS2ShouldPreProcessMessage
// ---------------------------------------------------------------------------
// message params unpackers
// ---------------------------------------------------------------------------
@@ -3138,6 +3146,13 @@ bool wxWindowOS2::HandleSetFocus(
WXHWND WXUNUSED(hWnd)
)
{
//
// Notify the parent keeping track of focus for the kbd navigation
// purposes that we got it
//
wxChildFocusEvent vEventFocus((wxWindow *)this);
(void)GetEventHandler()->ProcessEvent(vEventFocus);
#if wxUSE_CARET
//
// Deal with caret

View File

@@ -12321,8 +12321,8 @@ EXPORTS
wxGetNativeFontEncoding__F14wxFontEncodingP20wxNativeEncodingInfo
;wxOS2SelectMatchingFontByName(_FATTRS*,_FACENAMEDESC*,_FONTMETRICS*,int,const wxFont*)
wxOS2SelectMatchingFontByName__FP7_FATTRSP13_FACENAMEDESCP12_FONTMETRICSiPC6wxFont
;wxFillLogFont(_FATTRS*,_FACENAMEDESC*,unsigned long,long*,wxString&,wxFont*)
wxFillLogFont__FP7_FATTRSP13_FACENAMEDESCUlPlR8wxStringP6wxFont
;wxFillLogFont(_FATTRS*,_FACENAMEDESC*,unsigned long*,long*,wxString&,wxFont*)
wxFillLogFont__FP7_FATTRSP13_FACENAMEDESCPUlPlR8wxStringP6wxFont
;wxGpiStrcmp(char*,char*)
wxGpiStrcmp__FPcT1
;wxNativeEncodingInfo::FromString(const wxString&)
@@ -14019,6 +14019,8 @@ EXPORTS
Cut__10wxTextCtrlFv
;wxTextCtrl::SetInsertionPointEnd()
SetInsertionPointEnd__10wxTextCtrlFv
;wxTextCtrl::OS2ShouldPreProcessMessage(void**)
OS2ShouldPreProcessMessage__10wxTextCtrlFPPv
;wxTextCtrl::DiscardEdits()
DiscardEdits__10wxTextCtrlFv
;wxTextCtrl::CanUndo() const
@@ -14650,6 +14652,8 @@ EXPORTS
OS2WindowProc__8wxWindowFUiPvT2
;wxWindow::OS2TranslateMessage(void**)
OS2TranslateMessage__8wxWindowFPPv
;wxWindow::OS2ShouldPreProcessMessage(void**)
OS2ShouldPreProcessMessage__8wxWindowFPPv
;wxWindow::OS2DefWindowProc(unsigned int,void*,void*)
OS2DefWindowProc__8wxWindowFUiPvT2
;wxWindow::HandleMinimize()