summaryrefslogtreecommitdiffstats
path: root/kstars/kstars/indigroup.cpp
blob: a4a0d47e5a2d5fba136d5e0ff3a847e27115b5ca (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
/*  INDI Group
    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.
    
    JM Changelog
    2004-16-1:	Start
   
 */
 
 #include "indiproperty.h"
 #include "indigroup.h"
 #include "indidevice.h"
 #include "devicemanager.h"
 
 #include <klocale.h>
 
 #include <tqlayout.h>
 #include <tqframe.h>
 #include <tqtimer.h>
 #include <tqtabwidget.h> 
 
 /*******************************************************************
** INDI Group: a tab widget for common properties. All properties
** belong to a group, whether they have one or not but how the group
** is displayed differs
*******************************************************************/
INDI_G::INDI_G(INDI_D *parentDevice, TQString inName)
{
  dp = parentDevice;
  
  name = inName;

  pl.setAutoDelete(true);
  
  // FIXME what's the parent exactly?
  // You can do this eaither way:
  // 1. Propertycontainer is a TQFrame, then you make TQVBoxLayout for it (check form1.cpp)
  // 2. Keep it as TQVBox and let it handle its tqchildren.
  // Depends on which one works best.
  propertyContainer = new TQFrame(dp->groupContainer);
  propertyLayout    = new TQVBoxLayout(propertyContainer, 20, KDialog::spacingHint() );
  VerticalSpacer    = new TQSpacerItem( 20, 20, TQSizePolicy::Minimum, TQSizePolicy::Expanding );
  
  propertyLayout->addItem(VerticalSpacer); 
    
  dp->groupContainer->addTab(propertyContainer, name);
}

INDI_G::~INDI_G()
{
  pl.clear();
  
  delete(propertyContainer);
}

void INDI_G::addProperty(INDI_P *pp)
{
   dp->registerProperty(pp);
   
   propertyLayout->addLayout(pp->PHBox);
   propertyLayout->addItem(VerticalSpacer);
   
   pl.append(pp);
}

bool INDI_G::removeProperty(INDI_P *pp)
{

  return  (pl.remove(pp));

}