Jump to content

wpFilterMenu

From EDM2

This method is specific to Version 4, or higher, of the OS/2 operating system.

This instance method filters out options from the object's pop-up menu that do not apply.

Syntax

_wpFilterMenu(somSelf, pFlags, hwndCnr, fMultiSelect, ulMenuType, ulView, ulReserved)

Parameters

somSelf (WPObject *) - input
Pointer to the object on which the method is being invoked.
Points to an object of class WPObject.
pFlags (FILTERFLAGS *) - in/out
Pop-up menu flags. If the flag is set, the corresponding pop-up menu item is available. These flags are OR'ed together, with the flags already defined by ancestor classes, to specify the standard pop-up menu items that apply to this object.
CTXT_ARRANGE Open arrange
CTXT_CLOSE Close
CTXT_COPY Copy
CTXT_DELETE Delete
CTXT_DETAILS Open details view
CTXT_FIND Open find
CTXT_HELP Help
CTXT_ICON Open icon view
CTXT_LINK Create shadow
CTXT_LOCKUP Open lockup
CTXT_MOVE Move
CTXT_NEW Create another
CTXT_OPEN Open
CTXT_PALETTE Open palette
CTXT_PRINT Print
CTXT_PROGRAM Open program
CTXT_REFRESH Refresh
CTXT_SELECT Open select
CTXT_SHUTDOWN Open shutdown
CTXT_SORT Open sort
CTXT_SETTINGS Open settings
CTXT_SWITCHTO Switch to
CTXT_TREE Open tree view
CTXT_WINDOW Window
hwndCnr (HWND) - input
Handle to container control window.
NULLHANDLE: A pop-up request is made on the 'whitespace' of an open view.
Other: The handle of the container requesting the pop-up menu.
fMultiSelect (BOOL) - input
Multiple menu items flag.
ulMenuType (ULONG) - input
The type of menu that is being built. May be one of the following values:
MENU_OBJECTPOPUP Pop-up menu for the object icon.
MENU_OPENVIEWPOPUP Pop-up menu for an open view.
MENU_FOLDERPULLDOWN Pull-down menu for a folder.
MENU_EDITPULLDOWN Pull-down menu for the Edit menu option.
MENU_VIEWPULLDOWN Pull-down menu for the View menu option.
MENU_SELECTEDPULLDOWN Pull-down menu for the Selected menu option.
MENU_HELPPULLDOWN Pull-down menu for the Help menu option.
ulView (ULONG) - input
The view that the menu is being invoked on.
OPEN_CONTENTS Open contents view.
OPEN_TREE Open tree view.
OPEN_DETAILS Open details view.
CLOSED_ICON Closed icon view.
ulReserved (ULONG) - input
Reserved. Set to 0.

Returns

rc (BOOL) - returns
New pop-up menu flags for this object.

Remarks

The wpFilterMenu method is a superset of the OS/2 Warp Version 3 wpFilterPopupMenu method. All new or modified object classes that formerly overrode the wpFilterPopupMenu method should override the wpFilterMenu method instead. This gives you more control over what menu items are filtered from the pop-up menu as well as the folder pull-down menus.

Usage

This method is generally called only by the system when a request is made to display the object's pop-up window or pull-down menu.

How to Override

This method should be overridden to remove undesired pop-up or pull-down menu actions that were added by ancestor classes. The parent method should be called prior to any override processing.

Example Code

In this example, the Tree view option is removed from the Open popup menu and the Delete option is added.

SOM_Scope BOOL SOMLINK TextFolderwps_wpFilterMenu(TextFolder *somSelf,
                         PFILTERFLAGS pFlags,
                         HWND hwndCnr,
                         BOOL32 fMultiSelect,
                         ULONG ulMenuType,
                         ULONG ulView,
                         ULONG ulReserved)

 {
    BOOL      bParentResult;

    /* TextFolderData *somThis = TextFolderGetData(somSelf); */
    TextFolderMethodDebug("TextFolder","TextFolderwps_wpFilterMenu");

    bParentResult = parent_wpFilterMenu(somSelf,
                                          pFlags,
                                          hwndCnr,
                                          fMultiSelect,
                                          ulMenuType,
                                          ulView,
                                          ulReserved);

    if (ulMenuType == MENU_OPENVIEWPOPUP)
    {

      /* This is a pop-up menu - remove the Tree view menu option and
       * make sure the Delete option is available
       */
      pFlags->Flags[0] |= CTXT_DELETE;
      pFlags->Flags[0] &= ~CTXT_TREE;
    }

    return bParentResult;
 }

Related Methods