1/* 2 * Author: William Chia-Wei Cheng (bill.cheng@acm.org) 3 * 4 * Copyright (C) 2001-2009, William Chia-Wei Cheng. 5 * 6 * This file may be distributed under the terms of the Q Public License 7 * as defined by Trolltech AS of Norway and appearing in the file 8 * LICENSE.QPL included in the packaging of this file. 9 * 10 * THIS FILE IS PROVIDED AS IS WITH NO WARRANTY OF ANY KIND, INCLUDING 11 * THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR 12 * PURPOSE. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, 13 * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING 14 * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, 15 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 16 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 * 18 * @(#)$Header: /mm2/home/cvs/bc-src/tgif/tdgtbase.e,v 1.7 2011/05/16 16:21:59 william Exp $ 19 */ 20 21#ifndef _TDGTBASE_E_ 22#define _TDGTBASE_E_ 23 24#include "tidget.h" 25 26#include "list.e" 27 28#define TDGTBASE_DEF_H_PAD 4 29#define TDGTBASE_DEF_V_PAD 4 30 31#define TDGTCMD_CAN_HANDLE_FOCUS_CHANGE 1 32#define TDGTCMD_REMOVE_FOCUS 2 33 34struct tagTdgtBase; 35 36typedef int (TdgtBaseKeyPressEvHandlerCallbackFunc)ARGS_DECL(( 37 struct tagTdgtBase *, XEvent*)); 38typedef void (TdgtBaseWmDeleteEvHandlerCallbackFunc)ARGS_DECL(( 39 struct tagTdgtBase *)); 40typedef int (TdgtBaseFocusCallbackFunc)ARGS_DECL(( 41 struct tagTdgtBase *, int cmd_type, int cmd_arg, 42 void *pv_cmd_userdata)); 43 44/* 45 * A base tidget is a container of which other tidgets can sit on top. 46 */ 47typedef struct tagTdgtBase { 48 TidgetInfo *pti; 49 50 /* callback functions */ 51 TdgtBaseKeyPressEvHandlerCallbackFunc *pf_key_press_ev_handler_callback; 52 TdgtBaseWmDeleteEvHandlerCallbackFunc *pf_wm_delete_ev_handler_callback; 53 TdgtBaseFocusCallbackFunc *pf_focus_callback; 54} TdgtBase; 55 56#ifdef _INCLUDE_FROM_TDGTBASE_C_ 57#undef extern 58#define extern 59#endif /*_INCLUDE_FROM_TDGTBASE_C_*/ 60 61extern void TdgtBaseReset ARGS_DECL((TdgtBase*)); 62extern TdgtBase *CreateTdgtBase ARGS_DECL((Window parent_win, 63 TidgetInfo *parent_tidgetinfo, int ctl_id, 64 int x, int y, int w, int h, int h_pad, 65 int v_pad, int state, char *caption)); 66 67extern int TdgtBaseSetText ARGS_DECL((TdgtBase*, char *str)); 68extern char *TdgtBaseGetText ARGS_DECL((TdgtBase*)); 69extern int TdgtBaseSetState ARGS_DECL((TdgtBase*, int)); 70extern int TdgtBaseGetState ARGS_DECL((TdgtBase*)); 71 72extern int TdgtBaseAddChild ARGS_DECL((TdgtBase*, TidgetInfo*)); 73 74extern void TdgtBaseWillHandleKeyPressEvents ARGS_DECL((TdgtBase*, 75 TdgtBaseKeyPressEvHandlerCallbackFunc*)); 76extern void TdgtBaseSetWmDeleteCallback ARGS_DECL((TdgtBase*, 77 TdgtBaseWmDeleteEvHandlerCallbackFunc*)); 78extern void TdgtBaseSetFocusCallback ARGS_DECL((TdgtBase*, 79 TdgtBaseFocusCallbackFunc*)); 80 81extern int InitTdgtBase ARGS_DECL((void)); 82extern void CleanUpTdgtBase ARGS_DECL((void)); 83 84#ifdef _INCLUDE_FROM_TDGTBASE_C_ 85#undef extern 86#ifndef _NO_RECURSIVE_EXTERN 87#define extern extern 88#endif /* ~_NO_RECURSIVE_EXTERN */ 89#endif /*_INCLUDE_FROM_TDGTBASE_C_*/ 90 91#endif /*_TDGTBASE_E_*/ 92