home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kdrawutil.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  6.5 KB  |  181 lines

  1. /* This file is part of the KDE libraries
  2.    Copyright (C) 1999 Daniel M. Duley <mosfet@kde.org>
  3.  
  4.    This library is free software; you can redistribute it and/or
  5.    modify it under the terms of the GNU Library General Public
  6.    License version 2 as published by the Free Software Foundation.
  7.  
  8.    This library is distributed in the hope that it will be useful,
  9.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  10.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  11.    Library General Public License for more details.
  12.  
  13.    You should have received a copy of the GNU Library General Public License
  14.    along with this library; see the file COPYING.LIB.  If not, write to
  15.    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  16.    Boston, MA 02110-1301, USA.
  17. */
  18. #ifndef __KDRAWUTIL_H
  19. #define __KDRAWUTIL_H
  20.  
  21. #include <qnamespace.h>
  22. #include <qpainter.h>
  23. #include <qbitmap.h>
  24. #include <qpalette.h>
  25.  
  26. #include <kdelibs_export.h>
  27.  
  28. /*
  29.  * Various drawing routines. Also see Qt's qdrawutil.h for some more routines
  30.  * contained in Qt.
  31.  *
  32.  * (C) Daniel M. Duley <mosfet@kde.org>
  33.  */
  34.  
  35. /**
  36.  * @relates KStyle
  37.  * @c \#include @c <kdrawutil.h>
  38.  *
  39.  * Draws a Next-style button (solid black shadow with light and midlight highlight).
  40.  * 
  41.  * @param p       The painter to use for drawing the button.
  42.  * @param r       Specifies the rect in which to draw the button.
  43.  * @param g       Specifies the shading colors.
  44.  * @param sunken  Whether to draw the button as sunken (pressed) or not.
  45.  * @param fill    The brush to use for filling the interior of the button.
  46.  *                Pass @a null to prevent the button from being filled.
  47.  */
  48. KDEFX_EXPORT void kDrawNextButton(QPainter *p, const QRect &r, const QColorGroup &g,
  49.                      bool sunken=false, const QBrush *fill=0);
  50.  
  51. /**
  52.  * @relates KStyle
  53.  * @overload
  54.  */
  55. KDEFX_EXPORT void kDrawNextButton(QPainter *p, int x, int y, int w, int h,
  56.                      const QColorGroup &g, bool sunken=false, 
  57.                      const QBrush *fill=0);
  58.  
  59. /**
  60.  * @relates KStyle
  61.  * @c \#include @c <kdrawutil.h>
  62.  *
  63.  * Draws a Be-style button.
  64.  *
  65.  * @param p       The painter to use for drawing the button.
  66.  * @param r       Specifies the rect in which to draw the button.
  67.  * @param g       Specifies the shading colors.
  68.  * @param sunken  Whether to draw the button as sunken (pressed) or not.
  69.  * @param fill    The brush to use for filling the interior of the button.
  70.  *                Pass @a null to prevent the button from being filled.
  71.  */
  72. KDEFX_EXPORT void kDrawBeButton(QPainter *p, QRect &r, const QColorGroup &g,
  73.                    bool sunken=false, const QBrush *fill=0);
  74.  
  75. /**
  76.  * @relates KStyle
  77.  * @c \#include @c <kdrawutil.h>
  78.  * @overload
  79.  */
  80. KDEFX_EXPORT void kDrawBeButton(QPainter *p, int x, int y, int w, int h,
  81.                    const QColorGroup &g, bool sunken=false, 
  82.                    const QBrush *fill=0);
  83.  
  84. /**
  85.  * @relates KStyle
  86.  * @c \#include @c <kdrawutil.h>
  87.  *
  88.  * Draws a rounded oval button. This function doesn't fill the button.
  89.  * See kRoundMaskRegion() for setting masks for fills.
  90.  *
  91.  * @param p       The painter to use for drawing the button.
  92.  * @param r       Specifies the rect in which to draw the button.
  93.  * @param g       Specifies the shading colors.
  94.  * @param sunken  Whether to draw the button as sunken (pressed) or not.
  95.  */
  96. KDEFX_EXPORT void kDrawRoundButton(QPainter *p, const QRect &r, const QColorGroup &g,
  97.                       bool sunken=false);
  98.  
  99. /**
  100.  * @relates KStyle
  101.  * @overload
  102.  */
  103. KDEFX_EXPORT void kDrawRoundButton(QPainter *p, int x, int y, int w, int h,
  104.                       const QColorGroup &g, bool sunken=false);
  105.  
  106. /**
  107.  * @relates KStyle
  108.  * @c \#include @c <kdrawutil.h>
  109.  *
  110.  * Sets a region to the pixels covered by a round button of the given
  111.  * size. You can use this to set clipping regions.
  112.  * 
  113.  * @param r  Reference to the region to set.
  114.  * @param x  The X coordinate of the button.
  115.  * @param y  The Y coordinate of the button.
  116.  * @param w  The width of the button.
  117.  * @param h  The height of the button.
  118.  *
  119.  * @see kDrawRoundButton() and kDrawRoundMask()
  120.  */
  121. KDEFX_EXPORT void kRoundMaskRegion(QRegion &r, int x, int y, int w, int h);
  122.  
  123. /**
  124.  * @relates KStyle
  125.  * @c \#include @c <kdrawutil.h>
  126.  *
  127.  * Paints the pixels covered by a round button of the given size with
  128.  * Qt::color1. This function is useful in QStyle::drawControlMask().
  129.  *
  130.  * @param p      The painter to use for drawing the button.
  131.  * @param x      The X coordinate of the button.
  132.  * @param y      The Y coordinate of the button.
  133.  * @param w      The width of the button.
  134.  * @param h      The height of the button.
  135.  * @param clear  Whether to clear the rectangle specified by @p (x, y, w, h) to
  136.  *               Qt::color0 before drawing the mask.
  137.  */
  138. KDEFX_EXPORT void kDrawRoundMask(QPainter *p, int x, int y, int w, int h, bool clear=false);
  139.  
  140. /**
  141.  * @relates KStyle
  142.  * @c \#include @c <kdrawutil.h>
  143.  *
  144.  * Paints the provided bitmaps in the painter, using the supplied colorgroup for
  145.  * the foreground colors. There's one bitmap for each color. If you want to skip
  146.  * a color, pass @a null for the corresponding bitmap.
  147.  *
  148.  * @note The bitmaps will be self-masked automatically if not masked
  149.  *       prior to calling this routine.
  150.  *
  151.  * @param p             The painter to use for drawing the bitmaps.
  152.  * @param g             Specifies the shading colors.
  153.  * @param x             The X coordinate at which to draw the bitmaps.
  154.  * @param y             The Y coordinate at which to draw the bitmaps.
  155.  * @param lightColor    The bitmap to use for the light part.
  156.  * @param midColor      The bitmap to use for the mid part.
  157.  * @param midlightColor The bitmap to use for the midlight part.
  158.  * @param darkColor     The bitmap to use for the dark part.
  159.  * @param blackColor    The bitmap to use for the black part.
  160.  * @param whiteColor    The bitmap to use for the white part.
  161.  *
  162.  * @see QColorGroup
  163.  */
  164. KDEFX_EXPORT void kColorBitmaps(QPainter *p, const QColorGroup &g, int x, int y,
  165.                    QBitmap *lightColor=0, QBitmap *midColor=0,
  166.                    QBitmap *midlightColor=0, QBitmap *darkColor=0,
  167.                    QBitmap *blackColor=0, QBitmap *whiteColor=0);
  168.  
  169. /**
  170.  * @relates KStyle
  171.  * @c \#include @c <kdrawutil.h>
  172.  * @overload
  173.  */
  174.  KDEFX_EXPORT void kColorBitmaps(QPainter *p, const QColorGroup &g, int x, int y, int w,
  175.                    int h, bool isXBitmaps=true, const uchar *lightColor = 0,
  176.                    const uchar *midColor=0, const uchar *midlightColor=0,
  177.                    const uchar *darkColor=0, const uchar *blackColor=0,
  178.                    const uchar *whiteColor=0);
  179.  
  180. #endif
  181.