moved kdeaccessibility kdeaddons kdeadmin kdeartwork kdebindings kdeedu kdegames...
[kdeedu.git] / kstars / kstars / mapcanvas.h
blob7183d93926674aee25c0707ddbc280311e9a8278
1 /***************************************************************************
2 mapcanvas.h - K Desktop Planetarium
3 -------------------
4 begin : Tue Apr 10 2001
5 copyright : (C) 2001 by Jason Harris
6 email : jharris@30doradus.org
7 ***************************************************************************/
9 /***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
21 #ifndef MAPCANVAS_H
22 #define MAPCANVAS_H
24 #include <qwidget.h>
25 #include <qpoint.h>
27 /**@class MapCanvas
28 *Used in LocationDialog for displaying a map of the Earth.
29 *In addition, cities in the database are drawn as grey or white dots.
30 *Also, the widget processes mouse clicks, to trim the list of
31 *cities to those near the mouse click.
32 *@short Widget used in the LocationDialog for displaying the world map.
33 *@author Jason Harris
34 *@version 1.0
37 class QPixmap;
39 class MapCanvas : public QWidget {
40 Q_OBJECT
41 public:
42 /**Default constructor. Initialize the widget: create pixmaps, load the
43 *world map bitmap, set pointers to the main window and the
44 *LocationDialog parent.
46 MapCanvas(QWidget *parent=0, const char *name=0);
47 /**Destructor (empty)
49 ~MapCanvas();
51 public slots:
52 /**Set the geometry of the map widget (overloaded from QWidget).
53 *Resizes the size of the map pixmap to match the widget, and resets
54 *the Origin QPoint so it remains at the center of the widget.
55 *@note this is called automatically by resize events.
56 *@p x the x-position of the widget
57 *@p y the y-position of the widget
58 *@p w the width of the widget
59 *@p h the height of the widget
61 virtual void setGeometry( int x, int y, int w, int h );
63 /**Set the geometry of the map widget (overloaded from QWidget).
64 *Resizes the size of the map pixmap to match the widget, and resets
65 *the Origin QPoint so it remains at the center of the widget.
66 *This function behaves just like the above function. It differs
67 *only in the data type of its argument.
68 *@note this is called automatically by resize events.
69 *@p r QRect describing geometry
71 virtual void setGeometry( const QRect &r );
73 protected:
74 /**Draw the map. Draw grey dots on the locations of all cities,
75 *and highlight the cities which match the current filters
76 *as white dits. Also draw a red crosshairs on the
77 *currently-selected city.
78 *@see LocationDialog
80 virtual void paintEvent( QPaintEvent *e );
82 /**Trim the list of cities so that only those within 2 degrees
83 *of the mouse click are shown in the list.
84 *@see LocationDialog
86 virtual void mousePressEvent( QMouseEvent *e );
88 private:
89 QPixmap *Canvas, *bgImage;
90 QString BGColor;
91 QPoint origin;
94 #endif