summaryrefslogtreecommitdiff
path: root/dldialog/src/DLD_QT/dld_qtobj.cc
blob: cba76ec4d78e8bfbb0c82e05c14167aedb7e8556 (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
/******************************************************************************
**
** $Id: dld_qtobj.cc,v 1.14 2000/03/15 20:02:18 harald Exp $
**
**	This program 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.
**
** (C) 1999,2000 Harald Hoyer <DLDialog@parzelle.de>
**
******************************************************************************/

#include "dld_qtobj.h"
#include "dld_dialog.h"

string conname (const string& _str);

/// Constructor
DLD_QTObj::DLD_QTObj(const string& name, DLD_QTDialog *pd) : 
   dld_name(conname(name)),
   obj_widthP(0),
   obj_heightP(0),
   fixed_width(false),
   fixed_height(false),
   pardia(pd),
   app(0),
   isexit(false)
{
   set_dialog(pd);
}

DLD_QTObj::
~DLD_QTObj()
{
   DLDdbg << dld_name << " ~DLD_QTObj virtual destruktor" << endl;
}

void DLD_QTObj::activate()
{
   DLD_Obj::activate();

   if(is_exit() && pardia && is_created) {
      DLDdbg << dld_name << " exited Dialog" << endl;      
      pardia->done(0);
   }
}

string conname (const string& _str)
{
   string str = convstr (_str);
   string::size_type i;

   while ((i = str.find("\t")) != string::npos) {
      str.replace(i, 1, " ");
      int lp = i - str.rfind("\n", i);
      for(int j = 7 - (lp%8); j > 0; j--) {
         str.insert(i, " ");
      }
   }

   return str;
}