本文整理汇总了C++中Rect::GetHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ Rect::GetHeight方法的具体用法?C++ Rect::GetHeight怎么用?C++ Rect::GetHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rect
的用法示例。
在下文中一共展示了Rect::GetHeight方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawRectangle
void Graphics::DrawRectangle(Pen* pen, const Rect& rc) {
cairo_t* cg = reinterpret_cast<cairo_t*>(_private);
cairo_save(cg);
PenPrivate* pp = reinterpret_cast<PenPrivate*>(pen->_private);
cairo_pattern_t* cp = pp->pattern;
cairo_set_source(cg, cp);
cairo_set_line_width(cg, pp->width);
cairo_translate(cg, rc.GetLeft(), rc.GetTop());
cairo_rectangle(cg, 0, 0, rc.GetWidth(), rc.GetHeight());
cairo_stroke(cg);
cairo_restore(cg);
}
示例2: FillRectangle
void Graphics::FillRectangle(Brush* brush, const Rect& rc) {
cairo_t* cg = reinterpret_cast<cairo_t*>(_private);
cairo_save(cg);
if(cg!=0) {
cairo_pattern_t* cp = reinterpret_cast<cairo_pattern_t*>(brush->_private);
if(cp!=0) {
cairo_set_source(cg, cp);
cairo_translate(cg, rc.GetLeft(), rc.GetTop());
cairo_rectangle(cg, 0, 0, rc.GetWidth(), rc.GetHeight());
cairo_fill(cg);
}
}
cairo_restore(cg);
}
示例3: GetSourceFilePath
int Navigator::LineDisplay::DoPaint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style, int x) const
{
w.DrawRect(r, paper);
const NavLine& l = q.To<NavLine>();
x += r.left;
String p = GetSourceFilePath(l.file);
int y = r.top + (r.GetHeight() - StdFont().GetCy()) / 2;
PaintTeXt(w, x, y, GetFileName(GetFileFolder(p)) + "/", StdFont(), ink);
PaintTeXt(w, x, y, GetFileName(p), StdFont().Bold(), ink);
PaintTeXt(w, x, y, " (", StdFont(), ink);
PaintTeXt(w, x, y, AsString(l.line), StdFont().Bold(), ink);
PaintTeXt(w, x, y, ")", StdFont(), ink);
return x - r.left;
}
示例4: PaintFileName
int Navigator::NavigatorDisplay::DoPaint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const
{
int ii = q;
if(ii < 0 || ii >= item.GetCount())
return 0;
const NavItem& m = *item[ii];
bool focuscursor = (style & (FOCUS|CURSOR)) == (FOCUS|CURSOR) || (style & SELECT);
int x = r.left;
int ry = r.top + r.GetHeight() / 2;
int y = ry - Draw::GetStdFontCy() / 2;
if(findarg(m.kind, KIND_FILE, KIND_NEST) >= 0) {
w.DrawRect(r, focuscursor ? paper : m.kind == KIND_NEST ? Blend(SColorMark, SColorPaper, 220)
: SColorFace);
if(m.kind == KIND_FILE)
return PaintFileName(w, r, m.type, ink);
String h = FormatNest(m.type);
w.DrawText(x, y, h, StdFont().Bold(), ink);
return GetTextSize(h, StdFont().Bold()).cx;
}
w.DrawRect(r, paper);
if(m.kind == KIND_LINE) {
w.DrawText(x, y, m.type, StdFont().Bold(), ink);
return GetTextSize(m.type, StdFont().Bold()).cx;
}
PaintCppItemImage(w, x, ry, m.access, m.kind, focuscursor);
x += Zx(15);
Vector<ItemTextPart> n = ParseItemNatural(m.name, m.natural, m.ptype, m.pname, m.type,
m.tname, m.ctname, ~m.natural + m.at);
int starti = 0;
for(int i = 0; i < n.GetCount(); i++)
if(n[i].type == ITEM_NAME) {
starti = i;
break;
}
PaintText(w, x, y, m.natural, n, starti, n.GetCount(), focuscursor, ink, false);
if(starti) {
const char *h = " : ";
w.DrawText(x, y, h, BrowserFont(), SColorText);
x += GetTextSize(h, BrowserFont()).cx;
}
PaintText(w, x, y, m.natural, n, 0, starti, focuscursor, ink, false);
return x;
}
示例5: StdFont
void StdDisplayClass::Paint0(Draw& w, const Rect& r, const Value& q,
Color ink, Color paper, dword s) const {
LLOG("StdDisplay::Paint0: " << q << " ink:" << ink << " paper:" << paper);
WString txt;
Font font = StdFont();
int a = align;
int x = r.left;
int width = r.GetWidth();
if(IsType<AttrText>(q)) {
const AttrText& t = ValueTo<AttrText>(q);
txt = t.text;
font = t.font;
if(!IsNull(t.paper))
paper = t.paper;
if(!IsNull(t.ink))
ink = t.ink;
if(!IsNull(t.normalink) && !(s & (CURSOR|SELECT|READONLY)))
ink = t.normalink;
if(!IsNull(t.normalpaper) && !(s & (CURSOR|SELECT|READONLY)))
paper = t.normalpaper;
if(!IsNull(t.align))
a = t.align;
if(!IsNull(t.img)) {
Size isz = t.img.GetSize();
w.DrawImage(x, r.top + max((r.Height() - isz.cy) / 2, 0), t.img);
x += isz.cx + t.imgspc;
}
}
else
txt = IsString(q) ? q : StdConvert().Format(q);
Size tsz = GetTLTextSize(txt, font);
if(a == ALIGN_RIGHT)
x = r.right - tsz.cx;
if(a == ALIGN_CENTER)
x += (width - tsz.cx) / 2;
int tcy = GetTLTextHeight(txt, font);
int tt = r.top + max((r.Height() - tcy) / 2, 0);
if(tsz.cx > width) {
Size isz = DrawImg::threedots().GetSize();
int wd = width - isz.cx;
w.Clip(r.left, r.top, wd, r.GetHeight());
DrawTLText(w, x, tt, width, txt, font, ink);
w.End();
w.DrawImage(r.left + wd, tt + font.Info().GetAscent() - isz.cy, DrawImg::threedots(), ink);
}
else
DrawTLText(w, x, tt, width, txt, font, ink);
}
示例6: Paint
virtual void Paint(Draw& w, const Rect& r, const Value& q,
Color ink, Color paper, dword style) const
{
w.DrawRect(r, paper);
Image m = q;
if(IsNull(m))
return;
Size isz = m.GetSize();
if(isz.cx > 200 || isz.cy > 200)
m = IconDesImg::LargeImage();
else
if(isz.cx > r.GetWidth() || isz.cy > r.GetHeight())
m = CachedRescale(m, GetFitSize(m.GetSize(), r.GetSize()));
Point p = r.CenterPos(m.GetSize());
w.DrawImage(p.x, p.y, m);
}
示例7: FullScreen
void Window::FullScreen()
{
::GetClientRect(hWnd_, &restoreFullRect_);
Point point;
::ClientToScreen(hWnd_, &point);
restoreFullRect_.left = point.x;
restoreFullRect_.top = point.y;
restoreFullRect_.right += point.x;
restoreFullRect_.bottom += point.y;
MONITORINFO oMonitor = {};
oMonitor.cbSize = sizeof(oMonitor);
::GetMonitorInfo(::MonitorFromWindow(*this, MONITOR_DEFAULTTONEAREST), &oMonitor);
Rect rcWork = oMonitor.rcWork;
::SetWindowPos(hWnd_, nullptr, rcWork.left, rcWork.top, rcWork.GetWidth(), rcWork.GetHeight(), SWP_SHOWWINDOW | SWP_NOZORDER);
}
示例8: GetSize
void DockCont::Handle::Paint(Draw& w)
{
if (IsShown() && dc) {
const DockableCtrl::Style &s = dc->GetStyle();
Rect r = GetSize();
const Rect &m = s.handle_margins;
Point p;
if (s.handle_vert)
p = Point(r.left-1 + m.left, r.bottom - m.bottom);
else
p = Point(r.left + m.left, r.top + m.top);
ChPaint(w, r, s.handle[focus]);
Image img = dc->GetIcon();
if (!img.IsEmpty()) {
if (s.handle_vert) {
int isz = r.GetWidth();
p.y -= isz;
isz -= (m.left + m.right);
ChPaint(w, max(p.x+m.left, r.left), p.y, isz, isz, img);
p.y -= 2;
}
else {
int isz = r.GetHeight();
isz -= (m.top + m.bottom);
ChPaint(w, p.x, max(p.y, r.top), isz, isz, img);
p.x += isz + 2;
}
}
if (!s.title_font.IsNull()) {
Ctrl *c = GetLastChild();
while (c && !c->IsShown() && c->GetParent())
c = c->GetNext();
if (s.handle_vert)
r.top = c ? c->GetRect().bottom + m.top : m.top;
else
r.right = c ? c->GetRect().left + m.right : m.right;
w.Clip(r);
WString text = IsNull(dc->GetGroup()) ? dc->GetTitle() : (WString)Format("%s (%s)", dc->GetTitle(), dc->GetGroup());
w.DrawText(p.x, p.y, s.handle_vert ? 900 : 0, text, s.title_font, s.title_ink[focus]);
w.End();
}
}
}
示例9: WndSetPos
void Ctrl::WndSetPos(const Rect& rect)
{
LLOG("WndSetPos0 " << rect);
GuiLock __;
if(!IsOpen())
return;
Ptr<Ctrl> this_ = this;
SweepConfigure(false); // Remove any previous GDK_CONFIGURE for this window
if(!this_ || !IsOpen())
return;
// gtk_window_move(gtk(), rect.left, rect.top);
// gtk_window_resize(gtk(), rect.GetWidth(), rect.GetHeight());
gdk_window_move_resize(gdk(), rect.left, rect.top, rect.GetWidth(), rect.GetHeight());
int t0 = msecs();
do { // Wait up to 500ms for corresponding GDK_CONFIGURE to arrive
if(SweepConfigure(true))
break;
}
while(msecs() - t0 < 500);
LLOG("-- WndSetPos0 " << rect << " " << msecs() - t0);
}
示例10: SetSurface
void SetSurface(SystemDraw& w, const Rect& dest, const RGBA *pixels, Size srcsz, Point srcoff)
{
GuiLock __;
XImage ximg;
sInitXImage(ximg, srcsz);
ximg.bitmap_pad = 32;
ximg.bytes_per_line = sizeof(RGBA) * srcsz.cx;
ximg.bits_per_pixel = 32;
ximg.blue_mask = 0x00ff0000;
ximg.green_mask = 0x0000ff00;
ximg.red_mask = 0x000000ff;
ximg.bitmap_unit = 32;
ximg.depth = 24;
ximg.data = (char *)pixels;
XInitImage(&ximg);
Drawable dw = w.GetDrawable();
GC gc = XCreateGC(Xdisplay, dw, 0, 0);
Point p = dest.TopLeft() + w.GetOffset();
XPutImage(Xdisplay, dw, gc, &ximg, srcoff.x, srcoff.y,
p.x, p.y, dest.GetWidth(), dest.GetHeight());
XFreeGC(Xdisplay, gc);
}
示例11: SetupViewport
void ViewContext::SetupViewport(const Rect &size, SCREEN_ORIENTATION_ANGLE screenOrientation)
{
Rect viewport;
if (m_viewportIsFixedSize)
{
viewport = m_viewport;
m_screenOrientation = SCREEN_ANGLE_0;
}
else
{
// based on the orientation, we may need to swap the width/height
// of the passed viewport dimensions
// (we don't do viewport rotation if the viewport is fixed)
if (!IgnoringScreenRotation() && (screenOrientation == SCREEN_ANGLE_90 || screenOrientation == SCREEN_ANGLE_270))
{
// swap width and height
viewport.left = size.top;
viewport.top = size.left;
viewport.right = size.bottom;
viewport.bottom = size.right;
}
else
viewport = size;
// we **don't** want this to be rotated
m_viewport = size;
m_screenOrientation = screenOrientation;
}
// we **do** obviously want this to be rotated (if there is a rotation)
GL_CALL(glViewport(viewport.left, viewport.top, viewport.GetWidth(), viewport.GetHeight()));
// we also **don't** want the camera to work with a rotated viewport
if (m_camera != NULL)
m_camera->OnResize(m_viewport);
}
示例12: Layout
void SDLExample::Layout() {
SDLCtrl::Layout();
if (!IsReady())
return;
Rect r = GetRect();
for(int i = 0; i < r.GetWidth(); i++)
sintab[i] = sin(i * M_PI / 180.0);
for(int i = 0; i < MAXPOINT; i++) {
points[i].x = rand() % (r.GetWidth() - 1);
points[i].y = rand() % (r.GetHeight() - 1);
points[i].sx = (rand() & 1) + 1;
points[i].sy = (rand() & 1) + 1;
points[i].col = (rand() % 255);
}
if (!demoInitialized)
return;
int width = GetWidth();
int height = GetHeight();
surf.Resize(width, height);
SetupPalette(surf.GetSurface());
SetupPalette(GetSurface());
j = 0;
k = 0;
len0 = LengthStr(scroll[j]);
len1 = len0;
xmax = (width - len1) / 2;
x0 = width;
x1 = -len0;
}
示例13: Lay
void MultiButton::Lay(Rect& r)
{
int border, lx, rx;
bool frm = Metrics(border, lx, rx);
bool left = false;
bool right = false;
for(int i = 0; i < button.GetCount(); i++) {
SubButton& b = button[i];
int cx = 0; int x = 0;
GetPos(b, lx, rx, x, cx);
(b.left ? left : right) = true;
}
if(ComplexFrame()) {
r.right = r.left + rx;
r.left += lx;
}
else
if(frm) {
Rect m = GetMargin();
r = Rect(r.left + max(lx, m.left), r.top + m.top, min(rx, r.right - m.right), r.bottom - m.bottom);
}
else {
Rect m = style->margin;
r = Rect(r.left + max(lx, m.left), r.top + m.top, min(rx, r.right - m.right), r.bottom - m.bottom);
if(!IsTrivial() || style->trivialsep) {
if(left)
r.left++;
if(right)
r.right--;
}
}
if(!IsNull(valuecy)) {
r.top += (r.GetHeight() - valuecy) / 2;
r.bottom = r.top + valuecy;
}
}
示例14: RectPath
void SystemDraw::RectPath(const Rect& r)
{
cairo_rectangle(cr, r.left, r.top, r.GetWidth(), r.GetHeight());
}
示例15: DrawRect
void Draw::DrawRect(const Rect& rect, Color color)
{
DrawRect(rect.left, rect.top, rect.GetWidth(), rect.GetHeight(), color);
}