本文整理汇总了C++中JRect::shrink方法的典型用法代码示例。如果您正苦于以下问题:C++ JRect::shrink方法的具体用法?C++ JRect::shrink怎么用?C++ JRect::shrink使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JRect
的用法示例。
在下文中一共展示了JRect::shrink方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update
void JBtnObj::update(JGraphics g, double dx, double dy, JRegion& rgn, double scale) {
JRect rect = getIExtent(dx, dy, scale), thumb;
JRegion frgn(rect.shrinkBy(depth, depth));
if ((rect.width > 0) && (rect.height > 0)) {
g.setJColor(bkgnd);
g.fillJRect(rect);
thumb = rect.shrink(depth, depth);
if ((thumb.width > 0) && (thumb.height > 0)) {
switch (type) {
case TYPE_RECT:
g.draw3DJRect(thumb, ((value) ? -depth : depth));
break;
case TYPE_LEFT:
case TYPE_RIGHT:
case TYPE_UP:
case TYPE_DOWN:
g.draw3DJTriangle(thumb,
((value) ? -depth : depth), type-1);
break;
}
if (label.length()) {
g.setJColor(color);
drawText(g, label, thumb.shrink(depth, depth));
}
}
}
}
示例2: update
void JLEDObj::update(JGraphics g, double dx, double dy, JRegion& rgn, double scale) {
JRect rect = getIExtent(dx, dy, scale);
if (value == 0) g.setJColor(bkgnd);
else g.setJColor(color);
if ((rect.width > depth2) && (rect.height > depth2)) {
g.fillJRect(rect.shrink(depth, depth));
} else g.fillJRect(rect);
}
示例3: getIExtent
void J1DSliderObj::paint(JGraphics g, double dx, double dy, JRegion& rgn, double scale) {
JRect rect = getIExtent(dx, dy, scale);
g.setJColor(moduleColor);
if ((rect.width > depth2+2) && (rect.height > depth2+2)) {
g.draw3DJRect(rect, depth);
g.draw3DJRect(rect.shrink(depth, depth), -1);
} else g.fillJRect(rect);
update(g, dx, dy, rgn, scale);
}
示例4: paint
void JListBox::paint(JGraphics g) {
int dx = d2+d2, dy;
int th = getBaseH();
int ns = section;
JString text;
JFontMetrics fm(g);
JRect clip = g.getClipJRect();
JRect frame = JRect(0, 0, width-scroller->width, height);
JRegion rgn(clip &= frame);
JColor color = getForeground();
JColor bkgnd = getBackground();
JColor light = bkgnd.brighter();
clip &= frame.shrink(d, d);
if (base+ns > content.size())
ns = content.size()-base;
for (int i=0; i<ns; i++) {
dy = i*th+d2;
JRect cell(d2, dy, width-scroller->width-d2*2, th-d);
JRect area = cell & clip;
JRect inner = cell.shrink(d, d) & clip;
if (area.isEmpty()) continue;
JAssociation &obj = *(JAssociation*)content[i+base];
text = *(JString*)obj.key();
g.setClipJRect(cell & clip);
g.setJColor(bkgnd);
if (!(int)*(JInteger*)obj.value()) {
g.fill3DJRect(cell, d);
g.setJColor(light);
g.setClipJRect(inner);
g.drawJString(text, dx+1, dy+1);
} else {
g.fill3DJRect(cell, -d);
g.setJColor(light);
g.setClipJRect(inner);
g.drawJString(text, dx-1, dy-1);
}
g.setJColor(color);
g.drawJString(text, dx, dy);
rgn -= JRegion(area);
}
g.setJRegion(rgn);
g.setJColor(bkgnd);
g.fill3DJRect(frame, -d);
}
示例5: getIExtent
void J1DMObj::update(JGraphics g, double dx, double dy, JRegion& rgn, double scale) {
JRect frect = getIExtent(dx, dy, scale);
JRect rect = frect.shrink(depth, depth);
if ((rect.width > 0) && (rect.height > 0)) {
g.setJRegion(rgn & rect);
/* module refresh
g.setJRegion(rgn);
g.setJColor(moduleColor);
g.draw3DJRect(rect, depth);
g.fillJRect(rect.shrinkBy(depth, depth));
g.setJRegion(rgn & rect);
g.setJColor(color);
*/
v[0] = max(0, min(mask, v[0]));
v[1] = max(0, min(mask, v[1]));
int xpos = v[0]*(rect.width-depth)/mask;
int ypos = v[1]*(rect.height-depth)/mask;
g.setJColor(color);
g.drawLine(rect.x+xpos, rect.y+ypos, rect.x+xpos+1,
rect.y+ypos+1);
}
}