File: qwt_rect.h

package info (click to toggle)
libqwt 4.2.0-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 9,856 kB
  • ctags: 5,512
  • sloc: cpp: 22,973; ansic: 244; makefile: 59
file content (46 lines) | stat: -rw-r--r-- 1,305 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
 * Qwt Widget Library
 * Copyright (C) 1997   Josef Wilgen
 * Copyright (C) 2002   Uwe Rathmann
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the Qwt License, Version 1.0
 *****************************************************************************/

#ifndef QWT_RECT_H
#define QWT_RECT_H

#include <qrect.h>
#include "qwt_global.h"

class QPoint;
class QPointArray;

/*!
  \brief Some extensions for QRect
*/

class QWT_EXPORT QwtRect : public QRect
{
public:
    QwtRect();
    QwtRect(const QRect &r);

    QRect cutTop(int h , int distTop = 0, int distBottom = 0);
    QRect cutBottom(int h, int distTop = 0, int distBottom = 0);
    QRect cutLeft(int w, int distLeft = 0, int distRight = 0);
    QRect cutRight(int w, int distLeft = 0, int distRight = 0);
    const QwtRect &cutMargin(int mLeft, int mRight, int Top, int mBottom);

    QPointArray clip(const QPointArray &) const;

private:
    enum Edge { Left, Top, Right, Bottom, NEdges };

    void clipEdge(Edge, const QPointArray &, QPointArray &) const;
    bool insideEdge(const QPoint &, Edge edge) const;
    QPoint intersectEdge(const QPoint &p1, 
        const QPoint &p2, Edge edge) const;
};

#endif