|
Odamex
Setting the Standard in Multiplayer Doom
|
00001 // Emacs style mode select -*- C++ -*- 00002 //----------------------------------------------------------------------------- 00003 // 00004 // Copyright(C) 2006 Simon Howard 00005 // 00006 // This program is free software; you can redistribute it and/or 00007 // modify it under the terms of the GNU General Public License 00008 // as published by the Free Software Foundation; either version 2 00009 // of the License, or (at your option) any later version. 00010 // 00011 // This program is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 // GNU General Public License for more details. 00015 // 00016 // You should have received a copy of the GNU General Public License 00017 // along with this program; if not, write to the Free Software 00018 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 00019 // 02111-1307, USA. 00020 // 00021 00022 #ifndef TXT_WINDOW_H 00023 #define TXT_WINDOW_H 00024 00050 typedef struct txt_window_s txt_window_t; 00051 00052 #include "txt_widget.h" 00053 #include "txt_table.h" 00054 #include "txt_window_action.h" 00055 00056 // Callback function for window key presses 00057 00058 typedef int (*TxtWindowKeyPress)(txt_window_t *window, int key, void *user_data); 00059 typedef int (*TxtWindowMousePress)(txt_window_t *window, 00060 int x, int y, int b, 00061 void *user_data); 00062 00063 struct txt_window_s 00064 { 00065 // Base class: all windows are tables with one column. 00066 00067 txt_table_t table; 00068 00069 // Window title 00070 00071 char *title; 00072 00073 // Screen coordinates of the window 00074 00075 txt_vert_align_t vert_align; 00076 txt_horiz_align_t horiz_align; 00077 int x, y; 00078 00079 // Actions that appear in the box at the bottom of the window 00080 00081 txt_window_action_t *actions[3]; 00082 00083 // Callback functions to invoke when keys/mouse buttons are pressed 00084 00085 TxtWindowKeyPress key_listener; 00086 void *key_listener_data; 00087 TxtWindowMousePress mouse_listener; 00088 void *mouse_listener_data; 00089 00090 // These are set automatically when the window is drawn 00091 00092 int window_x, window_y; 00093 unsigned int window_w, window_h; 00094 }; 00095 00104 txt_window_t *TXT_NewWindow(char *title); 00105 00112 void TXT_CloseWindow(txt_window_t *window); 00113 00131 void TXT_SetWindowPosition(txt_window_t *window, 00132 txt_horiz_align_t horiz_align, 00133 txt_vert_align_t vert_align, 00134 int x, int y); 00135 00148 void TXT_SetWindowAction(txt_window_t *window, txt_horiz_align_t position, 00149 txt_window_action_t *action); 00150 00161 void TXT_SetKeyListener(txt_window_t *window, 00162 TxtWindowKeyPress key_listener, 00163 void *user_data); 00164 00175 void TXT_SetMouseListener(txt_window_t *window, 00176 TxtWindowMousePress mouse_listener, 00177 void *user_data); 00178 00179 #endif /* #ifndef TXT_WINDOW_T */ 00180 00181