summaryrefslogtreecommitdiff
path: root/iup/test/hbox.c
blob: 44f0f021014fb5bb05685d745edb070fdda0b373 (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
109
110
111
112
113
114
#include <stdlib.h>
#include <stdio.h>
#include "iup.h"

void HboxTest(void)
{
  /* IUP identifiers */
  Ihandle *fr1, *fr2, *fr3, *dlg;
  Ihandle *b11, *b12, *b13;
  Ihandle *b21, *b22, *b23;
  Ihandle *b31, *b32, *b33;
  Ihandle *h1,  *h2,  *h3;

  /* Creates frame with three top aligned buttons */
  fr1 = IupFrame
  (
    h1 = IupHbox
    (
//      IupFill(),
      b11=IupButton("1", NULL),
      b12=IupButton("2", NULL),
      b13=IupButton("3", NULL),
//      IupFill(),
      NULL
    )
  );
//  IupSetAttribute(fr1, "TITLE", "ALIGNMENT=ATOP");
  IupSetAttribute(fr1, "TITLE", "IupHbox");
  IupSetAttribute(b11, "SIZE", "10x10");
  IupSetAttribute(b12, "SIZE", "20x16");
  IupSetAttribute(b13, "SIZE", "30x20");
  IupSetAttributes(h1, "ALIGNMENT=ATOP"); /* Sets hbox's alignment, gap and size */
  IupSetAttribute(h1, "HOMOGENEOUS", "YES");
  IupSetAttribute(h1, "EXPANDCHILDREN", "YES");
//  IupSetAttribute(b12, "VISIBLE", "NO");
//  IupSetAttribute(b12, "FLOATING", "YES");

  /* Creates frame with three buttons */
  fr2 = IupFrame
  (
    h2=IupHbox
    (
      IupFill(),
      b21=IupButton("1", NULL),
      b22=IupButton("2", NULL),
      b23=IupButton("3", NULL),
      IupFill(),
      NULL
    )
  );
  IupSetAttribute(fr2, "TITLE", "ALIGNMENT=ACENTER, GAP=20");
  IupSetAttribute(b21, "SIZE", "30x30");
  IupSetAttribute(b22, "SIZE", "30x40");
  IupSetAttribute(b23, "SIZE", "30x50");
  IupSetAttributes(h2, "ALIGNMENT=ACENTER, GAP=20"); /* Sets hbox's alignment and gap */

  /* Creates frame with three bottom aligned buttons */
  fr3 = IupFrame
  (
    h3=IupHbox
    (
      IupFill(),
      b31=IupButton ("1", NULL),
      b32=IupButton ("2", NULL),
      b33=IupButton ("3", NULL),
      IupFill(),
      NULL
    )
  );
  IupSetAttribute(fr3, "TITLE", "ALIGNMENT=ABOTTOM, MARGIN=10x10");
  IupSetAttribute(b31, "SIZE", "30x30");
  IupSetAttribute(b32, "SIZE", "30x40");
  IupSetAttribute(b33, "SIZE", "30x50");
  IupSetAttributes(h3, "ALIGNMENT=ABOTTOM, MARGIN=10x10"); /* Sets hbox's alignment and size */

  /* Creates dlg with the three frames */
  dlg = IupDialog
  (
    IupVbox
    (
      fr1,
      fr2,
      fr3,
      NULL
    )
  );

  IupSetAttribute(dlg, "TITLE", "IupHbox Test"); /* Sets dlg's title */
  IupSetAttribute(dlg, "MARGIN", "10x10");
  IupSetAttribute(dlg, "GAP", "10");
  IupSetAttribute(fr1, "MARGIN", "0x0");   /* avoid attribute propagation */
  IupSetAttribute(fr2, "MARGIN", "0x0");
  IupSetAttribute(fr3, "MARGIN", "0x0");
  IupSetAttribute(fr1, "GAP", "0");
  IupSetAttribute(fr2, "GAP", "0");
  IupSetAttribute(fr3, "GAP", "0");

  IupShowXY(dlg, IUP_CENTER, IUP_CENTER); /* Shows dlg in the center of the screen */
}

#ifndef BIG_TEST
int main(int argc, char* argv[])
{
  IupOpen(&argc, &argv);

  HboxTest();

  IupMainLoop();

  IupClose();

  return EXIT_SUCCESS;
}
#endif