home *** CD-ROM | disk | FTP | other *** search
- /*#cdg#cursesdemo#******************************************************
- * *
- * Copyright 1987 Cygnus Development Group *
- * *
- * This software is a proprietary product of *
- * the Cygnus Development Group (CDG). *
- * ALL RIGHTS RESERVED *
- * *
- ************************************************************************
- * *
- * Purpose: *
- * The executable demonstration program may be freely *
- * distributed. The source code included on this disk, along *
- * with the 'readme.doc' file MUST be included with the *
- * program. This program and its source code remain the *
- * property of the Cygnus Development Group, and may not be *
- * redistributed for profit, in whole or in part, without *
- * the express WRITTEN permission of the Cygnus Development *
- * Group. *
- * *
- * *
- ***********************************************************************/
-
-
-
- #include <curses.h>
- #include <dostools.h>
- #include <xchars.h>
-
-
- /*********************************
- * Keyboard status routine...
- */
-
- static WINDOW *keyw = NULL;
-
- int update_status()
- {
- if ( keyw ) {
- mvwaddstr( keyw, 1, 17, left_shift ? "On " : "Off");
- mvwaddstr( keyw, 2, 17, right_shift ? "On " : "Off");
- mvwaddstr( keyw, 3, 17, ctrl_key ? "On " : "Off");
- mvwaddstr( keyw, 4, 17, alt_key ? "On " : "Off");
- mvwaddstr( keyw, 1, 39, caps_lock ? "On " : "Off");
- mvwaddstr( keyw, 2, 39, num_lock ? "On " : "Off");
- mvwaddstr( keyw, 3, 39, scroll_lock ? "On " : "Off");
- mvwaddstr( keyw, 4, 39, insert ? "On " : "Off");
- wrefresh( keyw);
- }
- }
- /*
- * 012345678901234567890123456789012345678901234
- * -|12345678901234567890123456|----------------
- * | Left Shift: xxx Caps Lock: xxx |
- * | Right Shift: xxx Num Lock: xxx |
- * | Ctrl Shift: xxx Scroll Lock: xxx |
- * | Alt Shift: xxx Insert: xxx |
- * ---------------------------------------------
- */
-
- int build_status_window()
- {
- if ( !keyw ) {
- keyw = newwin( 6, 45, 1, 2);
- wattrset( keyw, A_FG_BLACK | A_BG_CYAN);
- wclear( keyw);
- box( keyw, VS_LINE, HD_LINE);
- leaveok( keyw, TRUE);
- wmove( keyw, 0, 1);
- wputch( keyw, R_HD_VS_TEE);
- wstandout( keyw);
- waddstr( keyw, " Current Keyboard Status ");
- wstandend( keyw);
- wputch( keyw, L_HD_VS_TEE);
- mvwaddstr( keyw, 1, 3, "Left Shift: Caps Lock:");
- mvwaddstr( keyw, 2, 3, "Right Shift: Num Lock:");
- mvwaddstr( keyw, 3, 3, "Ctrl Shift: Scroll Lock:");
- mvwaddstr( keyw, 4, 3, "Alt Shift: Insert:");
- }
- }
-
- int delete_status_window()
- {
- delwin( keyw);
- keyw = NULL;
- }
-