m_pSelectedInto = NULL;
m_nNumColors = 0;
m_pBitmapMask = NULL;
- m_hBitmap = (WXHBITMAP) NULL;
+ m_hBitmap = (WXHBITMAP) NULL;
} // end of wxBitmapRefData::wxBitmapRefData
void wxBitmapRefData::Free()
LoadFile( nId
,(int)lType
);
+ SetId(nId);
} // end of wxBitmap::wxBitmap
bool wxBitmap::Create(
// Controls use the same font and colours as their parent dialog by default
//
InheritAttributes();
+ SetXComp(0);
+ SetYComp(0);
if (nW == 0 || nH == 0)
SetBestSize(rSize);
return TRUE;
if(m_brush.GetStyle() == wxTRANSPARENT)
lControl = DRO_OUTLINE;
- ::GpiSetColor(m_hPS, lColor);
+ ::GpiSetColor(m_hPS, lBorderColor);
::GpiBox( m_hPS // handle to a presentation space
,lControl // draw the box outline ? or ?
,&vPoint[1] // address of the corner
LONG lItem;
- lItem = LONGFROMMR(::WinSendMsg(GetHwnd(), LM_QUERYSELECTION, (MPARAM)N, (MPARAM)0));
- return (lItem != LIT_NONE);
+ if (GetWindowStyleFlag() & wxLB_EXTENDED)
+ {
+ if (N == 0)
+ lItem = LONGFROMMR(::WinSendMsg(GetHwnd(), LM_QUERYSELECTION, (MPARAM)LIT_FIRST, (MPARAM)0));
+ else
+ lItem = LONGFROMMR(::WinSendMsg(GetHwnd(), LM_QUERYSELECTION, (MPARAM)(N - 1), (MPARAM)0));
+ }
+ else
+ {
+ lItem = LONGFROMMR(::WinSendMsg(GetHwnd(), LM_QUERYSELECTION, (MPARAM)LIT_FIRST, (MPARAM)0));
+ }
+ return (lItem == (LONG)N && lItem != LIT_NONE);
} // end of wxListBox::IsSelected
wxClientData* wxListBox::DoGetItemClientObject(
,(LONG)nYOffset
,(LONG)nMaxLen
,(LONG)nCy
- ,SWP_ZORDER | SWP_SIZE | SWP_MOVE | SWP_SHOW
+ ,SWP_ZORDER | SWP_SHOW
+ );
+ }
+ }
+ else
+ {
+ //
+ // Now deal with a vertical slider
+ //
+
+ if (m_lWindowStyle & winSL_LABELS )
+ {
+ int nMinLen = 0;
+ int nMaxLen = 0;
+
+ ::WinQueryWindowText((HWND)m_hStaticMin, 300, zBuf);
+ GetTextExtent(zBuf, &lMinLen, &nCyf, NULL, NULL, &this->GetFont());
+
+ ::WinQueryWindowText((HWND)m_hStaticMax, 300, zBuf);
+ GetTextExtent(zBuf, &lMaxLen, &nCyf, NULL, NULL, &this->GetFont());
+
+ if (m_hStaticValue)
+ {
+ int nNewWidth = (DAWUTL_MAX(nMinLen, nMaxLen));
+
+ ::WinSetWindowPos( (HWND)m_hStaticValue
+ ,HWND_TOP
+ ,(LONG)nXOffset
+ ,(LONG)nYOffset + nHeight + nCyf
+ ,(LONG)nNewWidth
+ ,(LONG)nCyf
+ ,SWP_SIZE | SWP_MOVE
+ );
+ }
+ ::WinSetWindowPos( (HWND)m_hStaticMax
+ ,HWND_TOP
+ ,(LONG)nXOffset
+ ,(LONG)nYOffset + nHeight
+ ,(LONG)nMaxLen
+ ,(LONG)nCyf
+ ,SWP_SIZE | SWP_MOVE
+ );
+ ::WinSetWindowPos( (HWND)m_hStaticMin
+ ,HWND_TOP
+ ,(LONG)nXOffset
+ ,(LONG)nYOffset - nCyf
+ ,(LONG)nMinLen
+ ,(LONG)nCyf
+ ,SWP_SIZE | SWP_MOVE
);
}
}
- //
- // Now deal with a vertical slider -- OS/2 doesn't have vertical sliders
- //
} // end of wxSlider::AdjustSubControls
void wxSlider::ClearSel()
vSlData.cbSize = sizeof(SLDCDATA);
if (m_windowStyle & wxSL_VERTICAL)
- lMsStyle = SLS_VERTICAL | WS_VISIBLE | WS_TABSTOP;
+ lMsStyle = SLS_VERTICAL | SLS_HOMEBOTTOM | WS_VISIBLE | WS_TABSTOP;
else
- lMsStyle = SLS_HORIZONTAL | WS_VISIBLE | WS_TABSTOP;
+ lMsStyle = SLS_HORIZONTAL | SLS_HOMELEFT| WS_VISIBLE | WS_TABSTOP;
if (m_windowStyle & wxCLIP_SIBLINGS)
lMsStyle |= WS_CLIPSIBLINGS;
lMsStyle |= SLS_PRIMARYSCALE1 | SLS_PRIMARYSCALE2;
else
lMsStyle |= SLS_PRIMARYSCALE2;
+ lMsStyle |= SLS_RIBBONSTRIP;
m_nPageSize = ((nMaxValue - nMinValue)/10);
vSlData.usScale1Increments = m_nPageSize;
//
::WinSendMsg( hScrollBar
,SLM_SETTICKSIZE
- ,MPFROM2SHORT(SMA_SETALLTICKS, 6)
+ ,MPFROM2SHORT(SMA_SETALLTICKS, (USHORT)12)
,NULL
);
//
SubclassWin(GetHWND());
::WinSetWindowText((HWND)m_hWnd, "");
- wxFont* pTextFont = new wxFont( 10
- ,wxMODERN
- ,wxNORMAL
- ,wxNORMAL
- );
- SetFont(*pTextFont);
+ SetFont(*wxSMALL_FONT);
if (m_windowStyle & wxSL_LABELS)
{
//
,sizeof(LONG)
,(PVOID)&lColor
);
+ vColour.Set(wxString("BLUE"));
+ lColor = (LONG)vColour.GetPixel();
+ ::WinSetPresParam( m_hWnd
+ ,PP_HILITEBACKGROUNDCOLOR
+ ,sizeof(LONG)
+ ,(PVOID)&lColor
+ );
SetValue(nValue);
delete pTextFont;
return TRUE;
::WinSetWindowPos( (HWND)m_hStaticMin
,HWND_TOP
,(LONG)nXOffset
- ,(LONG)nYOffset - nCyf
+ ,(LONG)nYOffset - (nCyf * 1.2)
,(LONG)nMinLen
,(LONG)nCy
,SWP_ZORDER | SWP_SIZE | SWP_MOVE | SWP_SHOW
::WinSetWindowPos( (HWND)m_hStaticMax
,HWND_TOP
,(LONG)nXOffset
- ,(LONG)nYOffset - nCyf
+ ,(LONG)nYOffset - (nCyf * 1.2)
,(LONG)nMaxLen
,(LONG)nCy
,SWP_ZORDER | SWP_SIZE | SWP_MOVE | SWP_SHOW
// The height needs to be a bit bigger under Win95 if using native
// 3D effects.
//
- nValueHeight = (int)(nValueHeight * 1.5);
::WinSetWindowPos( (HWND)m_hStaticValue
,HWND_TOP
,(LONG)nXOffset
- ,(LONG)nYOffset
+ ,(LONG)nYOffset + lHeight
,(LONG)nNewWidth
,(LONG)nValueHeight
,SWP_ZORDER | SWP_SIZE | SWP_MOVE | SWP_SHOW
);
- nYOffset -= nValueHeight;
- nUsedHeight += nValueHeight;
+ nUsedHeight += nCy;
}
::WinSetWindowPos( (HWND)m_hStaticMin
,HWND_TOP
,(LONG)nXOffset
- ,(LONG)nYOffset
+ ,(LONG)nYOffset + lHeight -lCyf
,(LONG)nMinLen
,(LONG)nCy
,SWP_ZORDER | SWP_SIZE | SWP_MOVE | SWP_SHOW
);
- nYOffset -= nCy;
nUsedHeight += nCy;
int nSliderLength = nHeight1 - (nUsedHeight + (2 * nCy));
if (nSliderLength < 100)
nSliderLength = 100;
- ::WinSetWindowPos( (HWND)m_hStaticMin
+ ::WinSetWindowPos( GetHwnd()
,HWND_TOP
,(LONG)nXOffset
,(LONG)nYOffset
,(LONG)nSliderLength
,SWP_ZORDER | SWP_SIZE | SWP_MOVE | SWP_SHOW
);
- nYOffset -= nSliderLength;
nUsedHeight += nSliderLength;
::WinSetWindowPos( (HWND)m_hStaticMax
,HWND_TOP
,SPBQ_UPDATEIFVALID
)
);
- lVal - atol(zVal);
- return lVal;
+ lVal = atol(zVal);
+ return (int)lVal;
} // end of wxSpinCtrl::GetValue
void wxSpinCtrl::OnChar (
return TRUE;
} // end of wxSpinCtrl::Show
-#endif //wxUSE_SPINBTN
\ No newline at end of file
+#endif //wxUSE_SPINBTN
IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl)
+static wxGDIImage* ConvertImage(
+ const wxGDIImage& rBitmap
+)
+{
+ bool bIsIcon = rBitmap.IsKindOf( CLASSINFO(wxIcon) );
+
+ if(!bIsIcon )
+ {
+ wxASSERT_MSG( wxDynamicCast(&rBitmap, wxBitmap),
+ _T("not an icon and not a bitmap?") );
+
+ const wxBitmap& rBmp = (const wxBitmap&)rBitmap;
+ wxMask* pMask = rBmp.GetMask();
+
+ if (pMask && pMask->GetMaskBitmap())
+ {
+ wxIcon* pIcon = new wxIcon;
+
+ pIcon->CopyFromBitmap(rBmp);
+ return pIcon;
+ }
+ return new wxBitmap(rBmp);
+ }
+
+ // copying a bitmap is a cheap operation
+ return new wxIcon( (const wxIcon&)rBitmap );
+} // end of ConvertImage
+
// ---------------------------------------------------------------------------
// wxStaticBitmap
// ---------------------------------------------------------------------------
, const wxString& rName
)
{
+ ERRORID vError;
+ wxString sError;
+
Init();
SetName(rName);
if (pParent)
pParent->AddChild(this);
- m_backgroundColour = pParent->GetBackgroundColour() ;
- m_foregroundColour = pParent->GetForegroundColour() ;
-
if (nId == -1)
m_windowId = (int)NewControlId();
else
int nY = rPos.y;
int nWidth = rSize.x;
int nHeight = rSize.y;
+ char zId[16];
m_windowStyle = lStyle;
m_bIsIcon = rBitmap.IsKindOf(CLASSINFO(wxIcon));
- int nWinstyle = m_bIsIcon ? SS_ICON : SS_BITMAP;
+ //
+ // For now we only support an ICON
+ //
+ int nWinstyle = SS_ICON;
+ sprintf(zId, "#%d", rBitmap.GetId());
m_hWnd = (WXHWND)::WinCreateWindow( pParent->GetHWND()
,WC_STATIC
- ,rName.c_str()
+ ,zId
,nWinstyle | WS_VISIBLE
,0,0,0,0
,pParent->GetHWND()
,NULL
,NULL
);
-
+ if (!m_hWnd)
+ {
+ vError = ::WinGetLastError(wxGetInstance());
+ sError = wxPMErrorToStr(vError);
+ return FALSE;
+ }
wxCHECK_MSG( m_hWnd, FALSE, wxT("Failed to create static bitmap") );
-
- SetImage(rBitmap);
+ m_pImage = ConvertImage(rBitmap);
+ m_pImage->SetHandle((WXHWND)::WinSendMsg(m_hWnd, SM_QUERYHANDLE, (MPARAM)0, (MPARAM)0));
// Subclass again for purposes of dialog editing mode
SubclassWin(m_hWnd);
- SetFont(*wxSMALL_FONT);
- SetSize(nX, nY, nWidth, nHeight);
- return(FALSE);
-}
+ return(TRUE);
+} // end of wxStaticBitmap::Create
bool wxStaticBitmap::ImageIsOk() const
{
void wxStaticBitmap::Free()
{
- delete m_pImage;
+ if (m_pImage)
+ delete m_pImage;
m_pImage = NULL;
-}
+} // end of wxStaticBitmap::Free
wxSize wxStaticBitmap::DoGetBestSize() const
{
- // reuse the current size (as wxWindow does) instead of using some
+ //
+ // Reuse the current size (as wxWindow does) instead of using some
// arbitrary default size (as wxControl, our immediate base class, does)
+ //
return wxWindow::DoGetBestSize();
}
const wxGDIImage& rBitmap
)
{
- Free();
-
- m_bIsIcon = rBitmap.IsKindOf(CLASSINFO(wxIcon));
- if (m_bIsIcon)
- m_pImage = new wxIcon((const wxIcon&)rBitmap);
- else
- m_pImage = new wxBitmap((const wxBitmap &)rBitmap);
-
- int nX;
- int nY;
- int nW;
- int nH;
-
- GetPosition(&nX, &nY);
- GetSize(&nW, &nH);
+ int nX = 0;
+ int nY = 0;
+ int nWidth = 0;
+ int nHeight = 0;
+ Free();
::WinSendMsg( GetHwnd()
,SM_SETHANDLE
- ,MPFROMHWND(m_pImage->GetHandle())
+ ,MPFROMHWND(rBitmap.GetHandle())
,NULL
);
- if (ImageIsOk())
- {
- int nWidth = rBitmap.GetWidth();
- int nHeight = rBitmap.GetHeight();
+ m_pImage = ConvertImage(rBitmap);
- if (nWidth && nHeight)
- {
- nW = nWidth;
- nW = nHeight;
-
- ::WinSetWindowPos( GetHwnd()
- ,HWND_TOP
- ,nX
- ,nY
- ,nWidth
- ,nHeight
- ,SWP_SIZE | SWP_MOVE | SWP_SHOW
- );
- }
- }
+ GetPosition(&nX, &nY);
+ GetSize(&nWidth, &nHeight);
RECTL vRect;
- vRect.xLeft = nW;
+ vRect.xLeft = nX;
vRect.yTop = nY;
- vRect.xRight = nX + nW;
- vRect.yBottom = nY + nH;
+ vRect.xRight = nX + nWidth;
+ vRect.yBottom = nY + nHeight;
::WinInvalidateRect(GetHwndOf(GetParent()), &vRect, TRUE);
}
,rsName
))
return FALSE;
- return OS2CreateControl( _T("STATIC")
- ,_T("")
- ,rPos
- ,vSize
- ,lStyle
- );
+ if (!OS2CreateControl( "STATIC"
+ ,SS_FGNDFRAME
+ ,rPos
+ ,rSize
+ ,rsName
+ ))
+ return FALSE;
+
+ wxColour vColour;
+
+ vColour.Set(wxString("GREY"));
+
+ LONG lColor = (LONG)vColour.GetPixel();
+
+ ::WinSetPresParam( m_hWnd
+ ,PP_FOREGROUNDCOLOR
+ ,sizeof(LONG)
+ ,(PVOID)&lColor
+ );
+ return TRUE;
} // end of wxStaticLine::Create
WXDWORD wxStaticLine::OS2GetStyle(
}
m_windowStyle = lStyle;
+ m_bIsMLE = FALSE;
long lSstyle = WS_VISIBLE | WS_TABSTOP;
//
// Set font, position, size and initial value
//
- wxFont* pTextFont = new wxFont( 10
+ wxFont* pTextFont = new wxFont( 8
,wxMODERN
,wxNORMAL
,wxNORMAL
::WinQueryWindowPos(m_hWnd, &vSwp);
SetXComp(vSwp.x);
SetYComp(vSwp.y);
- SetSize( vPos.x
- ,vPos.y
+ SetSize( vPos.x - GetXComp()
+ ,vPos.y - GetYComp()
,rSize.x
,rSize.y
);