summaryrefslogtreecommitdiffstats
path: root/Utilities/cmpdcurses/wincon/pdcsetsc.c
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-01-12 21:14:36 (GMT)
committerBrad King <brad.king@kitware.com>2022-01-12 21:14:36 (GMT)
commit89703bc94147c0abaf0e0b9fd2e40dc0de202868 (patch)
tree714d4d91f18174bc37f9b9f8186fc64f40b520eb /Utilities/cmpdcurses/wincon/pdcsetsc.c
parentd03091edad1040707ce310589286cadff495d5bf (diff)
parentf84c4112c30c53bd84a12375b0b26c10a081cb46 (diff)
downloadCMake-89703bc94147c0abaf0e0b9fd2e40dc0de202868.zip
CMake-89703bc94147c0abaf0e0b9fd2e40dc0de202868.tar.gz
CMake-89703bc94147c0abaf0e0b9fd2e40dc0de202868.tar.bz2
Merge branch 'upstream-PDCurses' into update-pdcurses
# By PDCurses Upstream * upstream-PDCurses: PDCurses 2021-12-08 (f1cd4f45)
Diffstat (limited to 'Utilities/cmpdcurses/wincon/pdcsetsc.c')
-rw-r--r--Utilities/cmpdcurses/wincon/pdcsetsc.c130
1 files changed, 130 insertions, 0 deletions
diff --git a/Utilities/cmpdcurses/wincon/pdcsetsc.c b/Utilities/cmpdcurses/wincon/pdcsetsc.c
new file mode 100644
index 0000000..a2d1b6d
--- /dev/null
+++ b/Utilities/cmpdcurses/wincon/pdcsetsc.c
@@ -0,0 +1,130 @@
+/* PDCurses */
+
+#include "pdcwin.h"
+
+/*man-start**************************************************************
+
+pdcsetsc
+--------
+
+### Synopsis
+
+ int PDC_set_blink(bool blinkon);
+ int PDC_set_bold(bool boldon);
+ void PDC_set_title(const char *title);
+
+### Description
+
+ PDC_set_blink() toggles whether the A_BLINK attribute sets an actual
+ blink mode (TRUE), or sets the background color to high intensity
+ (FALSE). The default is platform-dependent (FALSE in most cases). It
+ returns OK if it could set the state to match the given parameter,
+ ERR otherwise.
+
+ PDC_set_bold() toggles whether the A_BOLD attribute selects an actual
+ bold font (TRUE), or sets the foreground color to high intensity
+ (FALSE). It returns OK if it could set the state to match the given
+ parameter, ERR otherwise.
+
+ PDC_set_title() sets the title of the window in which the curses
+ program is running. This function may not do anything on some
+ platforms.
+
+### Portability
+ X/Open ncurses NetBSD
+ PDC_set_blink - - -
+ PDC_set_title - - -
+
+**man-end****************************************************************/
+
+int PDC_curs_set(int visibility)
+{
+ CONSOLE_CURSOR_INFO cci;
+ int ret_vis;
+
+ PDC_LOG(("PDC_curs_set() - called: visibility=%d\n", visibility));
+
+ ret_vis = SP->visibility;
+
+ if (GetConsoleCursorInfo(pdc_con_out, &cci) == FALSE)
+ return ERR;
+
+ switch(visibility)
+ {
+ case 0: /* invisible */
+ cci.bVisible = FALSE;
+ break;
+ case 2: /* highly visible */
+ cci.bVisible = TRUE;
+ cci.dwSize = 95;
+ break;
+ default: /* normal visibility */
+ cci.bVisible = TRUE;
+ cci.dwSize = SP->orig_cursor;
+ break;
+ }
+
+ if (SetConsoleCursorInfo(pdc_con_out, &cci) == FALSE)
+ return ERR;
+
+ SP->visibility = visibility;
+ return ret_vis;
+}
+
+void PDC_set_title(const char *title)
+{
+#ifdef PDC_WIDE
+ wchar_t wtitle[512];
+#endif
+ PDC_LOG(("PDC_set_title() - called:<%s>\n", title));
+
+#ifdef PDC_WIDE
+ PDC_mbstowcs(wtitle, title, 511);
+ SetConsoleTitleW(wtitle);
+#else
+ SetConsoleTitleA(title);
+#endif
+}
+
+int PDC_set_blink(bool blinkon)
+{
+ if (!SP)
+ return ERR;
+
+ if (SP->color_started)
+ {
+ COLORS = 16;
+ if (PDC_can_change_color()) /* is_nt */
+ {
+ if (pdc_conemu || SetConsoleMode(pdc_con_out, 0x0004)) /* VT */
+ COLORS = PDC_MAXCOL;
+
+ if (!pdc_conemu)
+ SetConsoleMode(pdc_con_out, 0x0010); /* LVB */
+ }
+ }
+
+ if (blinkon)
+ {
+ if (!(SP->termattrs & A_BLINK))
+ {
+ SP->termattrs |= A_BLINK;
+ pdc_last_blink = GetTickCount();
+ }
+ }
+ else
+ {
+ if (SP->termattrs & A_BLINK)
+ {
+ SP->termattrs &= ~A_BLINK;
+ PDC_blink_text();
+ }
+ }
+
+ return OK;
+}
+
+int PDC_set_bold(bool boldon)
+{
+ return boldon ? ERR : OK;
+}