]>
git.ipfire.org Git - thirdparty/newt.git/blob - testgrid.c
9 newtComponent b1
, b2
, b3
, b4
;
10 newtComponent answer
, f
, t
;
11 newtGrid grid
, subgrid
;
13 int textWidth
, textHeight
;
17 newtOpenWindow(2, 2, 40, 15, "first window");
19 b1
= newtButton(-1, -1, "Button 1");
20 b2
= newtButton(-1, -1, "Another Button");
21 b3
= newtButton(-1, -1, "But, but");
22 b4
= newtButton(-1, -1, "But what?");
24 f
= newtForm(NULL
, NULL
, 0);
26 grid
= newtCreateGrid(2, 2);
27 newtGridSetField(grid
, 0, 0, NEWT_GRID_COMPONENT
, b1
, 0, 0, 0, 0,
28 NEWT_ANCHOR_RIGHT
, 0);
29 newtGridSetField(grid
, 0, 1, NEWT_GRID_COMPONENT
, b2
, 0, 0, 0, 0, 0, 0);
30 newtGridSetField(grid
, 1, 0, NEWT_GRID_COMPONENT
, b3
, 0, 0, 0, 0, 0, 0);
31 newtGridSetField(grid
, 1, 1, NEWT_GRID_COMPONENT
, b4
, 0, 0, 0, 0, 0, 0);
33 newtGridPlace(grid
, 1, 1);
35 newtFormAddComponents(f
, b1
, b2
, b3
, b4
, NULL
);
37 answer
= newtRunForm(f
);
43 flowedText
= newtReflowText("This is a quite a bit of text. It is 40 "
44 "columns long, so some wrapping should be "
45 "done. Did you know that the quick, brown "
46 "fox jumped over the lazy dog?\n\n"
47 "In other news, it's pretty important that we "
48 "can properly force a line break.",
49 40, 5, 5, &textWidth
, &textHeight
);
50 t
= newtTextbox(-1, -1, textWidth
, textHeight
, NEWT_FLAG_WRAP
);
51 newtTextboxSetText(t
, flowedText
);
55 b1
= newtButton(-1, -1, "Okay");
56 b2
= newtButton(-1, -1, "Cancel");
58 grid
= newtCreateGrid(1, 2);
59 subgrid
= newtCreateGrid(2, 1);
61 newtGridSetField(subgrid
, 0, 0, NEWT_GRID_COMPONENT
, b1
, 0, 0, 0, 0, 0, 0);
62 newtGridSetField(subgrid
, 1, 0, NEWT_GRID_COMPONENT
, b2
, 0, 0, 0, 0, 0, 0);
64 newtGridSetField(grid
, 0, 0, NEWT_GRID_COMPONENT
, t
, 0, 0, 0, 1, 0, 0);
65 newtGridSetField(grid
, 0, 1, NEWT_GRID_SUBGRID
, subgrid
, 0, 0, 0, 0, 0,
66 NEWT_GRID_FLAG_GROWX
);
67 newtGridWrappedWindow(grid
, "another example");
69 f
= newtForm(NULL
, NULL
, 0);
70 newtFormAddComponents(f
, b1
, t
, b2
, NULL
);
71 answer
= newtRunForm(f
);
75 newtWinMessage("Simple", "Ok", "This is a simple message window");