本文整理汇总了C++中TRect::SetHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ TRect::SetHeight方法的具体用法?C++ TRect::SetHeight怎么用?C++ TRect::SetHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TRect
的用法示例。
在下文中一共展示了TRect::SetHeight方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StartTracking
// -----------------------------------------------------------------------------
// StartTracking
// -----------------------------------------------------------------------------
//! Called before tracking. The new control value is calculated so that the
//! slider thumb ends up centered on the mouse. This takes into account all
//! of the inset and size values, and also considers the background image
//! and thumb orientation compared to the slider orientation.
//
OSStatus TMeterControl::StartTracking(TCarbonEvent& inEvent, HIPoint& from)
{
float pos;
SInt32 mini, maxi;
TRect bounds = Bounds();
TRect thumbBounds = ScaledThumbBounds();
SliderOrientation boundsOrientation = OrientationForRect(bounds);
mini = GetMinimum();
maxi = GetMaximum();
mTotalDetentMoved = 0;
// compute a thumb bounds oriented the same as the slider
TRect orientedThumbBounds = thumbBounds;
if (boundsOrientation != mImageOrientation)
{
float temp = orientedThumbBounds.Width();
orientedThumbBounds.SetWidth(orientedThumbBounds.Height());
orientedThumbBounds.SetHeight(temp);
}
float distance;
if (boundsOrientation == TSliderControl::kHorizontalOrientation)
{
distance = orientedThumbBounds.Width();
pos = (from.x - bounds.Width()/2.0 - mTopInset + orientedThumbBounds.Width()/2.0) / distance;
}
else
{
distance = orientedThumbBounds.Height();
pos = 1.f - (from.y - bounds.Height()/2.0 - mTopInset + orientedThumbBounds.Height()/2.0) / distance;
}
SInt32 curVal = GetValue();
SInt32 val = SInt32(rint(mini+pos*(maxi-mini+1)));
if ( val > maxi) val = maxi;
if ( val < mini) val = mini;
if (val != curVal) {
SetValue ( val );
}
return noErr;
}
示例2: createNewWindow
void BrowserExtensionSymbian::createNewWindow(const ResourceRequest& request,
const WindowArgs& winArgs,
Frame** partResult)
{
ASSERT(!winArgs.dialog || request.frameName.isEmpty());
if (partResult)
*partResult = NULL;
const KURL& url = request.url();
const String* frameName = request.frameName.isEmpty() ? NULL : &(request.frameName);
if (frameName) {
// FIXME: Can't we just use m_frame->findFrame?
if (CWebCoreFrameBridge* frameBridge = m_frame->bridge()->FindFrameNamed(frameName->des()) )
{
if (!url.isEmpty())
{
String argsReferrer = request.referrer();
String referrer;
if (!argsReferrer.isEmpty())
referrer = argsReferrer;
else
referrer = frameBridge->Referrer();
frameBridge->Callback().LoadURL( url.des(), referrer.des(), request.reload, ETrue, request.frameName, EEventNull );
}
frameBridge->Callback().ActivateWindow();
if (partResult)
*partResult = frameBridge->impl();
return;
}
}
CWebCorePageBridge *pageBridge;
if (winArgs.dialog)
pageBridge = m_frame->bridge()->Callback().createModalDialogWithURL( url.des() );
else
pageBridge = m_frame->bridge()->Callback().createWindowWithURL( url.des(), request.frameName, ETrue );
if (!pageBridge)
return;
CWebCoreFrameBridge *frameBridge = pageBridge->mainFrame();
if ( frameBridge->impl() )
frameBridge->impl()->tree()->setName(AtomicString(request.frameName));
if (partResult)
*partResult = frameBridge->impl();
frameBridge->Callback().setToolbarsVisible( winArgs.toolBarVisible || winArgs.locationBarVisible );
frameBridge->Callback().setStatusbarVisible( winArgs.statusBarVisible );
frameBridge->Callback().setScrollbarsVisible( winArgs.scrollbarsVisible );
frameBridge->Callback().setWindowIsResizable( winArgs.resizable );
TRect windowRect = pageBridge->impl()->windowRect().rect();
if (winArgs.xSet)
windowRect.iTl.iX = winArgs.x;
if (winArgs.ySet)
windowRect.iTl.iY = winArgs.y;
// 'width' and 'height' specify the dimensions of the WebView, but we can only resize the window,
// so we compute a WebView delta and apply it to the window.
TRect webViewRect = pageBridge->callback().outerView()->rect();
if (winArgs.widthSet)
windowRect.SetWidth( windowRect.Width() + winArgs.width - webViewRect.Width() );
if (winArgs.heightSet)
windowRect.SetHeight( windowRect.Height() + winArgs.height - webViewRect.Height() );
pageBridge->impl()->setWindowRect(windowRect);
frameBridge->Callback().showWindow();
}
示例3: TileL
EXPORT_C TBool CEikScrollBarFrame::TileL(TEikScrollBarModel* aHModel, TEikScrollBarModel* aVModel,
TRect& aClientRect, TRect& aInclusiveRect, const TEikScrollBarFrameLayout& aLayout)
{
TRect tempRect(aClientRect);
if(aClientRect.Height() < 0 )
{
aClientRect.iTl.iY = aClientRect.iBr.iY;
aClientRect.iBr.iY = tempRect.iTl.iY;
}
if(aClientRect.Width() < 0 )
{
aClientRect.iTl.iX = aClientRect.iBr.iX;
aClientRect.iBr.iX = tempRect.iTl.iX;
}
tempRect = aInclusiveRect;
if(aInclusiveRect.Height() < 0 )
{
aInclusiveRect.iTl.iY = aInclusiveRect.iBr.iY;
aInclusiveRect.iBr.iY = tempRect.iTl.iY;
}
if(aInclusiveRect.Width() < 0 )
{
aInclusiveRect.iTl.iX = aInclusiveRect.iBr.iX;
aInclusiveRect.iBr.iX = tempRect.iTl.iX;
}
if (iExtension && iExtension->iH.iVisibility!=EOff)
{
if(aClientRect.Height() < ScrollBarBreadth( CEikScrollBar::EHorizontal) )
{
aClientRect.SetHeight( ScrollBarBreadth(CEikScrollBar::EHorizontal) );
}
if(aInclusiveRect.Height() < ScrollBarBreadth( CEikScrollBar::EHorizontal) )
{
aInclusiveRect.SetHeight( ScrollBarBreadth(CEikScrollBar::EHorizontal) );
}
}
TBool sizeChanged = EFalse;
GetScrollBars(EFalse);
CalcTheoreticalScrollBarVisibility(aVModel,aHModel);
if (iV.iVisibility!=EOff)
iV.iModel = *aVModel;
MakeSBarVisible(iV, iScrollBarFrameFlags&EDisplayVScrollBar);
if (iExtension && iExtension->iH.iBar)
{
if (iExtension->iH.iVisibility!=EOff)
iExtension->iH.iModel = *aHModel;
MakeSBarVisible(iExtension->iH, iScrollBarFrameFlags&EDisplayHScrollBar);
}
// Vertical Double span scollbar
if (iV.iBar && TypeOfVScrollBar() == EDoubleSpan && iV.iExternalScrollBarAttached==EFalse )
{
TInt scrollBarWidth = ScrollBarBreadth(CEikScrollBar::EVertical); // is 0 if SB not visible !
TInt horizontalScrollBarWidth = 0;
if (iExtension && iExtension->iH.iVisibility!=EOff)
{
horizontalScrollBarWidth = ScrollBarBreadth(CEikScrollBar::EHorizontal);
}
CAknDoubleSpanScrollBar* scrollbar = static_cast <CAknDoubleSpanScrollBar*> (iV.iBar);
if (scrollbar->FixedLayoutRect().Size() == TSize(0,0))
{
TMargins checkedClientMargin(aLayout.iClientMargin);
TMargins checkedInclusiveMargin(aLayout.iInclusiveMargin);
checkedClientMargin.iTop = Max(0,checkedClientMargin.iTop);
checkedClientMargin.iBottom = Max(0,checkedClientMargin.iBottom);
checkedClientMargin.iRight = Max(0,checkedClientMargin.iRight);
checkedClientMargin.iLeft = Max(0,checkedClientMargin.iLeft);
checkedInclusiveMargin.iTop = Max(0,checkedInclusiveMargin.iTop);
checkedInclusiveMargin.iBottom = Max(0,checkedInclusiveMargin.iBottom);
checkedInclusiveMargin.iRight = Max(0,checkedInclusiveMargin.iRight);
checkedInclusiveMargin.iLeft = Max(0,checkedInclusiveMargin.iLeft);
TInt width = 0;
TInt xPos = 0;
TInt yPos = 0;
TInt height = 0;
if (!AknLayoutUtils::LayoutMirrored())
{
if (aLayout.iTilingMode == TEikScrollBarFrameLayout::EInclusiveRectConstant)
{
width = scrollBarWidth + checkedInclusiveMargin.iRight;
xPos = aInclusiveRect.iBr.iX - width;
yPos = aInclusiveRect.iTl.iY + checkedInclusiveMargin.iTop;
height = aInclusiveRect.Size().iHeight - (checkedInclusiveMargin.iTop + checkedInclusiveMargin.iBottom) - horizontalScrollBarWidth;
if ((aClientRect.iBr.iX + width > aInclusiveRect.iBr.iX) || (aInclusiveRect.iBr.iX - width > aClientRect.iBr.iX))
{
aClientRect.iBr.iX = aInclusiveRect.iBr.iX - width;
sizeChanged = ETrue;
}
}
else
{
//.........这里部分代码省略.........
示例4: StillTracking
// -----------------------------------------------------------------------------
// StillTracking
// -----------------------------------------------------------------------------
//! Called during mouse tracking. Works basically the same as the \c
//! StartTracking() member function, except that thus function also
//! calculates the amount of control value change based on how much the
//! mouse position has changed since the last call to \c StillTracking().
//! This delta value is used for the control and option key modifiers,
//! for higher precision slider control.
//!
OSStatus TMeterControl::StillTracking(TCarbonEvent&inEvent, HIPoint& from)
{
HIPoint mouse,delta;
float d, pos;
SInt32 mini, maxi;
UInt32 modifiers;
TRect bounds = Bounds();
TRect thumbBounds = ScaledThumbBounds();
SliderOrientation boundsOrientation = OrientationForRect(bounds);
mini = GetMinimum();
maxi = GetMaximum();
inEvent.GetParameter<HIPoint>( kEventParamWindowMouseLocation, typeHIPoint, &mouse );
ConvertToLocal(mouse);
delta.x = mouse.x - from.x;
delta.y = mouse.y - from.y;
inEvent.GetParameter( kEventParamKeyModifiers, &modifiers );
// compute a thumb bounds oriented the same as the slider
TRect orientedThumbBounds = thumbBounds;
if (boundsOrientation != mImageOrientation)
{
float temp = orientedThumbBounds.Width();
orientedThumbBounds.SetWidth(orientedThumbBounds.Height());
orientedThumbBounds.SetHeight(temp);
}
float distance;
if (boundsOrientation == TSliderControl::kHorizontalOrientation)
{
distance = orientedThumbBounds.Width();
pos = (mouse.x - bounds.Width()/2.0 - mTopInset + orientedThumbBounds.Width()/2.0) / distance;
d = delta.x / distance;
}
else
{
distance = orientedThumbBounds.Height();
pos = 1.f - (mouse.y - bounds.Height()/2.0 - mTopInset + orientedThumbBounds.Height()/2.0) / distance;
d = -delta.y / distance;
}
SInt32 curVal = GetValue();
if (mUseDetent && (curVal == mDetentValue || abs(curVal - mDetentValue) <= mDetentRange))
{
if (boundsOrientation == TSliderControl::kHorizontalOrientation)
mTotalDetentMoved += delta.x;
else
mTotalDetentMoved += delta.y;
if (fabsf(mTotalDetentMoved) < 15.0)
{
if (curVal != mDetentValue)
SetValue(mDetentValue);
from = mouse;
return noErr;
}
}
mTotalDetentMoved = 0;
SInt32 val;
if ((modifiers == controlKey || modifiers == optionKey))
{
// value depends on how much the mouse moved
SInt32 ratio = 1;
if (modifiers & controlKey)
ratio = 50;
else if (modifiers & optionKey)
ratio = 10;
val = SInt32(rint(curVal + d * (1 + maxi - mini) / ratio));
}
else
{
// value is directly proportional to position
val = SInt32(rint(mini + pos * (1 + maxi - mini)));
}
if ( val > maxi) val = maxi;
if ( val < mini) val = mini;
if (val != curVal) {
SetValue ( val );
from = mouse;
}
return noErr;
}
示例5: CompatibleDraw
//! The fun part of the control
//!
//! XXX need to test with vertically oriented images
void TMeterControl::CompatibleDraw(RgnHandle inLimitRgn, CGContextRef inContext, bool inCompositing)
{
#pragma unused(inLimitRgn)
TRect bounds = Bounds();
CGContextRef context = inContext;
SliderOrientation boundsOrientation = OrientationForRect(bounds);
TRect backBounds = RectForCGImage(mBackImage);
float scaleY = ScaleY();
// draw slider thumb
if (mThumbImage)
{
TRect thumbBounds = ScaledThumbBounds();
// compute a thumb bounds oriented the same as the slider
TRect orientedThumbBounds = thumbBounds;
if (boundsOrientation != mImageOrientation)
{
float temp = orientedThumbBounds.Width();
orientedThumbBounds.SetWidth(orientedThumbBounds.Height());
orientedThumbBounds.SetHeight(temp);
}
// the thumb image is assumed to be of the same orientation as the
// background image
float slideDistance;
if (boundsOrientation == TSliderControl::kVerticalOrientation)
slideDistance = orientedThumbBounds.Height();
else
slideDistance = orientedThumbBounds.Width();
slideDistance -= (mTopInset + mBottomInset) * scaleY;
float position = (float(GetValue() - GetMinimum()) / float(GetMaximum() - GetMinimum())) * slideDistance;
orientedThumbBounds.SetAroundCenter(bounds.CenterX(), bounds.CenterY(),
orientedThumbBounds.Width(), orientedThumbBounds.Height());
#if 0
float xOffset, yOffset;
if (boundsOrientation == TSliderControl::kVerticalOrientation)
{
xOffset = bounds.CenterX() + mXInset - orientedThumbBounds.Width()/2.0;
yOffset = bounds.MinY() + mTopInset + (bounds.Height() + slideDistance) / 2.0;
}
else
{
xOffset = bounds.MinX() + mTopInset + (bounds.Width() + slideDistance) / 2.0;
yOffset = bounds.CenterY() + mXInset - - orientedThumbBounds.Height()/2.0;;
}
#else
float xOffset, yOffset;
if (boundsOrientation == TSliderControl::kVerticalOrientation)
{
xOffset = bounds.CenterX() + mXInset - orientedThumbBounds.Width()/2.0;
yOffset = bounds.CenterY() + mTopInset - slideDistance / 2.0;
}
else
{
yOffset = bounds.CenterY() + mXInset - orientedThumbBounds.Height()/2.0;;
xOffset = bounds.CenterX() + mTopInset - slideDistance / 2.0;
}
#endif
CGContextTranslateCTM(context, xOffset, yOffset);
orientedThumbBounds.SetOrigin(thumbBounds.Origin());
if (boundsOrientation == TSliderControl::kHorizontalOrientation) {
orientedThumbBounds.SetWidth(position);
} else {
orientedThumbBounds.MoveBy(0, orientedThumbBounds.Height()-position);
orientedThumbBounds.SetHeight(position);
}
CGContextClipToRect(context, orientedThumbBounds);
if (mImageOrientation != boundsOrientation)
{
CGContextRotateCTM(context, DegreesToRadians(90.0));
}
HIViewDrawCGImage(context, &thumbBounds, mThumbImage);
}
}