kstars
indiproperty.h
Go to the documentation of this file.00001 /* INDI Property 00002 Copyright (C) 2003 Jasem Mutlaq (mutlaqja@ikarustech.com) 00003 00004 This application is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU 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 00010 */ 00011 00012 #ifndef INDIPROPERTY_H 00013 #define INDIPROPERTY_H 00014 00015 #include "indielement.h" 00016 00017 00018 class INDI_G; 00019 class INDIStdProperty; 00020 00021 class KPopupMenu; 00022 class KComboBox; 00023 class KLed; 00024 00025 class QLabel; 00026 class QPushButton; 00027 class QHBoxLayout; 00028 class QVBoxLayout; 00029 class QButtonGroup; 00030 00031 00032 00033 /* INDI property */ 00034 class INDI_P : public QObject 00035 { 00036 Q_OBJECT 00037 public: 00038 INDI_P(INDI_G *parentGroup, QString inName); 00039 ~INDI_P(); 00040 00041 QString name; /* property name */ 00042 QString label; /* property label */ 00043 00044 INDI_G *pg; /* parent group */ 00045 KPopupMenu *assosiatedPopup; /* assosiated popup menu, if any */ 00046 INDIStdProperty *indistd; /* Assosciated std routines class */ 00047 double timeout; /* timeout, seconds */ 00048 PState state; /* state light code */ 00049 KLed *light; /* state LED */ 00050 PPerm perm; /* permissions wrt client */ 00051 PGui guitype; /* type of GUI, if any */ 00052 00053 00054 int stdID; /* Standard property ID, if any */ 00055 00056 QLabel *label_w; /* Label widget */ 00057 QPushButton *set_w; /* set button */ 00058 00059 QSpacerItem *HorSpacer; /* Horizontal spacer */ 00060 QHBoxLayout *PHBox; /* Horizontal container */ 00061 QVBoxLayout *PVBox; /* Vertical container */ 00062 00063 QButtonGroup *groupB; /* group button for radio and check boxes (Elements) */ 00064 KComboBox *om_w; /* Combo box for menu */ 00065 00066 QPtrList<INDI_E> el; /* list of elements */ 00067 00068 /* Draw state LED */ 00069 void drawLt(PState lstate); 00070 00071 /* First step in adding a new GUI element */ 00072 void addGUI(XMLEle *root); 00073 00074 /* Set Property's parent group */ 00075 void setGroup(INDI_G *parentGroup) { pg = parentGroup; } 00076 00077 /* Find an element within the property */ 00078 INDI_E * findElement(QString elementName); 00079 /* Search for an element, and if found, evaluate its state */ 00080 bool isOn(QString component); 00081 00082 /* Build Functions */ 00083 int buildTextGUI (XMLEle *root, char errmsg[]); 00084 int buildNumberGUI (XMLEle *root, char errmsg[]); 00085 int buildSwitchesGUI(XMLEle *root, char errmsg[]); 00086 int buildMenuGUI (XMLEle *root, char errmsg[]); 00087 int buildLightsGUI (XMLEle *root, char errmsg[]); 00088 int buildBLOBGUI (XMLEle *root, char errmsg[]); 00089 00090 /* Setup the 'set' button in the property */ 00091 void setupSetButton(QString caption); 00092 00093 /* Turn a switch on */ 00094 void activateSwitch(QString name); 00095 00096 public slots: 00097 void newText(); 00098 void newSwitch(int id); 00099 void newBlob(); 00100 void convertSwitch(int id); 00101 00102 signals: 00103 void okState(); 00104 00105 }; 00106 00107 #endif