More OS/2 update to fix some owner drawn things

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16958 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Webster
2002-09-03 22:26:53 +00:00
parent a715019788
commit f5ea767eb8
8 changed files with 49 additions and 32 deletions

View File

@@ -24,7 +24,7 @@ class wxCheckListBoxItem; // fwd decl, define in checklst.cpp
class WXDLLEXPORT wxCheckListBox : public wxListBox class WXDLLEXPORT wxCheckListBox : public wxListBox
{ {
public: public:
// //
// Ctors // Ctors
// //
wxCheckListBox(); wxCheckListBox();
@@ -41,7 +41,7 @@ public:
,const wxString& rsName = wxListBoxNameStr ,const wxString& rsName = wxListBoxNameStr
); );
// //
// Override base class virtuals // Override base class virtuals
// //
virtual void Delete(int n); virtual void Delete(int n);
@@ -52,7 +52,7 @@ public:
virtual bool SetFont(const wxFont &rFont); virtual bool SetFont(const wxFont &rFont);
// //
// Items may be checked // Items may be checked
// //
bool IsChecked(size_t uiIndex) const; bool IsChecked(size_t uiIndex) const;
@@ -60,20 +60,20 @@ public:
,bool bCheck = TRUE ,bool bCheck = TRUE
); );
// //
// Accessors // Accessors
// //
size_t GetItemHeight(void) const { return m_nItemHeight; } size_t GetItemHeight(void) const { return m_nItemHeight; }
protected: protected:
// //
// We create our items ourselves and they have non-standard size, // We create our items ourselves and they have non-standard size,
// so we need to override these functions // so we need to override these functions
// //
virtual wxOwnerDrawn* CreateItem(size_t n); virtual wxOwnerDrawn* CreateItem(size_t n);
virtual bool OS2OnMeasure(WXMEASUREITEMSTRUCT* pItem); virtual long OS2OnMeasure(WXMEASUREITEMSTRUCT* pItem);
// //
// Pressing space or clicking the check box toggles the item // Pressing space or clicking the check box toggles the item
// //
void OnChar(wxKeyEvent& rEvent); void OnChar(wxKeyEvent& rEvent);
@@ -89,7 +89,7 @@ private:
,const wxItemResource* pParentResource ,const wxItemResource* pParentResource
,const wxResourceTable* pTable = (const wxResourceTable *) NULL ,const wxResourceTable* pTable = (const wxResourceTable *) NULL
) )
{ {
return(wxWindowBase::CreateItem( pChildResource return(wxWindowBase::CreateItem( pChildResource
,pParentResource ,pParentResource
,pTable ,pTable

View File

@@ -73,7 +73,7 @@ public:
// For ownerdraw items // For ownerdraw items
// //
virtual bool OS2OnDraw(WXDRAWITEMSTRUCT* WXUNUSED(pItem)) { return FALSE; }; virtual bool OS2OnDraw(WXDRAWITEMSTRUCT* WXUNUSED(pItem)) { return FALSE; };
virtual bool OS2OnMeasure(WXMEASUREITEMSTRUCT* WXUNUSED(pItem)) { return FALSE; }; virtual long OS2OnMeasure(WXMEASUREITEMSTRUCT* WXUNUSED(pItem)) { return 0L; };
wxArrayLong& GetSubcontrols() { return m_aSubControls; } wxArrayLong& GetSubcontrols() { return m_aSubControls; }
void OnEraseBackground(wxEraseEvent& rEvent); void OnEraseBackground(wxEraseEvent& rEvent);

View File

@@ -121,7 +121,7 @@ public:
// wxCheckListBox support // wxCheckListBox support
// //
#if wxUSE_OWNER_DRAWN #if wxUSE_OWNER_DRAWN
bool OS2OnMeasure(WXMEASUREITEMSTRUCT *item); long OS2OnMeasure(WXMEASUREITEMSTRUCT *item);
bool OS2OnDraw(WXDRAWITEMSTRUCT *item); bool OS2OnDraw(WXDRAWITEMSTRUCT *item);
virtual wxOwnerDrawn* CreateItem(size_t n); virtual wxOwnerDrawn* CreateItem(size_t n);

View File

@@ -367,7 +367,7 @@ public:
virtual bool OS2OnDrawItem( int nId virtual bool OS2OnDrawItem( int nId
,WXDRAWITEMSTRUCT* pItem ,WXDRAWITEMSTRUCT* pItem
); );
virtual bool OS2OnMeasureItem( int nId virtual long OS2OnMeasureItem( int nId
,WXMEASUREITEMSTRUCT* pItem ,WXMEASUREITEMSTRUCT* pItem
); );

View File

@@ -112,6 +112,9 @@ bool wxCheckListBoxItem::OnDrawItem (
{ {
wxRect vRect = rRect; wxRect vRect = rRect;
::WinQueryWindowRect( m_pParent->GetHWND()
,&rDc.m_vRclPaint
);
if (IsChecked()) if (IsChecked())
eStat = (wxOwnerDrawn::wxODStatus)(eStat | wxOwnerDrawn::wxODChecked); eStat = (wxOwnerDrawn::wxODStatus)(eStat | wxOwnerDrawn::wxODChecked);
@@ -141,9 +144,6 @@ bool wxCheckListBoxItem::OnDrawItem (
m_pParent->GetSize( NULL m_pParent->GetSize( NULL
,&nParentHeight ,&nParentHeight
); );
::WinQueryWindowRect( m_pParent->GetHWND()
,&rDc.m_vRclPaint
);
nY = nParentHeight - nY - nCheckHeight; nY = nParentHeight - nY - nCheckHeight;
vPenBack = wxPen(vColour, 1, wxSOLID); vPenBack = wxPen(vColour, 1, wxSOLID);
@@ -372,7 +372,7 @@ wxOwnerDrawn* wxCheckListBox::CreateItem (
// Return item size // Return item size
// ---------------- // ----------------
// //
bool wxCheckListBox::OS2OnMeasure ( long wxCheckListBox::OS2OnMeasure (
WXMEASUREITEMSTRUCT* pItem WXMEASUREITEMSTRUCT* pItem
) )
{ {
@@ -391,9 +391,9 @@ bool wxCheckListBox::OS2OnMeasure (
// Add place for the check mark // Add place for the check mark
// //
pStruct->rclItem.xRight += wxOwnerDrawn::GetDefaultMarginWidth(); pStruct->rclItem.xRight += wxOwnerDrawn::GetDefaultMarginWidth();
return TRUE; return long(MRFROM2SHORT((USHORT)m_nItemHeight, (USHORT)(pStruct->rclItem.xRight - pStruct->rclItem.xLeft)));
} }
return FALSE; return 0L;
} // end of wxCheckListBox::CreateItem } // end of wxCheckListBox::CreateItem
// //

View File

@@ -279,6 +279,9 @@ int wxListBox::DoAppend(
if (m_windowStyle & wxLB_OWNERDRAW) if (m_windowStyle & wxLB_OWNERDRAW)
{ {
wxOwnerDrawn* pNewItem = CreateItem(nIndex); // dummy argument wxOwnerDrawn* pNewItem = CreateItem(nIndex); // dummy argument
wxScreenDC vDc;
wxCoord vHeight;
pNewItem->SetName(rsItem); pNewItem->SetName(rsItem);
m_aItems.Insert(pNewItem, nIndex); m_aItems.Insert(pNewItem, nIndex);
@@ -809,7 +812,7 @@ bool wxListBox::OS2Command(
// //
#define OWNER_DRAWN_LISTBOX_EXTRA_SPACE (1) #define OWNER_DRAWN_LISTBOX_EXTRA_SPACE (1)
bool wxListBox::OS2OnMeasure( long wxListBox::OS2OnMeasure(
WXMEASUREITEMSTRUCT* pItem WXMEASUREITEMSTRUCT* pItem
) )
{ {
@@ -827,21 +830,21 @@ bool wxListBox::OS2OnMeasure(
vDc.SetFont(GetFont()); vDc.SetFont(GetFont());
wxCoord vHeight; wxCoord vHeight;
wxCoord vWidth;
pMeasureStruct->rclItem.xRight = 0; GetSize( &vWidth
,NULL
);
pMeasureStruct->rclItem.xRight = (USHORT)vWidth;
pMeasureStruct->rclItem.xLeft = 0; pMeasureStruct->rclItem.xLeft = 0;
pMeasureStruct->rclItem.yTop = 0; pMeasureStruct->rclItem.yTop = 0;
pMeasureStruct->rclItem.yBottom = 0; pMeasureStruct->rclItem.yBottom = 0;
vHeight = vDc.GetCharHeight() * 2.5; vHeight = vDc.GetCharHeight() * 2.5;
pMeasureStruct->rclItem.yTop = vHeight; pMeasureStruct->rclItem.yTop = (USHORT)vHeight;
::WinSendMsg( GetHWND() return long(MRFROM2SHORT((USHORT)vHeight, (USHORT)vWidth));
,LM_SETITEMHEIGHT
,MPFROMLONG(vHeight)
,MPFROMLONG(pMeasureStruct->idItem)
);
return TRUE;
} // end of wxListBox::OS2OnMeasure } // end of wxListBox::OS2OnMeasure
bool wxListBox::OS2OnDraw ( bool wxListBox::OS2OnDraw (

View File

@@ -2841,8 +2841,9 @@ MRESULT wxWindowOS2::OS2WindowProc(
} }
else else
{ {
bProcessed = OS2OnMeasureItem(nIdCtrl, return MRFROMLONG(OS2OnMeasureItem( nIdCtrl
(WXMEASUREITEMSTRUCT *)lParam); ,(WXMEASUREITEMSTRUCT *)lParam
));
} }
if ( bProcessed ) if ( bProcessed )
@@ -3807,7 +3808,7 @@ bool wxWindowOS2::OS2OnDrawItem(
return FALSE; return FALSE;
} // end of wxWindowOS2::OS2OnDrawItem } // end of wxWindowOS2::OS2OnDrawItem
bool wxWindowOS2::OS2OnMeasureItem( long wxWindowOS2::OS2OnMeasureItem(
int lId int lId
, WXMEASUREITEMSTRUCT* pItemStruct , WXMEASUREITEMSTRUCT* pItemStruct
) )
@@ -3833,13 +3834,16 @@ bool wxWindowOS2::OS2OnMeasureItem(
,&nHeight ,&nHeight
)) ))
{ {
MRESULT mRc;
pMeasureStruct->rclItem.xRight = nWidth; pMeasureStruct->rclItem.xRight = nWidth;
pMeasureStruct->rclItem.xLeft = 0L; pMeasureStruct->rclItem.xLeft = 0L;
pMeasureStruct->rclItem.yTop = nHeight; pMeasureStruct->rclItem.yTop = nHeight;
pMeasureStruct->rclItem.yBottom = 0L; pMeasureStruct->rclItem.yBottom = 0L;
return TRUE; mRc = MRFROM2SHORT(nHeight, nWidth);
return LONGFROMMR(mRc);
} }
return FALSE; return 0L;
} }
} }
wxWindow* pItem = FindItem(lId); wxWindow* pItem = FindItem(lId);

View File

@@ -4,7 +4,7 @@ DATA MULTIPLE NONSHARED READWRITE LOADONCALL
CODE LOADONCALL CODE LOADONCALL
EXPORTS EXPORTS
;From library: H:\Dev\Wx2\WxWindows\lib\wx.lib ;From library: H:\DEV\WX2\WXWINDOWS\LIB\wx.lib
;From object file: dummy.cpp ;From object file: dummy.cpp
;PUBDEFs (Symbols available from object file): ;PUBDEFs (Symbols available from object file):
wxDummyChar wxDummyChar
@@ -11902,6 +11902,8 @@ EXPORTS
SetFont__14wxCheckListBoxFRC6wxFont SetFont__14wxCheckListBoxFRC6wxFont
;wxCheckListBox::OnLeftClick(wxMouseEvent&) ;wxCheckListBox::OnLeftClick(wxMouseEvent&)
OnLeftClick__14wxCheckListBoxFR12wxMouseEvent OnLeftClick__14wxCheckListBoxFR12wxMouseEvent
;wxCheckListBox::OS2OnMeasure(void**)
OS2OnMeasure__14wxCheckListBoxFPPv
;From object file: ..\os2\choice.cpp ;From object file: ..\os2\choice.cpp
;PUBDEFs (Symbols available from object file): ;PUBDEFs (Symbols available from object file):
;wxChoice::DoGetItemClientData(int) const ;wxChoice::DoGetItemClientData(int) const
@@ -14230,11 +14232,19 @@ EXPORTS
GetValue__10wxSpinCtrlCFv GetValue__10wxSpinCtrlCFv
;From object file: ..\os2\statbmp.cpp ;From object file: ..\os2\statbmp.cpp
;PUBDEFs (Symbols available from object file): ;PUBDEFs (Symbols available from object file):
;wxStaticBitmap::OnPaint(wxPaintEvent&)
OnPaint__14wxStaticBitmapFR12wxPaintEvent
;wxStaticBitmap::sm_eventTable
sm_eventTable__14wxStaticBitmap
;wxStaticBitmap::sm_eventTableEntries
sm_eventTableEntries__14wxStaticBitmap
__vft14wxStaticBitmap8wxObject __vft14wxStaticBitmap8wxObject
;wxStaticBitmap::Free() ;wxStaticBitmap::Free()
Free__14wxStaticBitmapFv Free__14wxStaticBitmapFv
;wxStaticBitmap::Create(wxWindow*,int,const wxGDIImage&,const wxPoint&,const wxSize&,long,const wxString&) ;wxStaticBitmap::Create(wxWindow*,int,const wxGDIImage&,const wxPoint&,const wxSize&,long,const wxString&)
Create__14wxStaticBitmapFP8wxWindowiRC10wxGDIImageRC7wxPointRC6wxSizelRC8wxString Create__14wxStaticBitmapFP8wxWindowiRC10wxGDIImageRC7wxPointRC6wxSizelRC8wxString
;wxStaticBitmap::GetEventTable() const
GetEventTable__14wxStaticBitmapCFv
;wxStaticBitmap::sm_classwxStaticBitmap ;wxStaticBitmap::sm_classwxStaticBitmap
sm_classwxStaticBitmap__14wxStaticBitmap sm_classwxStaticBitmap__14wxStaticBitmap
;wxStaticBitmap::SetImage(const wxGDIImage&) ;wxStaticBitmap::SetImage(const wxGDIImage&)