lib Library API Documentation

koborder.h

00001 /* This file is part of the KDE project 00002 Copyright (C) 2000, 2001 Thomas Zander <zander@kde.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00017 Boston, MA 02111-1307, USA. 00018 */ 00019 00020 #ifndef KoBorder_h 00021 #define KoBorder_h 00022 00023 #include <qcolor.h> 00024 #include <qpen.h> 00025 class QDomElement; 00026 class KoZoomHandler; 00027 class QPainter; 00028 00032 class KoBorder : public Qt 00033 { 00034 public: 00035 // Update the DTDs if you add something here! 00036 enum BorderStyle {SOLID = 0, DASH = 1, DOT = 2, DASH_DOT = 3, DASH_DOT_DOT = 4, DOUBLE_LINE = 5}; 00037 00038 KoBorder(); 00039 KoBorder( const QColor & c, BorderStyle s, double width ); 00040 QColor color; 00041 void setPenWidth(double _w); 00042 void setStyle(BorderStyle _style); 00043 BorderStyle getStyle() const {return style;} 00044 double penWidth() const{ return ptPenWidth;} 00045 double width() const { return ptWidth; } 00046 00047 bool operator==( const KoBorder _brd ) const; 00048 bool operator!=( const KoBorder _brd ) const; 00049 00050 // Load from XML 00051 static KoBorder loadBorder( const QDomElement & elem ); 00052 // Save to XML 00053 void save( QDomElement & elem ) const; 00054 00055 // String to style enum, and vice versa, for UI. 00056 static BorderStyle getStyle( const QString &style ); 00057 static QString getStyle( const BorderStyle &style ); 00058 00059 // Zoom the border width. If ptWidth is 0, minborder is returned. 00060 static int zoomWidthX( double ptWidth, KoZoomHandler * zoomHandler, int minborder ); // For left/right borders 00061 static int zoomWidthY( double ptWidth, KoZoomHandler * zoomHandler, int minborder ); // For top/bottom borders 00062 00063 // Get a ready-to-use QPen for this border. 00064 // defaultColor is the color to use for QColor() - either defaultTextColor() or defaultBgColor(). 00065 static QPen borderPen( const KoBorder & brd, int width, QColor defaultColor ); 00066 00067 // The do-it-all method :) 00068 // Draws in @p painter the 4 borders on the _outside_ of @p rect. 00069 // If a border is of size 0, minborder will be applied (no border if 0, defaultPen otherwise) 00070 static void drawBorders( QPainter& painter, KoZoomHandler * zoomHandler, QRect rect, 00071 KoBorder left, KoBorder right, KoBorder top, KoBorder bottom, 00072 int minborder, QPen defaultPen ); 00073 private: 00074 double ptWidth; 00075 double ptPenWidth; 00076 BorderStyle style; 00077 }; 00078 00079 #endif
KDE Logo
This file is part of the documentation for lib Library Version 1.3.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Sep 24 18:22:23 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003