|
1 /* Public Domain Curses */ |
|
2 |
|
3 #include "pdcwin.h" |
|
4 |
|
5 RCSID("$Id: pdcsetsc.c,v 1.40 2008/07/14 04:24:52 wmcbrine Exp $") |
|
6 |
|
7 /*man-start************************************************************** |
|
8 |
|
9 Name: pdcsetsc |
|
10 |
|
11 Synopsis: |
|
12 int PDC_set_blink(bool blinkon); |
|
13 void PDC_set_title(const char *title); |
|
14 |
|
15 Description: |
|
16 PDC_set_blink() toggles whether the A_BLINK attribute sets an |
|
17 actual blink mode (TRUE), or sets the background color to high |
|
18 intensity (FALSE). The default is platform-dependent (FALSE in |
|
19 most cases). It returns OK if it could set the state to match |
|
20 the given parameter, ERR otherwise. Current platforms also |
|
21 adjust the value of COLORS according to this function -- 16 for |
|
22 FALSE, and 8 for TRUE. |
|
23 |
|
24 PDC_set_title() sets the title of the window in which the curses |
|
25 program is running. This function may not do anything on some |
|
26 platforms. (Currently it only works in Win32 and X11.) |
|
27 |
|
28 Portability X/Open BSD SYS V |
|
29 PDC_set_blink - - - |
|
30 PDC_set_title - - - |
|
31 |
|
32 **man-end****************************************************************/ |
|
33 |
|
34 int PDC_curs_set(int visibility) |
|
35 { |
|
36 CONSOLE_CURSOR_INFO cci; |
|
37 int ret_vis; |
|
38 |
|
39 PDC_LOG(("PDC_curs_set() - called: visibility=%d\n", visibility)); |
|
40 |
|
41 ret_vis = SP->visibility; |
|
42 |
|
43 if (GetConsoleCursorInfo(pdc_con_out, &cci) == FALSE) |
|
44 return ERR; |
|
45 |
|
46 switch(visibility) |
|
47 { |
|
48 case 0: /* invisible */ |
|
49 cci.bVisible = FALSE; |
|
50 break; |
|
51 case 2: /* highly visible */ |
|
52 cci.bVisible = TRUE; |
|
53 cci.dwSize = 95; |
|
54 break; |
|
55 default: /* normal visibility */ |
|
56 cci.bVisible = TRUE; |
|
57 cci.dwSize = SP->orig_cursor; |
|
58 break; |
|
59 } |
|
60 |
|
61 if (SetConsoleCursorInfo(pdc_con_out, &cci) == FALSE) |
|
62 return ERR; |
|
63 |
|
64 SP->visibility = visibility; |
|
65 return ret_vis; |
|
66 } |
|
67 |
|
68 void PDC_set_title(const char *title) |
|
69 { |
|
70 #ifdef PDC_WIDE |
|
71 wchar_t wtitle[512]; |
|
72 #endif |
|
73 PDC_LOG(("PDC_set_title() - called:<%s>\n", title)); |
|
74 |
|
75 #ifdef PDC_WIDE |
|
76 PDC_mbstowcs(wtitle, title, 511); |
|
77 SetConsoleTitleW(wtitle); |
|
78 #else |
|
79 SetConsoleTitleA(title); |
|
80 #endif |
|
81 } |
|
82 |
|
83 int PDC_set_blink(bool blinkon) |
|
84 { |
|
85 if (pdc_color_started) |
|
86 COLORS = 16; |
|
87 |
|
88 return blinkon ? ERR : OK; |
|
89 } |