2009-02-17 15:05:16 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
* $URL$
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
*/
|
2009-02-15 06:10:59 +00:00
|
|
|
|
|
|
|
/* SCI-specific widget handling */
|
|
|
|
|
2009-02-24 15:33:40 +00:00
|
|
|
#ifndef SCI_INCLUDE_SCI_WIDGETS_H
|
|
|
|
#define SCI_INCLUDE_SCI_WIDGETS_H
|
2009-02-15 06:10:59 +00:00
|
|
|
|
2009-02-27 02:23:40 +00:00
|
|
|
#include "sci/engine/state.h"
|
2009-02-15 06:10:59 +00:00
|
|
|
|
2009-02-21 10:23:36 +00:00
|
|
|
namespace Sci {
|
|
|
|
|
2009-03-24 11:31:16 +00:00
|
|
|
class Menu;
|
2009-02-21 22:50:35 +00:00
|
|
|
|
2009-03-25 12:07:10 +00:00
|
|
|
// The following flags are applicable to windows in SCI0
|
|
|
|
enum windowFlags {
|
2009-03-25 12:52:03 +00:00
|
|
|
kWindowTransparent = 0x01, // 0000 0001
|
|
|
|
kWindowNoFrame = 0x02, // 0000 0010 - a window without a frame
|
2009-03-25 12:07:10 +00:00
|
|
|
// Add title bar to window (10 pixels high, framed, text is centered and written in white on dark gray)
|
2009-03-25 12:52:03 +00:00
|
|
|
kWindowTitle = 0x04, // 0000 0100
|
|
|
|
// bits 3-6 are unused
|
2009-03-25 12:07:10 +00:00
|
|
|
kWindowDontDraw = 0x80, // 1000 0000 - don't draw anything
|
2009-03-25 12:52:03 +00:00
|
|
|
kWindowNoDropShadow = 0x1000000, // 0001 0000 0000 0000 0000 0000 0000 (not in SCI)
|
|
|
|
kWindowAutoRestore = 0x2000000
|
2009-03-25 12:07:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum controlStateFlags {
|
|
|
|
kControlStateEnabled = 0x0001, // 0001 - enabled buttons (used by the interpreter)
|
|
|
|
kControlStateDisabled = 0x0004, // 0010 - grayed out buttons (used by the interpreter)
|
|
|
|
kControlStateFramed = 0x0008, // 1000 - widgets surrounded by a frame (used by the interpreter)
|
|
|
|
kControlStateDitherFramed = 0x1000 // 0001 0000 0000 0000 - widgets surrounded by a dithered frame (used in kgraphics)
|
|
|
|
};
|
2009-02-15 06:10:59 +00:00
|
|
|
|
2009-04-24 10:46:20 +00:00
|
|
|
void sciw_set_status_bar(EngineState *s, GfxPort *status_bar, const Common::String &text, int fgcolor, int bgcolor);
|
2009-02-15 06:10:59 +00:00
|
|
|
/* Sets the contents of a port used as status bar
|
2009-02-21 10:47:56 +00:00
|
|
|
** Parmeters: (EngineState *) s: The affected game state
|
2009-04-24 10:46:20 +00:00
|
|
|
** (GfxPort *) status_bar: The status bar port
|
2009-03-24 11:31:16 +00:00
|
|
|
** (const char *) text: The text to draw
|
2009-02-15 06:10:59 +00:00
|
|
|
** Returns : (void)
|
|
|
|
*/
|
|
|
|
|
2009-04-24 10:46:20 +00:00
|
|
|
GfxPort *sciw_new_window(EngineState *s, rect_t area, int font, gfx_color_t color, gfx_color_t bgcolor,
|
2009-02-22 13:11:43 +00:00
|
|
|
int title_font, gfx_color_t title_color, gfx_color_t title_bg_color,
|
|
|
|
const char *title, int flags);
|
2009-02-15 06:10:59 +00:00
|
|
|
/* Creates a new SCI style window
|
2009-02-21 10:47:56 +00:00
|
|
|
** Parameters: (EngineState *) s: The affected game state
|
2009-02-15 06:10:59 +00:00
|
|
|
** (rect_t) area: The screen area to frame (not including a potential window title)
|
|
|
|
** (int) font: Default font number to use
|
|
|
|
** (gfx_color_t) color: The foreground color to use for drawing
|
|
|
|
** (gfx_color_t) bgcolor: The background color to use
|
|
|
|
** (int) title_font: The font to use for the title bar (if any)
|
|
|
|
** (gfx_color_t) title_color: Color to use for the title bar text
|
|
|
|
** (gfx_color_t) title_bg_color: Color to use for the title bar background
|
|
|
|
** (const char *) title: The text to write into the title bar
|
|
|
|
** (int) flags: Any ORred combination of window flags
|
2009-04-24 10:46:20 +00:00
|
|
|
** Returns : (GfxPort *) A newly allocated port with the requested characteristics
|
2009-02-15 06:10:59 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*---------------------*/
|
|
|
|
/*** Control widgets ***/
|
|
|
|
/*---------------------*/
|
|
|
|
|
2009-04-24 10:46:20 +00:00
|
|
|
GfxList *sciw_new_button_control(GfxPort *port, reg_t ID, rect_t zone, char *text, int font, char selected, char inverse, char gray);
|
2009-02-15 06:10:59 +00:00
|
|
|
/* Creates a new button control list
|
2009-04-24 10:46:20 +00:00
|
|
|
** Parameters: (GfxPort *) port: The port containing the color values to use for the
|
2009-02-15 06:10:59 +00:00
|
|
|
** button (the button is /not/ appended to the port there)
|
|
|
|
** (reg_t) ID: Button's ID
|
|
|
|
** (rect_t) zone: The area occupied by the button
|
|
|
|
** (char *) text: The text to write into the button
|
|
|
|
** (int) font: The font to use for the button
|
|
|
|
** (char) selected: Whether the button should be marked as being selected by the keyboard focus
|
|
|
|
** (char) inverse: Whether to inverse the color scheme
|
|
|
|
** (char) gray: Whether the button should be grayed out
|
2009-04-24 10:46:20 +00:00
|
|
|
** Returns : (GfxList *) The button
|
2009-02-15 06:10:59 +00:00
|
|
|
*/
|
|
|
|
|
2009-04-24 10:46:20 +00:00
|
|
|
GfxList *sciw_new_text_control(GfxPort *port, reg_t ID, rect_t zone, char *text, int font,
|
2009-02-22 13:11:43 +00:00
|
|
|
gfx_alignment_t align, char frame, char inverse);
|
2009-02-15 06:10:59 +00:00
|
|
|
/* Creates a new text control list
|
2009-04-24 10:46:20 +00:00
|
|
|
** Parameters: (GfxPort *) port: The port containing the color values to use
|
2009-02-15 06:10:59 +00:00
|
|
|
** (reg_t) ID: Text widget ID
|
|
|
|
** (rect_t) zone: Area occupied by the text
|
|
|
|
** (char *) text: The text
|
|
|
|
** (int) font: The font the text is to be drawn in
|
|
|
|
** (gfx_alignment_t) align: Horizontal text alignment to use
|
|
|
|
** (char) frame: Whether a dithered frame should surround the text
|
|
|
|
** (char) inverse: Whether the text colors should be inversed
|
2009-04-24 10:46:20 +00:00
|
|
|
** Returns : (GfxList *) The text control widget list
|
2009-02-15 06:10:59 +00:00
|
|
|
*/
|
|
|
|
|
2009-04-24 10:46:20 +00:00
|
|
|
GfxList *sciw_new_edit_control(GfxPort *port, reg_t ID, rect_t zone, char *text, int font, unsigned int cursor,
|
2009-02-22 13:11:43 +00:00
|
|
|
char inverse);
|
2009-02-15 06:10:59 +00:00
|
|
|
/* Creates a new edit control list
|
2009-04-24 10:46:20 +00:00
|
|
|
** Parameters: (GfxPort *) port: The port containing the color values to use
|
2009-02-15 06:10:59 +00:00
|
|
|
** (reg_t) ID: Text widget ID
|
|
|
|
** (rect_t) zone: Area occupied by the text
|
|
|
|
** (char *) text: The text
|
|
|
|
** (int) font: The font the text is to be drawn in
|
|
|
|
** (int) cursor: Cursor position
|
|
|
|
** (char) inverse: Whether the edit widget should be reversed
|
2009-04-24 10:46:20 +00:00
|
|
|
** Returns : (GfxList *) An appropriate widget list
|
2009-02-15 06:10:59 +00:00
|
|
|
*/
|
|
|
|
|
2009-04-24 10:46:20 +00:00
|
|
|
GfxList *sciw_new_icon_control(GfxPort *port, reg_t ID, rect_t zone, int view, int loop, int cel,
|
2009-02-22 13:11:43 +00:00
|
|
|
char frame, char inverse);
|
2009-02-15 06:10:59 +00:00
|
|
|
/* Creates a new icon control list
|
2009-04-24 10:46:20 +00:00
|
|
|
** Parameters: (GfxPort *) port: The port containing the color values to use
|
2009-02-15 06:10:59 +00:00
|
|
|
** (reg_t) ID: Text widget ID
|
|
|
|
** (rect_t) zone: Area occupied by the text
|
|
|
|
** (int x int x int) view, loop, cel: The cel to display
|
|
|
|
** (char) frame: Whether the widget should be surrounded by a frame
|
|
|
|
** (char) lina inverse: Whether colors should be inversed
|
2009-04-24 10:46:20 +00:00
|
|
|
** Returns : (GfxList *) An appropriate widget list
|
2009-02-15 06:10:59 +00:00
|
|
|
*/
|
|
|
|
|
2009-04-24 10:46:20 +00:00
|
|
|
GfxList *sciw_new_list_control(GfxPort *port, reg_t ID, rect_t zone, int font_nr, char **entries_list,
|
2009-02-22 13:11:43 +00:00
|
|
|
int entries_nr, int list_top, int selection, char inverse);
|
2009-02-15 06:10:59 +00:00
|
|
|
/* Creates a new list control list
|
2009-04-24 10:46:20 +00:00
|
|
|
** Parameters: (GfxPort *) port: The port containing the color values to use
|
2009-02-15 06:10:59 +00:00
|
|
|
** (int) ID: Text widget ID
|
|
|
|
** (rect_t) zone: Area occupied by the text
|
|
|
|
** (int) font_nr: number of the font to use
|
|
|
|
** (char **) entries_list: List of strings to contain within the list
|
|
|
|
** (int) entries_nr: Number of entries in entries_list
|
|
|
|
** (int) list_top: First list item that is visible
|
|
|
|
** (int) selection: The list item that is selected
|
|
|
|
** (char) invserse: The usual meaning
|
2009-04-24 10:46:20 +00:00
|
|
|
** Returns : (GfxList *) An appropriate widget list
|
2009-02-15 06:10:59 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*---------------------*/
|
|
|
|
/*** Menubar widgets ***/
|
|
|
|
/*---------------------*/
|
|
|
|
|
2009-04-24 10:46:20 +00:00
|
|
|
void sciw_set_menubar(EngineState *s, GfxPort *status_bar, Menubar *menubar, int selection);
|
2009-02-15 06:10:59 +00:00
|
|
|
/* Draws the menu bar
|
2009-02-21 10:47:56 +00:00
|
|
|
** Parameters: (EngineState *) s: The state to operate on
|
2009-04-24 10:46:20 +00:00
|
|
|
** (GfxPort *) status_bar: The status bar port to modify
|
2009-03-24 11:31:16 +00:00
|
|
|
** (Menubar *) menubar: The menu bar to use
|
2009-02-15 06:10:59 +00:00
|
|
|
** (int) selection: Number of the menu to hightlight, or -1 for 'none'
|
|
|
|
** Returns : (void)
|
|
|
|
*/
|
|
|
|
|
2009-04-24 10:46:20 +00:00
|
|
|
GfxPort *sciw_new_menu(EngineState *s, GfxPort *status_bar, Menubar *menubar, int selection);
|
2009-02-15 06:10:59 +00:00
|
|
|
/* Creates a menu port
|
2009-02-21 10:47:56 +00:00
|
|
|
** Parameters: (EngineState *) s: The state to operate on
|
2009-04-24 10:46:20 +00:00
|
|
|
** (GfxPort *) status_bar: The status bar
|
2009-03-24 11:31:16 +00:00
|
|
|
** (Menubar *) menubar: The menu bar to use
|
2009-02-15 06:10:59 +00:00
|
|
|
** (int) selection: Number of the menu to interpret
|
2009-04-24 10:46:20 +00:00
|
|
|
** Returns : (GfxPort *) The result port
|
2009-02-15 06:10:59 +00:00
|
|
|
*/
|
|
|
|
|
2009-04-24 10:46:20 +00:00
|
|
|
GfxPort *sciw_toggle_item(GfxPort *menu_port, Menu *menu, int selection, bool selected);
|
2009-03-25 16:37:50 +00:00
|
|
|
/* Toggle the selection of a menu item from a menu port
|
2009-04-24 10:46:20 +00:00
|
|
|
** Parameters: (GfxPort *) menu_port: The port to modify
|
2009-03-24 11:31:16 +00:00
|
|
|
** (Menu *) menu: The menu the menu port corresponds to
|
2009-02-15 06:10:59 +00:00
|
|
|
** (int) selection: Number of the menu entry to unselect, or -1 to do a NOP
|
2009-03-25 16:37:50 +00:00
|
|
|
** (bool) selected: Whether to set the item's state to selected or not
|
2009-04-24 10:46:20 +00:00
|
|
|
** Returns : (GfxPort *) The modified menu
|
2009-02-15 06:10:59 +00:00
|
|
|
*/
|
|
|
|
|
2009-02-21 10:23:36 +00:00
|
|
|
} // End of namespace Sci
|
|
|
|
|
2009-02-24 15:33:40 +00:00
|
|
|
#endif // SCI_INCLUDE_SCI_WIDGETS_H
|