make possible to build with c++0x

This commit is contained in:
Caolán McNamara 2010-11-23 15:47:07 +00:00
parent ff1edf5a38
commit 43bc8a784e
2 changed files with 16 additions and 3 deletions

View file

@ -57,11 +57,18 @@ namespace basebmp
}
};
//Current c++0x draft (apparently) has std::identity, but not operator()
template<typename T> struct SGI_identity : public std::unary_function<T,T>
{
T& operator()(T& x) const { return x; }
const T& operator()(const T& x) const { return x; }
};
/// Get converter from given data type to sal_uInt32
template< typename DataType > struct uInt32Converter
{
typedef std::identity<DataType> to;
typedef std::identity<DataType> from;
typedef SGI_identity<DataType> to;
typedef SGI_identity<DataType> from;
};
template< unsigned int RedIndex,
unsigned int GreenIndex,

View file

@ -918,7 +918,13 @@ BOOL GtkSalGraphics::drawNativeMixedStateCheck( ControlType nType,
// draw upper half in off state
const_cast<ImplControlValue&>(aValue).setTristateVal( BUTTONVALUE_OFF );
XLIB_Region aRegion = XCreateRegion();
XRectangle aXRect = { aCtrlRect.Left(), aCtrlRect.Top(), aCtrlRect.GetWidth(), aCtrlRect.GetHeight() };
XRectangle aXRect =
{
static_cast<short>(aCtrlRect.Left()),
static_cast<short>(aCtrlRect.Top()),
static_cast<unsigned short>(aCtrlRect.GetWidth()),
static_cast<unsigned short>(aCtrlRect.GetHeight())
};
const unsigned short nH = aXRect.height/2;
aXRect.height -= nH;
XUnionRectWithRegion( &aXRect, aRegion, aRegion );