This file is indexed.

/usr/include/GNUstep/AppKit/NSMenuView.h is in libgnustep-gui-dev 0.22.0-1ubuntu2.

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
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
/* 
   NSMenuView.h

   Copyright (C) 1996 Free Software Foundation, Inc.

   Author:  Michael Hanni <mhanni@sprintmail.com>
   Date: June 1999
   
   This file is part of the GNUstep GUI Library.

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.

   This library 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
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with this library; see the file COPYING.LIB.
   If not, see <http://www.gnu.org/licenses/> or write to the 
   Free Software Foundation, 51 Franklin Street, Fifth Floor, 
   Boston, MA 02110-1301, USA.
*/ 

#ifndef _GNUstep_H_NSMenuView
#define _GNUstep_H_NSMenuView
#import <GNUstepBase/GSVersionMacros.h>

#import <AppKit/NSMenu.h>
#import <AppKit/NSMenuItem.h>
//#import <AppKit/NSMenuItemCell.h>
#import <AppKit/NSView.h>

@class NSArray;
@class NSMutableArray;
@class NSNotification;
@class NSString;
@class NSColor;
@class NSMenuItemCell;
@class NSPopUpButton;
@class NSEvent;
@class NSFont;
@class NSScreen;
@class NSWindow;


/**
   The NSMenu class uses an object implementing the NSMenuView protocol to
   do the actual drawing.<br/><br/>

   Normally there is no good reason to write your own class implementing
   this protocol.  However if you want to customize your menus you should
   implement this protocol to ensure that it works nicely together
   with sub/super menus not using your custom menu representation.

   <br/><br/>
   <strong>How menus are drawn</strong>
   <br/><br/>

   This class implements several menu look and feels at the same time.
   The looks and feels implemented are:
   <list>
   <item>
   Ordinary vertically stacked menus with the NeXT submenu positioning 
   behavour.
   </item>
   <item>
   Vertically stacked menus with the WindowMaker submenu placement. This
   behaviour is selected by choosing the 
   <strong>GSWindowMakerInterfaceStyle</strong>.
   </item>
   <item>
   PopupButtons are actually menus. This class implements also the 
   behaviour for the NSPopButtons. See for the the class NSPopButton.
   </item>
   </list>
*/
@interface NSMenuView : NSView <NSCoding, NSMenuView>
{
  NSMutableArray *_itemCells;
  BOOL           _horizontal;
  char		 _pad1[3];
  NSFont         *_font;
  int            _highlightedItemIndex;
  float          _horizontalEdgePad;
  float          _stateImageOffset;
  float          _stateImageWidth;
  float          _imageAndTitleOffset;
  float          _imageAndTitleWidth;
  float          _keyEqOffset;
  float          _keyEqWidth;
  BOOL           _needsSizing;
  char		 _pad2[3];
  NSSize         _cellSize;

@private
  id             _items_link;
  int            _leftBorderOffset;
  id             _titleView;

  /*
  Private and not named '_menu' to avoid confusion and further problems
  with NSResponder's menu.
  */
  NSMenu        *_attachedMenu;
}

/***********************************************************************
 * Initializing a menu view
 ***********************************************************************/
/**
   Creates new instance and sets menu to torn off state with 
   NSMenu's setTornOff:.
 */
- (id) initAsTearOff;

/***********************************************************************
 * Getting and setting menu view attributes
 ***********************************************************************/
/**
   Returns the height of the menu bar.
 */
+ (float) menuBarHeight;

/**
   Sets the menu to be displayed in to menu. Also this method adds this 
   menu view to the menu's list of observers, mark view to force 
   recalculation of layout with setNeedsSizing:YES, and updates itself 
   with update method.
 */
- (void) setMenu: (NSMenu *)menu;

/**
   Returns the NSMenu associated with this menu view.
 */
- (NSMenu *) menu;

/**
   Sets menu orientation. If YES menu items are displayed from left
   to right, if NO from top to bottom (vertically). By default, menu 
   items are displayed vertically.
 */
- (void) setHorizontal: (BOOL)flag;

/**
   Returns YES if menu items are displayed horizontally, NO if 
   vertically.
 */
- (BOOL) isHorizontal;

/**
   Sets the default font to use when drawing the menu text.
 */
- (void) setFont: (NSFont *)font;

/**
   Returns the default font used to draw the menu text.
 */
- (NSFont *) font;

/**
   Highlights item with at index. If index is -1 all highlighing is removed.
 */
- (void) setHighlightedItemIndex: (int)index;

/**
   Returns the index of the highlighted item. Returns -1 if there is no
   highlighted item.
 */
- (int) highlightedItemIndex;

/**
   Replaces item cell at index with cell. Highlighting of item is preserved.
 */
- (void) setMenuItemCell: (NSMenuItemCell *)cell
          forItemAtIndex: (int)index;

/**
   Returns cell associated with item at index.
 */
- (NSMenuItemCell *) menuItemCellForItemAtIndex: (int)index;

/**
   Returns menu view associated with visible attached submenu.
 */
- (NSMenuView *) attachedMenuView;

/**
   Returns visible attached submenu.
 */
- (NSMenu *) attachedMenu;

/**
   Returns YES, if this object is an visivle attached submenu's view. 
   Returns NO otherwise.
 */
- (BOOL) isAttached;

/**
   Returns YES, if this object is associated with torn off menu 
   (menu with a close button on title bar).
 */
- (BOOL) isTornOff;

/**
   Returns horizontal space used for padding between menu item elements 
   (state image, title image, title, key equivalent, submenu arrow image).
 */
- (float) horizontalEdgePadding;

/**
   Sets amount of pixels added between menu item elements to pad.
 */
- (void) setHorizontalEdgePadding: (float)pad;

/***********************************************************************
 * Notification methods
 ***********************************************************************/
/**
   Marks menu item cell associated with the menu item and menu view as 
   needing to be resized. This method is invoked when 
   NSMenuDidChangeItemNotification received. The notification parameter 
   contains index of changed menu item and can be accessed with 
   NSMenuItemIndex key.
 */
- (void) itemChanged: (NSNotification *)notification;

/**
   Creates new item cell for the newly created menu item, marks cell and
   menu view as needing to be resized. This method is invoked when 
   NSMenuDidAddItemNotification received. The notification parameter 
   contains index of changed menu item and can be accessed with 
   NSMenuItemIndex key.
   
 */
- (void) itemAdded: (NSNotification *)notification;

/**
   Removes cell associated with removed menu item, removes highlighting 
   if removed menu item was highlighted, marks cell and menu view as 
   needing to be resized. This method is invoked when 
   NSMenuDidRemoveItemNotification received. The notification parameter 
   contains index of changed menu item and can be accessed with 
   NSMenuItemIndex key.
   
 */
- (void) itemRemoved: (NSNotification *)notification;

/***********************************************************************
 * Working with submenus
 ***********************************************************************/
/**
 * Detaches currently visible submenu window from main menu.
 */
- (void) detachSubmenu;

/**
   Attach submenu if the item at index is a submenu. It will figure out 
   if the new submenu should be transient or not.
*/
- (void) attachSubmenuForItemAtIndex: (int)index;

/***********************************************************************
 * Calculating menu geometry
 ***********************************************************************/
/**
   Adds title view for application menu and submenus, removes title view
   if menu is owned by NSPopUpButton, adds close button to title view for
   torn off menus and removes it for other type of menu. 
 */
- (void) update;

/**
   Sets the flag whether layout needs to be resized. Set it to YES if 
   menu contents changed and layout needs to be recalculated. This method
   is used internally. Yout should not invoke it directly from applications.
 */
- (void) setNeedsSizing: (BOOL)flag;

/**
   Return YES if menu view contents changed and needs to be resized.
 */
- (BOOL) needsSizing;

/**
   
 */
- (void) sizeToFit;

/**
   Returns the starting horizontal position for drawing the state image.
 */
- (float) stateImageOffset;

/**
   Returns the width of the state image.
 */
- (float) stateImageWidth;

/**
   Returns the starting horizontal position for drawing the image and title.
 */
- (float) imageAndTitleOffset;

/**
   Returns the width of the image and title section. Tis section contains 
   image and text of menu item.
 */
- (float) imageAndTitleWidth;

/**
   Returns the starting position for drawing the key equivalent. Key 
   equivalent can be submenu arrow if menu item has submenu.
 */
- (float) keyEquivalentOffset;

/**
   Returns the width of key equivalent text. Key equivalent can be submenu 
   arrow if menu item has submenu
 */
- (float) keyEquivalentWidth;

/**
   Returns bounds rectangle of the menu view. It is smaller by 1 pixel 
   in width than menu window (dark gray border at left).
 */
- (NSRect) innerRect;              

/**
   Returns frame rectangle of menu item cell. It is smaller by 1 pixel 
   in width than menu window (dark gray border).
 */
- (NSRect) rectOfItemAtIndex: (int)index;

/**
   Returns the index of the item below point. Returns -1 if mouse is 
   not above a menu item.
*/
- (int) indexOfItemAtPoint: (NSPoint)point;

/**
   Calls setNeedsDisplayInRect: for rectangle occupied by item at index.
 */
- (void) setNeedsDisplayForItemAtIndex: (int)index;

/**
   Returns the correct frame origin for aSubmenu based on the location
   of the receiver. This location may depend on the current NSInterfaceStyle.
*/
- (NSPoint) locationForSubmenu:(NSMenu *) aSubmenu;

/**
   Resize menu view frame to be appropriate in size to attach to screenRect 
   at preferredEdge. For popup's menu, if selectedItemIndex is other than 
   -1, position view so selected item covers the NSPopUpButton.
   
   <br/><strong>NOTE: preffered edge positioning doesn't implemented 
   yet!</strong>
 */
- (void) setWindowFrameForAttachingToRect: (NSRect)screenRect
                                 onScreen: (NSScreen *)screen
                            preferredEdge: (NSRectEdge)edge
                        popUpSelectedItem: (int)selectedItemIndex;

/***********************************************************************
 * Event handling
 ***********************************************************************/
- (void) performActionWithHighlightingForItemAtIndex: (int)index;

/**
   This method is responsible for tracking the mouse while this menu
   is on the screen and the user is busy navigating the menu or one
   of it submenus.  Responsible does not mean that this method does it
   all.  For submenus for example it will call, indirectly, itself for
   submenu under consideration.

   It will return YES if user released mouse, not above a submenu item.
   NO in all other circumstances.

   Implementation detail:

   <list>
   <item> It use periodic events to update the highlight state and 
	   attach / detach submenus.
   </item>
   <item> The flag justAttachedNewSubmenu is set to YES when a new 
          submenu is attached. The effect is that the 
          highlighting / attaching / detaching is supressed
          for this menu.  This is done so the user is given
          a change to move the mouse pointer into the newly
          attached submenu.  Otherwise it would immediately
          be removed as the mouse pointer move over another
          item.

          The logic for resetting the flag is rather adhoc.
   </item>

   <item> the flag subMenusNeedRemoving means that we
          will remove all the submenus after we are done.

          This flag is used to clean up the submenus
          when the user has opened a submenu by clicking
          and wants to close it again by clicking on the
          hihglighted item.
   </item>  
   <item> When the user released the mouse this method
          will cleanup all the transient menus.

          Not only its own, but also its attached menu
          and all its transient super menus.
   </item>
   <item> The clean up is done BEFORE the action is executed.
          This is needed otherwise `hiding' the application
          leaves a dangling menu.   If this is not acceptable,
          there should be another mechanism of handling
          the hiding.  BTW besides the `hiding' the application,
          model panels are also a problem when the menu
          is not cleared before executing the action.
    </item>
    </list>
*/
- (BOOL) trackWithEvent: (NSEvent *)event;

@end

#endif