summaryrefslogtreecommitdiffstats
path: root/kstars/kstars/indiproperty.h
blob: c655903aeb671b1dac8543cf890e6c6c833b19fe (plain)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*  INDI Property
    Copyright (C) 2003 Jasem Mutlaq (mutlaqja@ikarustech.com)

    This application is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.
    
   
 */

#ifndef INDIPROPERTY_H
#define INDIPROPERTY_H

#include "indielement.h"


class INDI_G;
class INDIStdProperty;

class TDEPopupMenu;
class KComboBox;
class KLed;

class TQLabel;
class TQPushButton;
class TQHBoxLayout;
class TQVBoxLayout;
class TQButtonGroup;



/* INDI property */
class INDI_P : public TQObject
{
  Q_OBJECT
  
   public:
   INDI_P(INDI_G *parentGroup, TQString inName);
   ~INDI_P();

    TQString	name;			/* property name */
    TQString     label;			/* property label */
    
    INDI_G	*pg;			/* parent group */
    TDEPopupMenu  *assosiatedPopup;	/* assosiated popup menu, if any */
    INDIStdProperty *indistd;		/* Assosciated std routines class */
    double	timeout;		/* timeout, seconds */
    PState	state;			/* state light code */
    KLed	*light;			/* state LED */
    PPerm       perm;		        /* permissions wrt client */
    PGui        guitype;		/* type of GUI, if any */

    
    int 	stdID;			/* Standard property ID, if any */
    
    TQLabel      *label_w;		/* Label widget */
    TQPushButton *set_w;		        /* set button */
    
    TQSpacerItem    *HorSpacer;		/*Qt::Horizontal spacer */
    TQHBoxLayout    *PHBox;   		/*Qt::Horizontal container */
    TQVBoxLayout    *PVBox;   		/*Qt::Vertical container */
    
    TQButtonGroup   *groupB;		/* group button for radio and check boxes (Elements) */
    KComboBox      *om_w;		/* Combo box for menu */
    
    TQPtrList<INDI_E> el;		/* list of elements */

    /* Draw state LED */
    void drawLt(PState lstate);
    
    /* First step in adding a new GUI element */
    void addGUI(XMLEle *root);
    
    /* Set Property's parent group */
    void setGroup(INDI_G *parentGroup) { pg = parentGroup; }
    
    /* Find an element within the property */
    INDI_E * findElement(TQString elementName);
    /* Search for an element, and if found, evaluate its state */
    bool isOn(TQString component);	
   
   /* Build Functions */ 
   int buildTextGUI    (XMLEle *root, char errmsg[]);
   int buildNumberGUI  (XMLEle *root, char errmsg[]);
   int buildSwitchesGUI(XMLEle *root, char errmsg[]);
   int buildMenuGUI    (XMLEle *root, char errmsg[]);
   int buildLightsGUI  (XMLEle *root, char errmsg[]);
   int buildBLOBGUI    (XMLEle *root, char errmsg[]);
      
   /* Setup the 'set' button in the property */
    void setupSetButton(TQString caption);
    
   /* Turn a switch on */
    void activateSwitch(TQString name);
    
    public slots:
    void newText();
    void newSwitch(int id);
    void newBlob();
    void convertSwitch(int id);
    
    signals:
    void okState();
    
};

#endif