File: movingbutton.h

package info (click to toggle)
xbl 1.1.2-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 704 kB
  • ctags: 717
  • sloc: ansic: 7,286; makefile: 273; python: 21; sh: 8
file content (105 lines) | stat: -rw-r--r-- 3,841 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*
    XBlockOut a 3D Tetris

    Copyright (C) 1992,1993,1994  Thierry EXCOFFIER

    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 1, 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., 675 Mass Ave, Cambridge, MA 02139, USA.

    Contact: Thierry.EXCOFFIER@liris.univ-lyon1.fr
*/

#include <X11/Xlib.h>

#define FLAT_TEXT	0
#define RELIEF_TEXT	1
#define PUSHING_TEXT	0
#define PULLING_TEXT	1
#define STOP_TEXT	2
#define A_BUTTON	0
#define A_LINE		1
#define A_COLUMN	2
#define INIT_MINIMUM	0
#define COMPUTE_MINIMUM 1
#define GIVE_MINIMUM	2

struct text_line
	{
	char *current_text ;	/* The text to display on the line */
	char *maximum_text ;	/* The widest text to display	*/
	XFontStruct *xfont ;	/* The font to display text */
	GC gc ;			/* To draw text */
	int x,y,height ;	/* Position of text in window */
	struct text_line *next ;
	} ;

struct movinggc
	{
	GC	rectangle ;	/* Draw rectangle for flat buttons */
	GC	upleft,downright ; /* For relief */
	GC	back ;		/* inside the button */
	Pixmap	tile[17] ;	/* For text vanishement */
	} ;

struct moving_button
	{
	int type ;		/* Must be A_BUTTON */
	int dx,dy ;		/* Must be here */
	struct text_line *text ;
	Display	*display ;
	Window window ;
	int typet ;		/* FLAT_TEXT , RELIEF_TEXT */
	int direction ;		/* PUSHING_TEXT, PULLING_TEXT, STOP_TEXT */
	int height ;		/* height of the button, dz is the maximum */
	int x,y,dz ;		/* External size of button */
	int margin ;		/* Size of margin in pixel */
	int linestretching ;	/* */
	struct movinggc *gc ;
	void (*fct)() ;		/* fct to call if press */
	int but ;		/* Argument for fct */
	void (*prp)() ;		/* fct to call before display */
	struct menu *menu ;
	} ;

struct row_column
	{
	int type ; /* A_LINE A_COLUMN */
	int dx,dy ; /* Must be here */
	struct row_column *in ;
	struct row_column *next ;
	} ;

extern struct text_line* create_line(char *maximum, XFontStruct *xfont, GC gc) ;
extern struct moving_button* create_button(Display *d,Window w,int height,int type,struct movinggc *gc,
		  void (*fct)(),void (*prp)(),...) ;
extern void init_movinggc(Display *d, Window w, struct movinggc *mgc, long unsigned int background, long unsigned int foreground, long unsigned int shadow) ;
extern struct row_column* scotch(struct row_column *r, ...) ;
extern void walkrowcol(struct row_column *r, void (*fct) (/* ??? */), int x, int y, int b, int b2) ;
extern void button_extent(struct moving_button *b) ;
extern void display_button(struct moving_button *b,int x,int y, int dx,int dy) ;
extern void next_button(struct moving_button *b) ;
extern void sizerowcol(struct row_column *b) ;
extern void push_button(struct moving_button *b,int x,int y,int but) ;
extern int minimumheight(struct moving_button *b,int x) ;
extern void windowset(struct row_column *b,Window x) ;
extern void stretch(struct moving_button *b,int x) ;
extern void posit_button(struct row_column *b,int x,int y) ;
extern void resizex(struct row_column *r,int x) ;
extern int compute_height(struct row_column *r) ;
extern void compute_stretch(struct row_column *r,int x) ;
extern void compute_rowcol(struct row_column *r) ;
extern void compute_posit(struct row_column *r,int x) ;
extern void display_rowcol(struct row_column *r,int x,int y,int dx,int dy) ;
extern void push_rowcol(struct row_column *r,int x,int y,int b) ;