diff options
author | Simon Howard | 2009-02-08 17:52:08 +0000 |
---|---|---|
committer | Simon Howard | 2009-02-08 17:52:08 +0000 |
commit | 67fbcdce28b89b24f8fb27d5f25393ad775af719 (patch) | |
tree | 5c739d8bef1fda59a7553aa97889ff50f3048049 /textscreen/txt_gui.c | |
parent | 08bc270bb911feacb1607a8d7672e35d458df773 (diff) | |
parent | 39b7cb7bb2e14169af5dc07c7d429fc939200639 (diff) | |
download | chocolate-doom-67fbcdce28b89b24f8fb27d5f25393ad775af719.tar.gz chocolate-doom-67fbcdce28b89b24f8fb27d5f25393ad775af719.tar.bz2 chocolate-doom-67fbcdce28b89b24f8fb27d5f25393ad775af719.zip |
Merge from trunk.
Subversion-branch: /branches/raven-branch
Subversion-revision: 1442
Diffstat (limited to 'textscreen/txt_gui.c')
-rw-r--r-- | textscreen/txt_gui.c | 103 |
1 files changed, 101 insertions, 2 deletions
diff --git a/textscreen/txt_gui.c b/textscreen/txt_gui.c index 679d66fa..e7f0472e 100644 --- a/textscreen/txt_gui.c +++ b/textscreen/txt_gui.c @@ -252,6 +252,101 @@ void TXT_DrawString(char *s) TXT_GotoXY(x + strlen(s), y); } +void TXT_DrawHorizScrollbar(int x, int y, int w, int cursor, int range) +{ + int x1; + int cursor_x; + + if (!VALID_Y(y)) + { + return; + } + + TXT_FGColor(TXT_COLOR_BLACK); + TXT_BGColor(TXT_COLOR_GREY, 0); + + TXT_GotoXY(x, y); + TXT_PutChar('\x1b'); + + cursor_x = x + 1; + + if (range > 1) + { + cursor_x += (cursor * (w - 3)) / (range - 1); + } + + if (cursor_x > x + w - 2) + { + cursor_x = x + w - 2; + } + + for (x1=x+1; x1<x+w-1; ++x1) + { + if (VALID_X(x1)) + { + if (x1 == cursor_x) + { + TXT_PutChar('\xdb'); + } + else + { + TXT_PutChar('\xb1'); + } + } + } + + TXT_PutChar('\x1a'); +} + +void TXT_DrawVertScrollbar(int x, int y, int h, int cursor, int range) +{ + int y1; + int cursor_y; + + if (!VALID_X(x)) + { + return; + } + + TXT_FGColor(TXT_COLOR_BLACK); + TXT_BGColor(TXT_COLOR_GREY, 0); + + TXT_GotoXY(x, y); + TXT_PutChar('\x18'); + + cursor_y = y + 1; + + if (cursor_y > y + h - 2) + { + cursor_y = y + h - 2; + } + + if (range > 1) + { + cursor_y += (cursor * (h - 3)) / (range - 1); + } + + for (y1=y+1; y1<y+h-1; ++y1) + { + if (VALID_Y(y1)) + { + TXT_GotoXY(x, y1); + + if (y1 == cursor_y) + { + TXT_PutChar('\xdb'); + } + else + { + TXT_PutChar('\xb1'); + } + } + } + + TXT_GotoXY(x, y + h - 1); + TXT_PutChar('\x19'); +} + void TXT_InitClipArea(void) { if (cliparea == NULL) @@ -283,13 +378,17 @@ void TXT_PushClipArea(int x1, int x2, int y1, int y2) newarea->x1 = x1; if (x2 < newarea->x2) newarea->x2 = x2; - if (y1 > newarea->x1) + if (y1 > newarea->y1) newarea->y1 = y1; if (y2 < newarea->y2) newarea->y2 = y2; +#if 0 + printf("New scrollable area: %i,%i-%i,%i\n", x1, y1, x2, y2); +#endif + // Hook into the list - + newarea->next = cliparea; cliparea = newarea; } |