本文整理汇总了C++中paintButton函数的典型用法代码示例。如果您正苦于以下问题:C++ paintButton函数的具体用法?C++ paintButton怎么用?C++ paintButton使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了paintButton函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handlePointerMotion
void handlePointerMotion(AppInfo *app, XEvent *event)
{
DialogInfo *d = app->dialog;
if (NO_BUTTON == d->pressedButton) {
return;
} else if (OK_BUTTON == d->pressedButton) {
if (eventIsInsideButton(app, event, d->okButton)) {
if (!(d->okButton.pressed)) {
d->okButton.pressed = True;
paintButton(app, d->dialogWindow, d->okButton);
}
} else {
if (d->okButton.pressed) {
d->okButton.pressed = False;
paintButton(app, d->dialogWindow, d->okButton);
}
}
} else if (CANCEL_BUTTON == d->pressedButton) {
if (eventIsInsideButton(app, event, d->cancelButton)) {
if (!(d->cancelButton.pressed)) {
d->cancelButton.pressed = True;
paintButton(app, d->dialogWindow, d->cancelButton);
}
} else {
if (d->cancelButton.pressed) {
d->cancelButton.pressed = False;
paintButton(app, d->dialogWindow, d->cancelButton);
}
}
}
}
示例2: paintMenuList
bool RenderThemeGtk::paintMenuList(RenderObject* object, const PaintInfo& info, const IntRect& rect)
{
if (paintButton(object, info, rect))
return true;
// Menu list button painting strategy.
// For buttons with appears-as-list set to false (having a separator):
// | left border | Button text | xthickness | vseparator | xthickness | arrow | xthickness | right border |
// For buttons with appears-as-list set to true (not having a separator):
// | left border | Button text | arrow | xthickness | right border |
int leftBorder = 0, rightBorder = 0, bottomBorder = 0, topBorder = 0;
getButtonInnerBorder(gtkComboBoxButton(), leftBorder, topBorder, rightBorder, bottomBorder);
RenderStyle* style = &object->style();
int arrowSize = comboBoxArrowSize(style);
GtkStyle* buttonStyle = gtk_widget_get_style(gtkComboBoxButton());
IntRect arrowRect(0, (rect.height() - arrowSize) / 2, arrowSize, arrowSize);
if (style->direction() == RTL)
arrowRect.setX(leftBorder + buttonStyle->xthickness);
else
arrowRect.setX(rect.width() - rightBorder - buttonStyle->xthickness - arrowSize);
GtkShadowType shadowType = isPressed(object) ? GTK_SHADOW_IN : GTK_SHADOW_OUT;
WidgetRenderingContext widgetContext(info.context, rect);
GtkStateType stateType = getGtkStateType(this, object);
widgetContext.gtkPaintArrow(arrowRect, gtkComboBoxArrow(), stateType, shadowType, GTK_ARROW_DOWN, "arrow");
// Some combo boxes do not have a separator.
GtkWidget* separator = gtkComboBoxSeparator();
if (!separator)
return false;
// We want to decrease the height of the separator based on the focus padding of the button.
gint focusPadding = 0, focusWidth = 0;
gtk_widget_style_get(gtkComboBoxButton(),
"focus-line-width", &focusWidth,
"focus-padding", &focusPadding, NULL);
topBorder += focusPadding + focusWidth;
bottomBorder += focusPadding + focusWidth;
int separatorWidth = getComboBoxSeparatorWidth();
IntRect separatorRect(0, topBorder, separatorWidth, rect.height() - topBorder - bottomBorder);
if (style->direction() == RTL)
separatorRect.setX(arrowRect.x() + arrowRect.width() + buttonStyle->xthickness + separatorWidth);
else
separatorRect.setX(arrowRect.x() - buttonStyle->xthickness - separatorWidth);
gboolean hasWideSeparators = FALSE;
gtk_widget_style_get(separator, "wide-separators", &hasWideSeparators, NULL);
if (hasWideSeparators)
widgetContext.gtkPaintBox(separatorRect, separator, GTK_STATE_NORMAL, GTK_SHADOW_ETCHED_OUT, "vseparator");
else
widgetContext.gtkPaintVLine(separatorRect, separator, GTK_STATE_NORMAL, "vseparator");
return false;
}
示例3: handleButtonPress
void handleButtonPress(AppInfo *app, XEvent *event)
{
DialogInfo *d = app->dialog;
cancelInputTimeout(app);
if (event->xbutton.button != Button1) {
return;
}
if (ButtonPress == event->type) {
if (eventIsInsideButton(app, event, d->okButton)) {
d->pressedButton = OK_BUTTON;
d->okButton.pressed = True;
paintButton(app, d->dialogWindow, d->okButton);
} else if (eventIsInsideButton(app, event, d->cancelButton)) {
d->pressedButton = CANCEL_BUTTON;
d->cancelButton.pressed = True;
paintButton(app, d->dialogWindow, d->cancelButton);
} else {
d->pressedButton = NO_BUTTON;
}
} else if (ButtonRelease == event->type) {
if (OK_BUTTON == d->pressedButton) {
if (eventIsInsideButton(app, event, d->okButton)) {
acceptAction(app);
} else {
if (d->okButton.pressed) {
d->okButton.pressed = False;
paintButton(app, d->dialogWindow, d->okButton);
}
}
} else if (CANCEL_BUTTON == d->pressedButton) {
if (eventIsInsideButton(app, event, d->cancelButton)) {
cancelAction(app);
} else {
if (d->cancelButton.pressed) {
d->cancelButton.pressed = False;
paintButton(app, d->dialogWindow, d->cancelButton);
}
}
}
d->pressedButton = NO_BUTTON;
}
}
示例4: paintButton
//==============================================================================
void Button::paint (Graphics& g)
{
if (needsToRelease && isEnabled())
{
needsToRelease = false;
needsRepainting = true;
}
paintButton (g, isOver(), isDown());
}
示例5: componentBoundingBox
void ButtonTheme::paint(Graphics &g, const Component *comp) const
{
const AbstractButton *button = static_cast<const AbstractButton*>(comp);
if(button->isContentAreaFilled())
{
BasicComponent::paint(g,button);
}
util::Dimension componentBoundingBox(button->getBounds().width,button->getBounds().height);
util::Dimension iconBoundingBox(textUtil.getIconBoundingBox(getActiveIcon(button)));
StringInfoBuffer stringInfo(textUtil.fitStringInBoundingBox(button->getText(),componentBoundingBox,iconBoundingBox,button->getFont(),button->getInsets(),button->getMargin()));
util::Dimension stringBoundingBox(textUtil.getStringBoundingBox(stringInfo));
int verticalIconAlignment = textUtil.getVerticalAlignment(iconBoundingBox,componentBoundingBox,button->getVerticalAlignment(),button->getInsets(),button->getMargin());
int verticalTextAlignment = textUtil.getVerticalAlignment(stringBoundingBox,componentBoundingBox,button->getVerticalAlignment(),button->getInsets(),button->getMargin());
int horizontalAlignment = textUtil.getHorizontalAlignment(stringBoundingBox,iconBoundingBox,componentBoundingBox,button->getHorizontalAlignment(),button->getInsets(),button->getMargin());
if(getActiveIcon(button) != 0)
{
getActiveIcon(button)->paint(button,g,horizontalAlignment,verticalIconAlignment);
horizontalAlignment += getActiveIcon(button)->getIconWidth();
}
g.setPaint(button->getForeground());
g.setFont(button->getFont());
if(button->hasFocus() && button->isFocusPainted())
{
paintFocus(horizontalAlignment,verticalTextAlignment,g,componentBoundingBox,stringBoundingBox,3);
}
if(getActiveIcon(button) != 0)
{
paintButton(horizontalAlignment,verticalTextAlignment,g,stringInfo,stringBoundingBox,Component::LEFT,getActiveIcon(button));
}
else
{
paintButton(horizontalAlignment,verticalTextAlignment,g,stringInfo,stringBoundingBox,Component::CENTER,getActiveIcon(button));
}
}
示例6: paintButton
bool RenderThemeWinCE::paintMediaFullscreenButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r)
{
bool rc = paintButton(o, paintInfo, r);
FloatRect imRect = r;
imRect.inflate(-2);
paintInfo.context->save();
paintInfo.context->setStrokeColor(Color::black);
paintInfo.context->setFillColor(Color::gray);
paintInfo.context->fillRect(imRect);
paintInfo.context->restore();
return rc;
}
示例7: paintDialog
void paintDialog(AppInfo *app)
{
DialogInfo *d = app->dialog;
Drawable draw = d->dialogWindow;
int i;
XSetForeground(app->dpy, app->fillGC, d->w3.w.background);
XFillRectangle(app->dpy, draw, app->fillGC, 0, 0,
d->w3.w.width, d->w3.w.height);
if (d->w3.shadowThickness > 0) {
draw_shaded_rectangle(app->dpy, draw, 0, 0,
d->w3.w.width, d->w3.w.height,
d->w3.shadowThickness,
d->w3.topShadowColor,
d->w3.bottomShadowColor);
}
paintLabel(app, draw, d->label);
for (i = 0; i < d->indicator.count; i++) {
paintIndicator(app, draw, d->indicators[i]);
}
paintButton(app, draw, d->okButton);
paintButton(app, draw, d->cancelButton);
XSync(app->dpy, False);
}
示例8: mouseEvent
void __loadds far mouseEvent(int event, int x, int y) {
#pragma aux mouseEvent parm [EAX] [ECX] [EDX];
static left_button_hold_down = 0;
if (event & MOUSE_MOVE) {
if (left_button_hold_down) {
recMouseBackground();
saveMouseBackground(x, y);
}
moveMouse(x, y);
}
else if (event & MOUSE_RIGHT_UP) {
//gameState = GAME_QUIT;
}
else if (event & MOUSE_LEFT_DOWN) {
left_button_hold_down = 1;
/* 以下为鼠标单击按钮事件处理 */
if (inButton(x, y, &quitButton)) {
gameState = GAME_QUIT;
}
if (inButton(x, y, &playButton)) {
if (playButton.state == BUTTON_UP) {
playButton.state = BUTTON_DOWN;
}
else {
playButton.state = BUTTON_UP;
}
handlePause();
paintButton(&playButton);
}
if (inButton(x, y, &soundButton)) {
switchSound();
}
}
else if (event & MOUSE_LEFT_UP) {
left_button_hold_down = 0;
}
else if (event & MOUSE_RIGHT_DOWN) {
}
}
示例9: paintButton
bool RenderThemeChromiumWin::paintRadio(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
{
return paintButton(o, i, r);
}
示例10: int
/*!
Paints the border and title decoration for the top-level \a widget
using the \a painter provided and the decoration \a state. The value
of \a decorationRegion is a combination of the bitmask values of
enum DecorationRegion.
Note that Qt for Embedded Linux expects this function to return true if any of
the widget's decorations are repainted; otherwise it returns false.
*/
bool QDecorationDefault::paint(QPainter *painter,
const QWidget *widget,
int decorationRegion,
DecorationState state)
{
if (decorationRegion == None)
return false;
const QRect titleRect = QDecoration::region(widget, Title).boundingRect();
const QPalette pal = QApplication::palette();
int titleHeight = titleRect.height();
int titleWidth = titleRect.width();
QRegion oldClipRegion = painter->clipRegion();
Qt::WindowFlags flags = widget->windowFlags();
bool hasBorder = !widget->isMaximized();
bool hasTitle = flags & Qt::WindowTitleHint;
bool hasSysMenu = flags & Qt::WindowSystemMenuHint;
bool hasContextHelp = flags & Qt::WindowContextHelpButtonHint;
bool hasMinimize = flags & Qt::WindowMinimizeButtonHint;
bool hasMaximize = flags & Qt::WindowMaximizeButtonHint;
bool paintAll = (decorationRegion == int(All));
bool handled = false;
bool porterDuff = painter->paintEngine()->hasFeature(QPaintEngine::PorterDuff);
if ((paintAll || decorationRegion & Borders) && state == Normal && hasBorder) {
if (hasTitle) { // reduce flicker
QRect rect(widget->rect());
QRect r(rect.left(), rect.top() - titleHeight,
rect.width(), titleHeight);
painter->setClipRegion(oldClipRegion - r);
}
QRect br = QDecoration::region(widget).boundingRect();
if (porterDuff)
painter->setCompositionMode(QPainter::CompositionMode_Source);
qDrawWinPanel(painter, br.x(), br.y(), br.width(),
br.height(), pal, false,
&pal.brush(QPalette::Window));
if (porterDuff)
painter->setCompositionMode(QPainter::CompositionMode_SourceOver);
handled |= true;
}
if ((paintAll || decorationRegion & Title && titleWidth > 0) && state == Normal && hasTitle) {
painter->setClipRegion(oldClipRegion);
QBrush titleBrush;
QPen titlePen;
if (widget == qApp->activeWindow()) {
titleBrush = pal.brush(QPalette::Highlight);
titlePen = pal.color(QPalette::HighlightedText);
} else {
titleBrush = pal.brush(QPalette::Window);
titlePen = pal.color(QPalette::Text);
}
if (porterDuff)
painter->setCompositionMode(QPainter::CompositionMode_Source);
qDrawShadePanel(painter,
titleRect.x(), titleRect.y(), titleRect.width(), titleRect.height(),
pal, true, 1, &titleBrush);
if (porterDuff)
painter->setCompositionMode(QPainter::CompositionMode_SourceOver);
painter->setPen(titlePen);
painter->drawText(titleRect.x() + 4, titleRect.y(),
titleRect.width() - 8, titleRect.height(),
Qt::AlignVCenter, windowTitleFor(widget));
handled |= true;
}
if (state != Hover) {
painter->setClipRegion(oldClipRegion);
if ((paintAll || decorationRegion & Menu) && hasSysMenu) {
paintButton(painter, widget, Menu, state, pal);
handled |= true;
}
if ((paintAll || decorationRegion & Help) && hasContextHelp) {
paintButton(painter, widget, Help, state, pal);
handled |= true;
}
if ((paintAll || decorationRegion & Minimize) && hasMinimize) {
paintButton(painter, widget, Minimize, state, pal);
handled |= true;
}
//.........这里部分代码省略.........
示例11: paintButton
bool RenderThemeGdk::paintRadio(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
{
// FIXME: is it the right thing to do?
return paintButton(o, i, r);
}
示例12: paintButton
bool RenderThemeQt::paintCheckbox(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
{
return paintButton(o, i, r);
}
示例13: backButtonRect
bool ScrollbarThemeGtk::paint(ScrollbarThemeClient* scrollbar, GraphicsContext* graphicsContext, const IntRect& damageRect)
{
if (graphicsContext->paintingDisabled())
return false;
// Create the ScrollbarControlPartMask based on the damageRect
ScrollbarControlPartMask scrollMask = NoPart;
IntRect backButtonStartPaintRect;
IntRect backButtonEndPaintRect;
IntRect forwardButtonStartPaintRect;
IntRect forwardButtonEndPaintRect;
if (hasButtons(scrollbar)) {
backButtonStartPaintRect = backButtonRect(scrollbar, BackButtonStartPart, true);
if (damageRect.intersects(backButtonStartPaintRect))
scrollMask |= BackButtonStartPart;
backButtonEndPaintRect = backButtonRect(scrollbar, BackButtonEndPart, true);
if (damageRect.intersects(backButtonEndPaintRect))
scrollMask |= BackButtonEndPart;
forwardButtonStartPaintRect = forwardButtonRect(scrollbar, ForwardButtonStartPart, true);
if (damageRect.intersects(forwardButtonStartPaintRect))
scrollMask |= ForwardButtonStartPart;
forwardButtonEndPaintRect = forwardButtonRect(scrollbar, ForwardButtonEndPart, true);
if (damageRect.intersects(forwardButtonEndPaintRect))
scrollMask |= ForwardButtonEndPart;
}
IntRect trackPaintRect = trackRect(scrollbar, true);
if (damageRect.intersects(trackPaintRect))
scrollMask |= TrackBGPart;
if (m_troughUnderSteppers && (scrollMask & BackButtonStartPart
|| scrollMask & BackButtonEndPart
|| scrollMask & ForwardButtonStartPart
|| scrollMask & ForwardButtonEndPart))
scrollMask |= TrackBGPart;
bool thumbPresent = hasThumb(scrollbar);
IntRect currentThumbRect;
if (thumbPresent) {
IntRect track = trackRect(scrollbar, false);
currentThumbRect = thumbRect(scrollbar, track);
if (damageRect.intersects(currentThumbRect))
scrollMask |= ThumbPart;
}
ScrollbarControlPartMask allButtons = BackButtonStartPart | BackButtonEndPart | ForwardButtonStartPart | ForwardButtonEndPart;
if (scrollMask & TrackBGPart || scrollMask & ThumbPart || scrollMask & allButtons)
paintScrollbarBackground(graphicsContext, scrollbar);
paintTrackBackground(graphicsContext, scrollbar, trackPaintRect);
// Paint the back and forward buttons.
if (scrollMask & BackButtonStartPart)
paintButton(graphicsContext, scrollbar, backButtonStartPaintRect, BackButtonStartPart);
if (scrollMask & BackButtonEndPart)
paintButton(graphicsContext, scrollbar, backButtonEndPaintRect, BackButtonEndPart);
if (scrollMask & ForwardButtonStartPart)
paintButton(graphicsContext, scrollbar, forwardButtonStartPaintRect, ForwardButtonStartPart);
if (scrollMask & ForwardButtonEndPart)
paintButton(graphicsContext, scrollbar, forwardButtonEndPaintRect, ForwardButtonEndPart);
// Paint the thumb.
if (scrollMask & ThumbPart)
paintThumb(graphicsContext, scrollbar, currentThumbRect);
return true;
}
示例14: snappedIntRect
bool RenderTheme::paint(const RenderBox& box, ControlStates& controlStates, const PaintInfo& paintInfo, const LayoutRect& rect)
{
// If painting is disabled, but we aren't updating control tints, then just bail.
// If we are updating control tints, just schedule a repaint if the theme supports tinting
// for that control.
if (paintInfo.context().updatingControlTints()) {
if (controlSupportsTints(box))
box.repaint();
return false;
}
if (paintInfo.context().paintingDisabled())
return false;
ControlPart part = box.style().appearance();
IntRect integralSnappedRect = snappedIntRect(rect);
float deviceScaleFactor = box.document().deviceScaleFactor();
FloatRect devicePixelSnappedRect = snapRectToDevicePixels(rect, deviceScaleFactor);
#if USE(NEW_THEME)
float pageScaleFactor = box.document().page() ? box.document().page()->pageScaleFactor() : 1.0f;
switch (part) {
case CheckboxPart:
case RadioPart:
case PushButtonPart:
case SquareButtonPart:
case DefaultButtonPart:
case ButtonPart:
case InnerSpinButtonPart:
updateControlStatesForRenderer(box, controlStates);
m_theme->paint(part, controlStates, paintInfo.context(), devicePixelSnappedRect, box.style().effectiveZoom(), &box.view().frameView(), deviceScaleFactor, pageScaleFactor);
return false;
default:
break;
}
#else
UNUSED_PARAM(controlStates);
#endif
// Call the appropriate paint method based off the appearance value.
switch (part) {
#if !USE(NEW_THEME)
case CheckboxPart:
return paintCheckbox(box, paintInfo, integralSnappedRect);
case RadioPart:
return paintRadio(box, paintInfo, integralSnappedRect);
case PushButtonPart:
case SquareButtonPart:
case DefaultButtonPart:
case ButtonPart:
return paintButton(box, paintInfo, integralSnappedRect);
case InnerSpinButtonPart:
return paintInnerSpinButton(box, paintInfo, integralSnappedRect);
#endif
case MenulistPart:
return paintMenuList(box, paintInfo, devicePixelSnappedRect);
#if ENABLE(METER_ELEMENT)
case MeterPart:
case RelevancyLevelIndicatorPart:
case ContinuousCapacityLevelIndicatorPart:
case DiscreteCapacityLevelIndicatorPart:
case RatingLevelIndicatorPart:
return paintMeter(box, paintInfo, integralSnappedRect);
#endif
case ProgressBarPart:
return paintProgressBar(box, paintInfo, integralSnappedRect);
case SliderHorizontalPart:
case SliderVerticalPart:
return paintSliderTrack(box, paintInfo, integralSnappedRect);
case SliderThumbHorizontalPart:
case SliderThumbVerticalPart:
return paintSliderThumb(box, paintInfo, integralSnappedRect);
case MediaEnterFullscreenButtonPart:
case MediaExitFullscreenButtonPart:
return paintMediaFullscreenButton(box, paintInfo, integralSnappedRect);
case MediaPlayButtonPart:
return paintMediaPlayButton(box, paintInfo, integralSnappedRect);
case MediaOverlayPlayButtonPart:
return paintMediaOverlayPlayButton(box, paintInfo, integralSnappedRect);
case MediaMuteButtonPart:
return paintMediaMuteButton(box, paintInfo, integralSnappedRect);
case MediaSeekBackButtonPart:
return paintMediaSeekBackButton(box, paintInfo, integralSnappedRect);
case MediaSeekForwardButtonPart:
return paintMediaSeekForwardButton(box, paintInfo, integralSnappedRect);
case MediaRewindButtonPart:
return paintMediaRewindButton(box, paintInfo, integralSnappedRect);
case MediaReturnToRealtimeButtonPart:
return paintMediaReturnToRealtimeButton(box, paintInfo, integralSnappedRect);
case MediaToggleClosedCaptionsButtonPart:
return paintMediaToggleClosedCaptionsButton(box, paintInfo, integralSnappedRect);
case MediaSliderPart:
return paintMediaSliderTrack(box, paintInfo, integralSnappedRect);
case MediaSliderThumbPart:
return paintMediaSliderThumb(box, paintInfo, integralSnappedRect);
case MediaVolumeSliderMuteButtonPart:
return paintMediaMuteButton(box, paintInfo, integralSnappedRect);
case MediaVolumeSliderContainerPart:
return paintMediaVolumeSliderContainer(box, paintInfo, integralSnappedRect);
case MediaVolumeSliderPart:
//.........这里部分代码省略.........
示例15: paintRadio
virtual bool paintRadio(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
{
return paintButton(o, i, r);
}