]> git.sesse.net Git - vlc/blob - include/xconsole.h
Initial revision
[vlc] / include / xconsole.h
1 /*******************************************************************************
2  * xconsole.h: X11 console for interface
3  * (c)1998 VideoLAN
4  *******************************************************************************
5  * The X11 console is a simple way to get interactive input from the user. It
6  * does not disturbs the standard terminal output. In theory, multiple consoles
7  * could be openned on different displays.
8  *?? will probably evolve
9  *******************************************************************************/
10
11 /*******************************************************************************
12  * xconsole_t: X11 console descriptor
13  *******************************************************************************
14  * The display pointer is specific to this structure since in theory, multiple
15  * console could be openned on different displays. A console is divided in two
16  * sections. The lower one is a single line edit control. Above, a multi-line
17  * output zone allow to send messages.
18  *******************************************************************************/
19 typedef struct
20 {
21     /* Initialization fields - those fields should be initialized before 
22      * calling intf_OpenX11Console(). */
23     char *                  psz_display;                       /* display name */
24     char *                  psz_geometry;                   /* window geometry */    
25
26     /* following fields are internal */
27     
28     /* Settings and display properties */
29     Display *               p_display;                      /* display pointer */
30     int                     i_screen;                         /* screen number */
31     XFontStruct *           p_font;                               /* used font */    
32     Window                  window;                 /* window instance handler */
33
34     /* Graphic contexts */
35     GC                      default_gc;    /* graphic context for default text */
36
37     /* Pixmaps */
38     Pixmap                  background_pixmap;            /* window background */
39
40     /* Window properties */
41     int                     i_width, i_height;            /* window dimensions */ 
42     int                     i_text_offset;  /* text zone placement from bottom */
43     int                     i_text_line_height;/* height of a single text line */
44     int                     i_edit_height;           /* total edit zone height */
45     int                     i_edit_offset;  /* edit zone placement from bottom */
46
47     /* Text array */
48     char *                  psz_text[INTF_XCONSOLE_MAX_LINES];         /* text */    
49     int                     i_text_index;                   /* last line index */
50
51     /* Edit lines properties. The line has one more character than
52      * maximum width to allow adding a terminal '\0' when it is sent to 
53      * execution or text zone. The size must stay between 0 (included) and 
54      * INTF_X11_CONSOLE_MAX_LINE_WIDTH (included). The cursor position (index)
55      * can be between 0 (included) and size (included). */
56     char                    sz_edit[INTF_XCONSOLE_MAX_LINE_WIDTH + 1]; 
57     int                     i_edit_index;                   /* cursor position */
58     int                     i_edit_size;            /* total size of edit text */
59
60     /* History. The history array (composed of asciiz strings) has a base, 
61      * marking the *next* registered line, and an index, marking the actual
62      * line browsed. When an history browse is started, the current line is
63      * stored at base (but base isn't increased), and index is modified.
64      * When a command is executed, it is registered at base and base is
65      * increased. */
66     char *                  psz_history[INTF_XCONSOLE_HISTORY_SIZE + 1]; 
67     int                     i_history_index;               /* index in history */
68     int                     i_history_base;                    /* history base */
69 } xconsole_t;
70
71 /*******************************************************************************
72  * Prototypes
73  *******************************************************************************/
74 int  intf_OpenXConsole      ( xconsole_t *p_console );
75 void intf_CloseXConsole     ( xconsole_t *p_console );
76
77 void intf_ManageXConsole    ( xconsole_t *p_console );
78 void intf_ClearXConsole     ( xconsole_t *p_console );
79 void intf_PrintXConsole     ( xconsole_t *p_console, char *psz_str );