This file is indexed.

/usr/include/bt/Menu.hh is in libbt-dev 0.70.1-20ubuntu2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
// Menu.hh for Blackbox - an X11 Window manager
// Copyright (c) 2001 - 2005 Sean 'Shaleh' Perry <shaleh@debian.org>
// Copyright (c) 1997 - 2000, 2002 - 2005
//         Bradley T Hughes <bhughes at trolltech.com>
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.

#ifndef __Menu_hh
#define __Menu_hh

#include "Color.hh"
#include "EventHandler.hh"
#include "Font.hh"
#include "Rect.hh"
#include "Texture.hh"
#include "Timer.hh"
#include "Util.hh"

#include <list>
#include <vector>

namespace bt {

  class Application;
  class Menu;

  class MenuItem
  {
  public:
    enum Type { Normal, Separator };
    inline MenuItem(Type t, const ustring &l = ustring())
      : sub(0), lbl(l), ident(~0u), indx(~0u), height(0),
        separator(t == Separator),
        active(0), title(0), enabled(1), checked(0)
    { }
    inline MenuItem(Menu *s, const ustring &l)
      : sub(s), lbl(l), ident(~0u), indx(~0u), height(0), separator(0),
        active(0), title(0), enabled(1), checked(0)
    { }

    inline bool isSeparator(void) const
    { return bool(separator); }
    inline bool isActive(void) const
    { return bool(active); }
    inline bool isTitle(void) const
    { return bool(title); }
    inline bool isEnabled(void) const
    { return bool(enabled); }
    inline bool isChecked(void) const
    { return bool(checked); }

    inline unsigned int id(void) const
    { return ident; }
    inline unsigned int index(void) const
    { return indx; }

    inline Menu *submenu(void) const
    { return sub; }

    inline const ustring &label(void) const
    { return lbl; }

  private:
    Menu *sub;
    ustring lbl;
    unsigned int ident;
    unsigned int indx;
    unsigned int height;
    unsigned int separator : 1;
    unsigned int active    : 1;
    unsigned int title     : 1;
    unsigned int enabled   : 1;
    unsigned int checked   : 1;

    friend class Menu;
  };


  class Resource;

  class MenuStyle : public NoCopy
  {
  public:
    static MenuStyle *get(Application &app, unsigned int screen);

    void load(const Resource &resource);

    // fixed metrics
    unsigned int separatorHeight(void) const;
    unsigned int titleMargin(void) const;
    unsigned int frameMargin(void) const;
    unsigned int itemMargin(void) const;

    // textures
    inline const Texture &titleTexture(void) const
    { return title.texture; }
    inline const Texture &frameTexture(void) const
    { return frame.texture; }
    inline const Texture &activeTexture(void) const
    { return active.texture; }

    // colors
    inline const bt::Color &titleForegroundColor(void) const
    { return title.foreground; }
    inline const bt::Color &titleTextColor(void) const
    { return title.text; }
    inline const bt::Color &frameForegroundColor(void) const
    { return frame.foreground; }
    inline const bt::Color &frameTextColor(void) const
    { return frame.text; }

    // fonts
    inline const Font &titleFont(void) const
    { return title.font; }
    inline const Font &frameFont(void) const
    { return frame.font; }

    // size calculations
    Rect titleRect(const ustring &text) const;
    Rect itemRect(const MenuItem &item) const;

    // drawing
    void drawTitle(Window window, const Rect &rect,
                   const ustring &text) const;
    void drawItem(Window window, const Rect &rect,
                  const MenuItem &item, Pixmap activePixmap) const;

  private:
    MenuStyle(Application &app, unsigned int screen);

    Application &_app;
    unsigned int _screen;
    struct _title {
      Texture texture;
      Color foreground;
      Color text;
      Font font;
      Alignment alignment;
    } title;
    struct _frame {
      Texture texture;
      Color foreground;
      Color text;
      Color disabled;
      Font font;
      Alignment alignment;
    } frame;
    struct _active {
      Texture texture;
      Color foreground;
      Color text;
      // font and alignment used from frame above
    } active;
    unsigned int title_margin, frame_margin, item_indent;

    static MenuStyle **styles;
  };


  class Menu : public EventHandler, public NoCopy
  {
  public:
    Menu(Application &app, unsigned int screen);
    virtual ~Menu(void);

    inline Window windowID(void) const
    { return _window; }

    unsigned int insertItem(const MenuItem &item,
                            unsigned int id = ~0u,
                            unsigned int index = ~0u);

    inline unsigned int insertItem(const ustring &label,
                                   unsigned int id = ~0u,
                                   unsigned int index = ~0u)
    { return insertItem(MenuItem(MenuItem::Normal, label), id, index); }

    inline unsigned int insertItem(const ustring &label,
                                   Menu *submenu,
                                   unsigned int id = ~0u,
                                   unsigned int index = ~0u)
    { return insertItem(MenuItem(submenu, label), id, index); }

    inline void insertSeparator(unsigned int index = ~0u)
    { (void) insertItem(MenuItem(MenuItem::Separator), ~0u, index); }


    void changeItem(unsigned int id,
                    const ustring &newlabel,
                    unsigned int newid = ~0u);

    void setItemEnabled(unsigned int id, bool enabled);
    bool isItemEnabled(unsigned int id) const;

    void setItemChecked(unsigned int id, bool checked);
    bool isItemChecked(unsigned int id) const;

    void removeItem(unsigned int id);
    void removeIndex(unsigned int index);
    void clear(void);

    inline unsigned int count(void) const
    { return _items.size(); }

    inline const ustring &title(void) const
    { return _title; }
    inline void setTitle(const ustring &newtitle)
    { _title = newtitle; }
    void showTitle(void);
    void hideTitle(void);

    inline bool isVisible(void) const
    { return _visible; }

    void popup(int x, int y,
               bool centered = true);
    virtual void popup(int x, int y,
                       const Rect &constraint,
                       bool centered = true);
    void move(int x, int y);
    virtual void show(void);
    virtual void hide(void);

    virtual void refresh(void);
    virtual void reconfigure(void);

    inline bool autoDelete(void) const
    { return _auto_delete; }
    inline void setAutoDelete(bool ad)
    { _auto_delete = ad; }

  protected:
    virtual void buttonPressEvent(const XButtonEvent * const event);
    virtual void buttonReleaseEvent(const XButtonEvent * const event);
    virtual void motionNotifyEvent(const XMotionEvent * const event);
    virtual void leaveNotifyEvent(const XCrossingEvent * const /*unused*/);
    virtual void exposeEvent(const XExposeEvent * const event);
    virtual void keyPressEvent(const XKeyEvent * const event);

    virtual void titleClicked(unsigned int button);
    virtual void itemClicked(unsigned int id, unsigned int button);

    virtual void hideAll(void);

    virtual void tearOff(void);

    Rect geometry(void) const;

  private:
    void updateSize(void);
    void updatePixmaps(void);

    typedef std::list<MenuItem> ItemList;

    unsigned int verifyId(unsigned int id = ~0u);
    void activateItem(const Rect &rect, MenuItem &item);
    void deactivateItem(const Rect &rect, MenuItem &item,
                        bool hide_submenu = true);
    void activateIndex(unsigned int index);
    void showActiveSubmenu(void);

    ItemList::iterator findItem(unsigned int id, Rect& r);

    void activateSubmenu(void);
    void positionRect(Rect& r, int &row, int &col);
    void invalidateSize(void);

    void removeItemByIterator(ItemList::iterator& it);

    Application &_app;
    unsigned int _screen;

    Window _window;
    Pixmap _tpixmap, _fpixmap, _apixmap;

    Rect _rect;  // entire menu
    Rect _trect; // title
    Rect _frect; // frame
    Rect _irect; // items inside the frame

    Timer _timer;
    ustring _title;

    ItemList _items;
    std::vector<bool> _id_bits;

    Menu *_parent_menu;
    Menu *_current_submenu;
    Menu *_active_submenu;
    unsigned int _motion;
    unsigned int _itemw;
    unsigned int _active_index;
    bool _auto_delete;
    bool _pressed;
    bool _title_pressed;
    bool _size_dirty;
    bool _show_title;
    bool _visible;
    bool _tornoff;
  };

} // namespace bt

#endif // __Menu_hh