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/tdgtbtn.e,v 1.6 2011/05/16 16:22:00 william Exp $
19 */
20
21#ifndef _TDGTBTN_E_
22#define _TDGTBTN_E_
23
24#include "tidget.h"
25
26#define TDGTBTN_DEF_H_PAD 0
27#define TDGTBTN_DEF_V_PAD 0
28
29#define TDGTBTN_CLICK 0
30#define TDGTBTN_STICKY 1
31
32typedef struct tagTdgtBtn {
33   TidgetInfo *pti;
34
35   int btn_type; /* TGMUTYPE_TEXT, TGMUTYPE_COLOR, or TGMUTYPE_BITMAP */
36   int btn_style; /* TDGTBTN_CLICK or TDGTBTN_STICKY */
37   int font_style; /* STYLE_NR, STYLE_BR, STYLE_NI, STYLE_BI */
38
39   /*
40    * for TGMUTYPE_TEXT, str is (char*), point to a string
41    * for TGMUTYPE_COLOR, str is (int), point to a color index
42    * for TGMUTYPE_BITMAP, str is (Pixmap*), point to a pixmap
43    */
44   char *str;
45   MouseOverStatusInfo mosi;
46} TdgtBtn;
47
48#ifdef _INCLUDE_FROM_TDGTBTN_C_
49#undef extern
50#define extern
51#endif /*_INCLUDE_FROM_TDGTBTN_C_*/
52
53extern void	CalcTdgtBtnDim ARGS_DECL((char *text, int min_len, int h_pad,
54				int v_pad, int *pn_width, int *pn_height));
55
56extern void	TdgtBtnReset ARGS_DECL((TdgtBtn*));
57extern TdgtBtn	*CreateTdgtBtn ARGS_DECL((Window parent_win,
58				TidgetInfo *parent_tidgetinfo, int ctl_id,
59				int x, int y, int w, int h, int h_pad,
60				int v_pad, int btn_type, int btn_style,
61				int state, int font_style, char *str,
62				MouseOverStatusInfo *pmosi));
63
64extern int	TdgtBtnSetText ARGS_DECL((TdgtBtn*, char *str,
65				MouseOverStatusInfo *pmosi));
66extern char	*TdgtBtnGetText ARGS_DECL((TdgtBtn*));
67extern int	TdgtBtnSetState ARGS_DECL((TdgtBtn*, int));
68extern int	TdgtBtnGetState ARGS_DECL((TdgtBtn*));
69
70extern int	InitTdgtBtn ARGS_DECL((void));
71extern void	CleanUpTdgtBtn ARGS_DECL((void));
72
73#ifdef _INCLUDE_FROM_TDGTBTN_C_
74#undef extern
75#ifndef _NO_RECURSIVE_EXTERN
76#define extern extern
77#endif /* ~_NO_RECURSIVE_EXTERN */
78#endif /*_INCLUDE_FROM_TDGTBTN_C_*/
79
80#endif /*_TDGTBTN_E_*/
81