summaryrefslogtreecommitdiff
path: root/iup/srccontrols/iup_controls.c
blob: e60bd91be2a0b5b41765fe501230f8b685627b4a (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
/** \file
 * \brief initializes the additional controls.
 *
 * See Copyright Notice in "iup.h"
 */


#include "iup.h"
#include "iupcontrols.h"

#include "iup_object.h"
#include "iup_childtree.h"
#include "iup_register.h"
#include "iup_controls.h"
#include "iup_attrib.h"


int IupControlsOpen(void)
{
  if (IupGetGlobal("_IUP_CONTROLS_OPEN"))
    return IUP_OPENED;

  iupRegisterClass(iupDialGetClass());
  iupRegisterClass(iupCellsGetClass());
  iupRegisterClass(iupColorbarGetClass());
  iupRegisterClass(iupColorBrowserGetClass());
  iupRegisterClass(iupMatrixGetClass());
  iupRegisterClass(iupGaugeGetClass());
  iupRegisterClass(iupColorBrowserDlgGetClass());

  IupSetGlobal("_IUP_CONTROLS_OPEN", "1");

  return IUP_NOERROR;
}

void IupControlsClose(void)  /* for backward compatibility */
{
}

char *iupControlBaseGetParentBgColor(Ihandle* ih)
{
  return IupGetAttribute(iupChildTreeGetNativeParent(ih), "BGCOLOR");
}

char *iupControlBaseGetBgColorAttrib(Ihandle* ih)
{
  /* check the hash table */
  char *color = iupAttribGet(ih, "BGCOLOR");

  /* If not defined check native definition from parent */
  if (!color)
    color = iupControlBaseGetParentBgColor(ih);

  return color;
}