Mercurial > emacs
annotate lwlib/xlwmenuP.h @ 111449:132f2dfd549f
Merge from emacs-23
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Tue, 09 Nov 2010 15:07:10 -0500 |
parents | 9a798edc503b |
children | 417b1e4d63cd |
rev | line source |
---|---|
60584
597c62d04dec
Add missing copyright and license notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
53564
diff
changeset
|
1 /* Internals of a lightweight menubar widget. |
76180 | 2 Copyright (C) 1992 Lucid, Inc. |
106815 | 3 Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 |
76180 | 4 Free Software Foundation, Inc. |
60584
597c62d04dec
Add missing copyright and license notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
53564
diff
changeset
|
5 |
597c62d04dec
Add missing copyright and license notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
53564
diff
changeset
|
6 This file is part of the Lucid Widget Library. |
597c62d04dec
Add missing copyright and license notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
53564
diff
changeset
|
7 |
597c62d04dec
Add missing copyright and license notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
53564
diff
changeset
|
8 The Lucid Widget Library is free software; you can redistribute it and/or |
597c62d04dec
Add missing copyright and license notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
53564
diff
changeset
|
9 modify it under the terms of the GNU General Public License as published by |
76216
707d586d3aaa
Lucid Widget Library was released under GPLv1 or later (license only
Glenn Morris <rgm@gnu.org>
parents:
76180
diff
changeset
|
10 the Free Software Foundation; either version 1, or (at your option) |
60584
597c62d04dec
Add missing copyright and license notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
53564
diff
changeset
|
11 any later version. |
597c62d04dec
Add missing copyright and license notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
53564
diff
changeset
|
12 |
597c62d04dec
Add missing copyright and license notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
53564
diff
changeset
|
13 The Lucid Widget Library is distributed in the hope that it will be useful, |
597c62d04dec
Add missing copyright and license notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
53564
diff
changeset
|
14 but WITHOUT ANY WARRANTY; without even the implied warranty of |
597c62d04dec
Add missing copyright and license notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
53564
diff
changeset
|
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
597c62d04dec
Add missing copyright and license notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
53564
diff
changeset
|
16 GNU General Public License for more details. |
597c62d04dec
Add missing copyright and license notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
53564
diff
changeset
|
17 |
597c62d04dec
Add missing copyright and license notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
53564
diff
changeset
|
18 You should have received a copy of the GNU General Public License |
597c62d04dec
Add missing copyright and license notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
53564
diff
changeset
|
19 along with GNU Emacs; see the file COPYING. If not, write to the |
64083 | 20 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
21 Boston, MA 02110-1301, USA. */ | |
60584
597c62d04dec
Add missing copyright and license notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
53564
diff
changeset
|
22 |
7359 | 23 #ifndef _XlwMenuP_h |
24 #define _XlwMenuP_h | |
25 | |
26 #include "xlwmenu.h" | |
27 #include <X11/CoreP.h> | |
107804
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
28 #ifdef HAVE_XFT |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
29 #include <X11/Xft/Xft.h> |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
30 #endif |
7359 | 31 |
32 /* Elements in the stack arrays. */ | |
33 typedef struct _window_state | |
34 { | |
107886
9a798edc503b
Don't redraw lucid menus more than needed. Use double buffer to reduce flicker.
Jan D <jan.h.d@swipnet.se>
parents:
107804
diff
changeset
|
35 Widget w; |
7359 | 36 Window window; |
107886
9a798edc503b
Don't redraw lucid menus more than needed. Use double buffer to reduce flicker.
Jan D <jan.h.d@swipnet.se>
parents:
107804
diff
changeset
|
37 Pixmap pixmap; |
7359 | 38 Position x; |
39 Position y; | |
40 Dimension width; | |
41 Dimension height; | |
42 Dimension label_width; | |
107804
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
43 int max_rest_width; |
25033
584c34c7cf53
(_window_state): Add button_width.
Gerd Moellmann <gerd@gnu.org>
parents:
7360
diff
changeset
|
44 |
584c34c7cf53
(_window_state): Add button_width.
Gerd Moellmann <gerd@gnu.org>
parents:
7360
diff
changeset
|
45 /* Width of toggle buttons or radio buttons. */ |
584c34c7cf53
(_window_state): Add button_width.
Gerd Moellmann <gerd@gnu.org>
parents:
7360
diff
changeset
|
46 Dimension button_width; |
107804
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
47 #ifdef HAVE_XFT |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
48 XftDraw* xft_draw; |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
49 #endif |
7359 | 50 } window_state; |
51 | |
52 | |
53 /* New fields for the XlwMenu widget instance record */ | |
45145
762469b26903
(_XlwMenu_part): Add new member `disabled_foreground'.
Pavel Janík <Pavel@Janik.cz>
parents:
29699
diff
changeset
|
54 typedef struct _XlwMenu_part |
7359 | 55 { |
56 /* slots set by the resources */ | |
60698
3e557e11645e
Add support for I18N to Lucid menus.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60584
diff
changeset
|
57 #ifdef HAVE_X_I18N |
61210
0eb69e12c16d
* xlwmenuP.h (_XlwMenu_part): Add fontSet resource.
Jan Djärv <jan.h.d@swipnet.se>
parents:
60829
diff
changeset
|
58 XFontSet fontSet; |
60698
3e557e11645e
Add support for I18N to Lucid menus.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60584
diff
changeset
|
59 XFontSetExtents *font_extents; |
61210
0eb69e12c16d
* xlwmenuP.h (_XlwMenu_part): Add fontSet resource.
Jan Djärv <jan.h.d@swipnet.se>
parents:
60829
diff
changeset
|
60 #endif |
107804
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
61 #ifdef HAVE_XFT |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
62 String faceName; |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
63 int default_face; |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
64 XftFont* xft_font; |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
65 XftColor xft_fg, xft_bg, xft_disabled_fg; |
24c4451bcaf7
Lucid menus can now use Xft for fonts.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
66 #endif |
7359 | 67 XFontStruct* font; |
7360 | 68 Pixel foreground; |
45145
762469b26903
(_XlwMenu_part): Add new member `disabled_foreground'.
Pavel Janík <Pavel@Janik.cz>
parents:
29699
diff
changeset
|
69 Pixel disabled_foreground; |
7359 | 70 Pixel button_foreground; |
71 Dimension margin; | |
72 Dimension horizontal_spacing; | |
73 Dimension vertical_spacing; | |
74 Dimension arrow_spacing; | |
75 Dimension shadow_thickness; | |
76 Pixel top_shadow_color; | |
77 Pixel bottom_shadow_color; | |
78 Pixmap top_shadow_pixmap; | |
79 Pixmap bottom_shadow_pixmap; | |
7360 | 80 Cursor cursor_shape; |
7359 | 81 XtCallbackList open; |
27340
1d84a7873d7c
(_XlwMenu_part): Add `highlight' callback list.
Gerd Moellmann <gerd@gnu.org>
parents:
25033
diff
changeset
|
82 XtCallbackList select, highlight; |
75017
977e9b2fe72d
(_XlwMenu_part): Add enter/leave callbacks and
Jan Djärv <jan.h.d@swipnet.se>
parents:
68640
diff
changeset
|
83 XtCallbackList enter, leave; |
7359 | 84 widget_value* contents; |
85 int horizontal; | |
29699
bb36becbd66b
(_XlwMenu_part): Add free_top_shadow_color_p and
Gerd Moellmann <gerd@gnu.org>
parents:
27340
diff
changeset
|
86 |
bb36becbd66b
(_XlwMenu_part): Add free_top_shadow_color_p and
Gerd Moellmann <gerd@gnu.org>
parents:
27340
diff
changeset
|
87 /* True means top_shadow_color and/or bottom_shadow_color must be freed. */ |
bb36becbd66b
(_XlwMenu_part): Add free_top_shadow_color_p and
Gerd Moellmann <gerd@gnu.org>
parents:
27340
diff
changeset
|
88 unsigned free_top_shadow_color_p : 1; |
bb36becbd66b
(_XlwMenu_part): Add free_top_shadow_color_p and
Gerd Moellmann <gerd@gnu.org>
parents:
27340
diff
changeset
|
89 unsigned free_bottom_shadow_color_p : 1; |
45145
762469b26903
(_XlwMenu_part): Add new member `disabled_foreground'.
Pavel Janík <Pavel@Janik.cz>
parents:
29699
diff
changeset
|
90 |
7359 | 91 /* State of the XlwMenu */ |
53564
609ef1718642
Changes for lucid popup menus (keyboard traversal enabled) and dialogs
Jan Djärv <jan.h.d@swipnet.se>
parents:
52401
diff
changeset
|
92 int top_depth; |
7359 | 93 int old_depth; |
94 widget_value** old_stack; | |
95 int old_stack_length; | |
75017
977e9b2fe72d
(_XlwMenu_part): Add enter/leave callbacks and
Jan Djärv <jan.h.d@swipnet.se>
parents:
68640
diff
changeset
|
96 widget_value* inside_entry; |
7359 | 97 |
98 /* New state after the user moved */ | |
99 int new_depth; | |
100 widget_value** new_stack; | |
101 int new_stack_length; | |
102 | |
103 /* Window resources */ | |
104 window_state* windows; | |
105 int windows_length; | |
106 | |
107 /* Internal part, set by the XlwMenu */ | |
108 GC foreground_gc; | |
109 GC button_gc; | |
110 GC background_gc; | |
45145
762469b26903
(_XlwMenu_part): Add new member `disabled_foreground'.
Pavel Janík <Pavel@Janik.cz>
parents:
29699
diff
changeset
|
111 GC disabled_gc; |
7359 | 112 GC inactive_button_gc; |
113 GC shadow_top_gc; | |
114 GC shadow_bottom_gc; | |
115 Cursor cursor; | |
116 Boolean popped_up; | |
117 Pixmap gray_pixmap; | |
118 } XlwMenuPart; | |
119 | |
120 /* Full instance record declaration */ | |
45145
762469b26903
(_XlwMenu_part): Add new member `disabled_foreground'.
Pavel Janík <Pavel@Janik.cz>
parents:
29699
diff
changeset
|
121 typedef struct _XlwMenuRec |
7359 | 122 { |
123 CorePart core; | |
124 XlwMenuPart menu; | |
125 } XlwMenuRec; | |
126 | |
127 /* New fields for the XlwMenu widget class record */ | |
45145
762469b26903
(_XlwMenu_part): Add new member `disabled_foreground'.
Pavel Janík <Pavel@Janik.cz>
parents:
29699
diff
changeset
|
128 typedef struct |
7359 | 129 { |
130 int dummy; | |
131 } XlwMenuClassPart; | |
132 | |
133 /* Full class record declaration. */ | |
45145
762469b26903
(_XlwMenu_part): Add new member `disabled_foreground'.
Pavel Janík <Pavel@Janik.cz>
parents:
29699
diff
changeset
|
134 typedef struct _XlwMenuClassRec |
7359 | 135 { |
136 CoreClassPart core_class; | |
137 XlwMenuClassPart menu_class; | |
138 } XlwMenuClassRec; | |
139 | |
140 /* Class pointer. */ | |
141 extern XlwMenuClassRec xlwMenuClassRec; | |
142 | |
143 #endif /* _XlwMenuP_h */ | |
52401 | 144 |
145 /* arch-tag: 18d7fc41-ffa0-47a3-a49f-3469900c7a25 | |
146 (do not change this comment) */ |