return 0;
}
+int newtCenteredWindow(int width, int height, const char * title) {
+ int top, left;
+
+ top = (SLtt_Screen_Rows - height) / 2;
+
+ /* I don't know why, but this seems to look better */
+ if ((SLtt_Screen_Rows % 2) && (top % 2)) top--;
+
+ left = (SLtt_Screen_Cols - width) / 2;
+
+ newtOpenWindow(left, top, width, height, title);
+
+ return 0;
+}
+
void newtPopWindow(void) {
int j, row, col;
int n = 0;
/* top, left are *not* counting the border */
int newtOpenWindow(int left, int top, int width, int height,
const char * title);
+int newtCenteredWindow(int width, int height, const char * title);
void newtPopWindow(void);
void newtSetColors(struct newtColors colors);
void newtRefresh(void);
void newtGridPlace(newtGrid grid, int left, int top);
void newtGridFree(newtGrid grid, int recurse);
void newtGridGetSize(newtGrid grid, int * width, int * height);
+void newtGridWrappedWindow(newtGrid grid, char * title);
#ifdef __cplusplus
} /* End of extern "C" { */
newtPopWindow();
- newtOpenWindow(10, 5, 45, 15, "another example");
-
- t = newtTextbox(-1, -1, 40, 5, NEWT_FLAG_WRAP);
+ t = newtTextbox(-1, -1, 40, 4, NEWT_FLAG_WRAP);
newtTextboxSetText(t, "This is a quite a bit of text. It is 40 "
"columns long, so some wrapping should be "
"done. Did you know that the quick, brown "
newtGridSetField(subgrid, 0, 0, NEWT_GRID_COMPONENT, b1, 0, 0, 0, 0, 0, 0);
newtGridSetField(subgrid, 1, 0, NEWT_GRID_COMPONENT, b2, 0, 0, 0, 0, 0, 0);
- newtGridSetField(grid, 0, 0, NEWT_GRID_COMPONENT, t, 0, 0, 0, 0, 0, 0);
+ newtGridSetField(grid, 0, 0, NEWT_GRID_COMPONENT, t, 0, 0, 0, 1, 0, 0);
newtGridSetField(grid, 0, 1, NEWT_GRID_SUBGRID, subgrid, 0, 0, 0, 0, 0,
NEWT_GRID_FLAG_GROWX);
- newtGridPlace(grid, 1, 1);
+ newtGridWrappedWindow(grid, "another example");
f = newtForm(NULL, NULL, 0);
newtFormAddComponents(f, b1, t, b2, NULL);