• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

kstars

  • sources
  • kde-4.12
  • kdeedu
  • kstars
  • kstars
  • ekos
  • guide
common.h
Go to the documentation of this file.
1 /* Ekos guide tool
2  Copyright (C) 2012 Andrew Stepanenko
3 
4  Modified by Jasem Mutlaq <mutlaqja@ikarustech.com> for KStars.
5 
6  This application is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10  */
11 
12 
13 #ifndef COMMON_H_
14 #define COMMON_H_
15 
16 #include "../indi/indicommon.h"
17 #include <Qt/QtGui>
18 
19 extern const u_char DEF_BKGD_COLOR[];
20 extern const u_char DEF_RA_COLOR[];
21 extern const u_char DEF_DEC_COLOR[];
22 extern const u_char DEF_GRID_COLOR[];
23 extern const u_char DEF_WHITE_COLOR[];
24 extern const u_char DEF_GRID_FONT_COLOR[];
25 
26 extern const u_char DEF_SQR_OVL_COLOR[];
27 
28 void u_msg( const char *fmt, ...);
29 
30 struct guide_dir_desc
31 {
32  GuideDirection dir;
33  const char desc[10];
34 };
35 
36 typedef struct
37 {
38  int x, y;
39 }point_t;
40 
41 static const int LOOP_DELAY = 10000;
42 
43 class mouse_delegate
44 {
45 public:
46  virtual void mouse_press( QMouseEvent *event ) = 0;
47  virtual void mouse_release( QMouseEvent *event ) = 0;
48  virtual void mouse_move( QMouseEvent *event ) = 0;
49 
50  virtual ~mouse_delegate() {}
51 };
52 
53 
54 class custom_drawer : public QWidget
55 {
56  Q_OBJECT
57 
58 public:
59  explicit custom_drawer(QWidget *parent = NULL ) : QWidget(parent), m_mouse(NULL), m_image(NULL)
60  {
61  }
62  ~custom_drawer()
63  {
64  }
65  bool set_source( QImage *image, mouse_delegate *mouse )
66  {
67  m_image = image;
68  if( !m_image )
69  return false;
70  resize( m_image->size() );
71  m_mouse = mouse;
72  return true;
73  }
74 protected:
75  void paintEvent(QPaintEvent *)
76  {
77  if( !m_image )
78  return;
79  QPainter painter;
80  painter.begin(this);
81  painter.drawImage( 0, 0, *m_image );
82  painter.end();
83  };
84 
85  void mouseMoveEvent ( QMouseEvent *event )
86  {
87  if( !m_mouse )
88  return;
89  m_mouse->mouse_move( event );
90  }
91  void mousePressEvent ( QMouseEvent *event )
92  {
93  if( !m_mouse )
94  return;
95  m_mouse->mouse_press( event );
96  }
97  void mouseReleaseEvent ( QMouseEvent *event )
98  {
99  if( !m_mouse )
100  return;
101  m_mouse->mouse_release( event );
102  }
103 private:
104  mouse_delegate *m_mouse;
105  QImage *m_image;
106 };
107 
108 
109 #endif /* COMMON_H_ */
point_t::y
int y
Definition: common.h:38
DEF_RA_COLOR
const u_char DEF_RA_COLOR[]
Definition: common.cpp:18
QWidget
point_t
Definition: common.h:36
GuideDirection
GuideDirection
Definition: indicommon.h:23
custom_drawer
Definition: common.h:54
DEF_BKGD_COLOR
const u_char DEF_BKGD_COLOR[]
Definition: common.cpp:17
custom_drawer::~custom_drawer
~custom_drawer()
Definition: common.h:62
u_msg
void u_msg(const char *fmt,...)
Definition: common.cpp:26
custom_drawer::paintEvent
void paintEvent(QPaintEvent *)
Definition: common.h:75
DEF_WHITE_COLOR
const u_char DEF_WHITE_COLOR[]
Definition: common.cpp:21
mouse_delegate
Definition: common.h:43
custom_drawer::mouseReleaseEvent
void mouseReleaseEvent(QMouseEvent *event)
Definition: common.h:97
custom_drawer::set_source
bool set_source(QImage *image, mouse_delegate *mouse)
Definition: common.h:65
custom_drawer::custom_drawer
custom_drawer(QWidget *parent=NULL)
Definition: common.h:59
guide_dir_desc::dir
GuideDirection dir
Definition: common.h:32
DEF_SQR_OVL_COLOR
const u_char DEF_SQR_OVL_COLOR[]
Definition: common.cpp:24
DEF_DEC_COLOR
const u_char DEF_DEC_COLOR[]
Definition: common.cpp:19
mouse_delegate::mouse_release
virtual void mouse_release(QMouseEvent *event)=0
DEF_GRID_FONT_COLOR
const u_char DEF_GRID_FONT_COLOR[]
Definition: common.cpp:22
DEF_GRID_COLOR
const u_char DEF_GRID_COLOR[]
Definition: common.cpp:20
mouse_delegate::mouse_press
virtual void mouse_press(QMouseEvent *event)=0
custom_drawer::mousePressEvent
void mousePressEvent(QMouseEvent *event)
Definition: common.h:91
guide_dir_desc
Definition: common.h:30
custom_drawer::mouseMoveEvent
void mouseMoveEvent(QMouseEvent *event)
Definition: common.h:85
guide_dir_desc::desc
const char desc[10]
Definition: common.h:33
LOOP_DELAY
static const int LOOP_DELAY
Definition: common.h:41
mouse_delegate::~mouse_delegate
virtual ~mouse_delegate()
Definition: common.h:50
mouse_delegate::mouse_move
virtual void mouse_move(QMouseEvent *event)=0
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:36:19 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kstars

Skip menu "kstars"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal