oilmenus.h File Reference

(r1785/r751)

#include "menuitem.h"

Go to the source code of this file.

Classes

class  wxCamMenuBar

Functions

BOOL InitMenuSystem ()
 Creates both the platform-independent and windows specific menu systems.
void DeinitMenuSystem ()
 Destroys both the platform-independent and windows specific menu systems.
BOOL DestroyCamMenu (MenuItem *CamMenu)
 Destroys all dynamic objects in the menu system, freeing up memory.
BOOL DestroyWinMenu (wxMenu *WinMenu)
 Destroys all dynamic objects in the menu system, freeing up memory.
BOOL IsMenuCommand (wxCommandEvent &event)
 To identify menu item commands.
BOOL PerformMenuCommand (wxCommandEvent &event)
 To perform menu item command.
BOOL UpdateMenu (wxMenu *)
 To update menu.
MenuItem * SetupDefaultMenu ()
 Creates the default mainframe menu for an MDI type interface.
MenuItem * SetupSharedMenu ()
 Creates a MDI type shared menu.
wxCamMenuBar * ConvertToWinMenu (MenuItem *CamMenu)
 Converts from a platform-independent menu system into a Windows specific one.
wxMenu * CreatePopup (MenuItem *CamSubMenu)
 Converts from a platform-independent menu into a Windows specific one.
MenuItem * GetMenuItem (UINT32 menuId, BOOL *pShowHotKeysFlag=NULL)
 To find a menu item in one of the platform independent menu systems.
BOOL FindMenu (MenuItem **TargetMenu, wxMenu *pMenu, BOOL *pShowHotKeysFlag=NULL)
 To find kernel menu equivalent to Windows menu that is passed in. Scope: Private to be called by UpdateMenu() only!
BOOL CreateContextMenu (MenuItem *pContextMenu)
 To put a popup menu on screen.
BOOL DestroyContextMenu ()
 To remove a popup menu from the screen.
MenuItem * GetCurrentContextMenu ()
 Find out whether the popup menu is open or not and what it is...
MenuItem * GetMainMDIMenu ()
 To find the menu item associated with the main kernelly MDI menu.
BOOL UpdatePlugInsWinMenu (MenuItem *pPlugInsMenu)
 This searches for the equivalent Win menu in the main MDI menu structure, destroys anything that is there already and then puts in the new structure.
BOOL DestroyWinMenuMFC (wxMenu *pWinMenu)
 Destroys all dynamic objects in the menu system, freeing up memory.

Variables

wxCamMenuBar * WinDefMenu
wxCamMenuBar * WinMDIMenu
wxMenu * WinContextMenu
const UINT32 AUTO_MENU_ID_MIN = 1000
const UINT32 AUTO_MENU_ID_MAX = 2000


Function Documentation

wxCamMenuBar* ConvertToWinMenu (  MenuItem *  GroupSubMenu  ) 
 

Converts from a platform-independent menu system into a Windows specific one.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/6/93
Parameters:
MenuItem - A platform-independent menu. [INPUTS]
None. [OUTPUTS]
Returns:
wxMenu - Windows MFC-type menu object.

Errors: None

See also:
OilMenus

MenuItem

CreatePopup()

Definition at line 212 of file oilmenus.cpp.

00213 {                  
00214     wxCamMenuBar*   WinMenu = new wxCamMenuBar;         // Top Level Menu - Menu Bar
00215     MenuItem*       SubMenu;                            // Sub Menu Iterator
00216                                 
00217     SubMenu = GroupSubMenu->GetFirstMenuItem();                           
00218     
00219     while (SubMenu != NULL)                         // Assumes that all MenuItems on the 
00220     {                                               // MenuBar are Group MenuItems
00221         wxMenu*     pSubMenu = CreatePopup( SubMenu );
00222         if (pSubMenu)
00223         {
00224             wxString sName((TCHAR*)SubMenu->GetMenuText());
00225             if (!WinMenu->Append( pSubMenu, sName ))
00226             {
00227                 TRACEUSER("luke", _T("Append failed\n"));
00228             }
00229         }
00230         SubMenu = GroupSubMenu->GetNextMenuItem(SubMenu);
00231     } 
00232 
00233     return WinMenu;
00234 }

BOOL CreateContextMenu (  MenuItem *  pContextMenu  ) 
 

To put a popup menu on screen.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/03/95
Parameters:
pContextMenu Pointer to a context-sensitive menu [INPUTS]
- [OUTPUTS]
Returns:
TRUE if menu was created and opened on screen succesfully. FALSE otherwise

Errors: None.

Definition at line 1181 of file oilmenus.cpp.

01182 {
01183     BOOL worked = FALSE;
01184 
01185     // If the previous context menu is hanging around for some reason
01186     // get rid of it.
01187     DestroyContextMenu();
01188 
01189     // Now setup the new context menu
01190     CamelotContextMenu = pContextMenu;
01191     WinContextMenu = CreatePopup(CamelotContextMenu);
01192 
01193     if (WinContextMenu==NULL)
01194         worked = FALSE;
01195     else
01196     {
01197         // Set the menu states correctly
01198 //      CamelotContextMenu->UpdateMenuState(FALSE);
01199 //      UpdateWinMenu(WinContextMenu, CamelotContextMenu);
01200 
01201         if( CCamFrame::GetMainFrame()->PopupMenu( WinContextMenu ) )
01202             worked = TRUE;
01203         else
01204         {
01205             DestroyCamMenu(CamelotContextMenu);
01206             delete CamelotContextMenu; 
01207             CamelotContextMenu = NULL;
01208         }
01209     }
01210 
01211     return worked;
01212 }

wxMenu* CreatePopup (  MenuItem *  pCamSubMenu  ) 
 

Converts from a platform-independent menu into a Windows specific one.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/6/93
Parameters:
MenuItem - A platform-independent menu (popup). [INPUTS]
None. [OUTPUTS]
Returns:
wxMenu - Windows MFC-type menu object.

Errors: None Scope: Private - can only be called from within the OilMenus module

See also:
OilMenus

MenuItem

Definition at line 259 of file oilmenus.cpp.

00260 {                  
00261     ERROR2IF(pCamSubMenu == 0, 0, "CreatePopup: null pCamSubMenu supplied");
00262 
00263     wxMenu*         pPopupMenu = new wxMenu( /*wxString( pCamSubMenu->GetMenuText() )*/ );  // Popup Menus in Windows
00264 
00265     ERROR2IF(pPopupMenu == 0, 0, "CreatePopup failed to allocate new menu");
00266     
00267     MenuItem* pSubMenu = pCamSubMenu->GetFirstMenuItem();                      
00268 
00269     // if menu popup hasn't got any sub menu items then setup a dummy menuitem to allow 
00270     // the OnMenuPopupInit() function to work when menu is selected!
00271     
00272     if (pSubMenu == 0)
00273     {
00274         if (!pPopupMenu->Append( pCamSubMenu->GetMenuId(),      // Use the Group Menu Id
00275                                TEXT("")))                   // Give it an empty string
00276         {
00277             TRACEUSER("luke", _T("Append failed\n"));
00278         }
00279     }
00280     
00281     while (pSubMenu != 0)
00282     {
00283         bool    fIsUnimpl = *pSubMenu->GetOpToken() == OPTOKEN_DO_NOTHING;
00284         bool    fNeedSep  = pSubMenu->IsFollowedBySeparator() && 
00285                             ( 0 != pCamSubMenu->GetNextMenuItem( pSubMenu ) );
00286 
00287         if (pSubMenu->IsMenuItemGroup())                    // Distinguish between group &
00288         {                                                   // single MenuItems
00289             wxMenu* pNewMenu = CreatePopup( pSubMenu );
00290             if (pNewMenu)
00291             {
00292 #if !defined(_DEBUG)
00293                 if( !fIsUnimpl )
00294                 {
00295 #endif
00296                     wxString sName((TCHAR *)pSubMenu->GetMenuText());
00297                     if (!pPopupMenu->Append( pSubMenu->GetMenuId(), sName, pNewMenu ))
00298                     {
00299                         TRACEUSER("luke", _T("Append failed\n"));
00300                     }
00301                 }
00302 #if !defined(_DEBUG)
00303             }
00304 #endif
00305         }
00306         else
00307         {
00308             wxItemKind  ItemKind = wxITEM_NORMAL;
00309             if( pSubMenu->IsCheckable() )
00310                 ItemKind = wxITEM_CHECK;
00311 
00312 #if !defined(_DEBUG)
00313             if( !fIsUnimpl )
00314             {
00315 #endif
00316                 // Set the leaf's label ... 
00317                 if (!pPopupMenu->Append( pSubMenu->GetMenuId(), 
00318                     wxString( (TCHAR*)pSubMenu->GetMenuText() ), wxEmptyString, ItemKind ))
00319                 {
00320                     TRACEUSER("luke", _T("Append failed\n"));
00321                 }
00322 #if !defined(_DEBUG)
00323             }
00324             else
00325                 fNeedSep = false;
00326 #else
00327             if( fIsUnimpl )
00328                 pPopupMenu->Enable( pSubMenu->GetMenuId(), false );
00329 #endif
00330             
00331 /*
00332             // ... and glyph, if any.
00333             UINT32 nSelBmpID = pSubMenu->GetMenuSelectedBitmapID();
00334             UINT32 nUnselBmpID = pSubMenu->GetMenuUnselectedBitmapID();
00335             if (nSelBmpID != 0 && nUnselBmpID != 0)
00336                 pPopupMenu->SetMenuItemBitmaps(pSubMenu->GetMenuId(), 0,
00337                                                &CBitmap(nSelBmpID),
00338                                                &CBitmap(nUnselBmpID));
00339 */      }
00340 
00341         // Add a separating line if required, BUT...
00342         // Don't allow a separator to be added if this is the last item in the menu...
00343         if( fNeedSep )
00344         {
00345             if (!pPopupMenu->AppendSeparator())
00346             {
00347                 TRACEUSER("luke", _T("AppendSeparator failed\n"));
00348             }
00349         }
00350         
00351         pSubMenu = pCamSubMenu->GetNextMenuItem(pSubMenu);
00352     }
00353     
00354     return pPopupMenu;
00355 }

void DeinitMenuSystem (   ) 
 

Destroys both the platform-independent and windows specific menu systems.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/6/93
Parameters:
None. [INPUTS]
None. [OUTPUTS]
Returns:
Nothing.

Errors: None.

See also:
OilMenus

MenuItem

DestroyCamMenu()

DestroyWinMenu()

InitMenuSystem()

Definition at line 687 of file oilmenus.cpp.

00688 {
00689     if (CamelotDefMenu)
00690     {
00691         DestroyCamMenu(CamelotDefMenu);     //Destroy Platform-Independent
00692         delete CamelotDefMenu;
00693         CamelotDefMenu = NULL;
00694     }
00695 
00696     if (CamelotMDIMenu)
00697     {
00698         DestroyCamMenu(CamelotMDIMenu);     //Menu System
00699         delete CamelotMDIMenu; 
00700         CamelotMDIMenu = NULL;
00701     }
00702 
00703 PORTNOTE("other","Removed menu destruction - temporary!")
00704 #if 0
00705     if (WinMDIMenu)
00706     {
00707         DestroyWinMenu(WinMDIMenu);         //Destroy The MDI Frame Menu
00708 
00709         WinMDIMenu->Detach();
00710         delete WinMDIMenu;
00711         WinMDIMenu = NULL;
00712     }
00713 #endif
00714     //----------------------------------------------------------
00715     // If the context-sensitive menu is left around delete it...
00716 /*  if (CamelotContextMenu)
00717     {
00718         DestroyCamMenu(CamelotContextMenu);     //Menu System
00719         delete CamelotContextMenu; 
00720         CamelotContextMenu = NULL;
00721     }
00722 
00723 
00724     if (WinContextMenu)
00725     {
00726         DestroyWinMenu(WinContextMenu);         //Destroy The MDI Frame Menu
00727 //      WinContextMenu->Detach();
00728         WinContextMenu->DestroyMenu();          // DestroyMenu releases Windows resources and calls Detach
00729         delete WinContextMenu;
00730         WinContextMenu = NULL;
00731     }
00732 */
00733     ContextMenu::HideCurrent();
00734 
00735 }

BOOL DestroyCamMenu (  MenuItem *  CamMenu  ) 
 

Destroys all dynamic objects in the menu system, freeing up memory.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/6/93
Parameters:
MenuItem - A platform-independent menu. [INPUTS]
None. [OUTPUTS]
Returns:
True - If all objects in menu system were destroyed successfully

Errors: None Scope: Private - can only be called from within the OilMenus module

See also:
OilMenus

MenuItem

DestroyWinMenu()

DeInitMenuSystem()

Definition at line 382 of file oilmenus.cpp.

00383 {               
00384     MenuItem *subMenu;
00385     MenuItem *tempMenu;
00386     
00387     subMenu = CamMenu->GetFirstMenuItem();
00388 
00389     while (subMenu != NULL)
00390     {
00391         // if MenuItem is a group then delete all MenuItems within it
00392         if (subMenu->IsMenuItemGroup())
00393             DestroyCamMenu(subMenu);
00394                            
00395         // Get Next MenuItem before the current is deleted                   
00396         tempMenu = CamMenu->GetNextMenuItem(subMenu);
00397  
00398         // Object pointed to by subMenu is deleted and memory is freed.
00399         delete CamMenu->RemoveMenuItem(subMenu);
00400         
00401         // Submenu now points to next item
00402         subMenu = tempMenu;
00403     }
00404     return TRUE;
00405 }

BOOL DestroyContextMenu (   ) 
 

To remove a popup menu from the screen.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/03/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if menu was destroyed succesfully. FALSE otherwise

Errors: None.

Definition at line 1232 of file oilmenus.cpp.

01233 {
01234     // If the previous context menu is hanging around for some reason
01235     // get rid of it.
01236     if (WinContextMenu)
01237     {
01238         DestroyWinMenu(WinContextMenu);
01239 //      WinContextMenu->Detach();
01240 //      WinContextMenu->Destroy();      // DestroyMenu releases Windows resources and calls Detach
01241         delete WinContextMenu;
01242         WinContextMenu = NULL;
01243     }
01244 
01245     if (CamelotContextMenu)
01246     {
01247         DestroyCamMenu(CamelotContextMenu);
01248         delete CamelotContextMenu; 
01249         CamelotContextMenu = NULL;
01250     }
01251 
01252     return TRUE;
01253 }

BOOL DestroyWinMenu (  wxMenu *  WinMenu  ) 
 

Destroys all dynamic objects in the menu system, freeing up memory.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/6/93
Parameters:
wxMenu - Windows menu object. [INPUTS]
None. [OUTPUTS]
Returns:
True - If all objects in menu system were destroyed successfully

Errors: Does not work with nested, hierarchical menus yet! Scope: Private - can only be called from within the OilMenus module

See also:
OilMenus

MenuItem

DestroyCamMenu()

DeInitMenuSystem()

Definition at line 436 of file oilmenus.cpp.

00437 {               
00438 PORTNOTE("other","Removed menu destruction - temporary!")
00439 #if 0
00440     wxMenu  *subMenu;
00441     INT32       position = 0;
00442     INT32       noItems = WinMenu->GetMenuItemCount();  
00443     
00444     while ((noItems > 0)  && (position < noItems))  
00445     {                                               
00446         subMenu = WinMenu->GetSubMenu(position);    
00447         if (subMenu != NULL)                        
00448         {
00449             DestroyWinSubMenu(subMenu);
00450             subMenu->Detach();
00451             delete subMenu;
00452         }
00453         position++;
00454     }
00455 #endif
00456     return TRUE;
00457 }

BOOL DestroyWinMenuMFC (  wxMenu *  pWinMenu  ) 
 

Destroys all dynamic objects in the menu system, freeing up memory.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/3/97
Parameters:
wxMenu - Windows menu object. [INPUTS]
None. [OUTPUTS]
Returns:
True - If all objects in menu system were destroyed successfully

Errors: Does not work with nested, hierarchical menus yet! Scope: Private - can only be called from within the OilMenus module

See also:
OilMenus

MenuItem

DestroyCamMenu()

DeInitMenuSystem()

Definition at line 540 of file oilmenus.cpp.

00541 {               
00542 PORTNOTE("other","Removed menu destruction - temporary!")
00543 #if 0
00544     ERROR2IF(pWinMenu == NULL, FALSE,"DestroyWinMenuMFC bad pWinMenu supplied");
00545     wxMenu  *pSubMenu = NULL;
00546     INT32       noItems = pWinMenu->GetMenuItemCount();  
00547     
00548     // Walk backwards through the list removing items from the end, otherwise
00549     // we would need to recalculate the position after each menu deletion as the
00550     // position will have changed.
00551     BOOL ok = TRUE;
00552     INT32   position = noItems - 1;
00553     while (position >= 0)
00554     {                                               
00555         pSubMenu = pWinMenu->GetSubMenu(position);    
00556         if (pSubMenu != NULL)                        
00557             ok = DestroyWinSubMenuMFC(pSubMenu);
00558         // now delete the menu item
00559         ok = pWinMenu->DeleteMenu( position, MF_BYPOSITION );
00560         if (pSubMenu != NULL)                        
00561         {
00562             pSubMenu->Detach();
00563             delete pSubMenu;
00564         }
00565 
00566         position--;
00567     }
00568 #endif
00569     return TRUE;
00570 }

BOOL FindMenu (  MenuItem **  TargetMenu,
wxMenu *  pMenu,
BOOL *  pShowHotKeysFlag
) 
 

To find kernel menu equivalent to Windows menu that is passed in. Scope: Private to be called by UpdateMenu() only!

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/9/93
Parameters:
A pointer to a Windows wxMenu [INPUTS]
A pointer to a Camelot MenuItem. [OUTPUTS]
Returns:
TRUE if found successfully FALSE otherwise

Errors: None.

See also:
CMainFrame

wxMenu

MenuItem

Definition at line 916 of file oilmenus.cpp.

00917 {
00918     UINT32  TargetMenuId = (UINT32)-1;
00919     size_t  position = 0;
00920     size_t  noItems = pMenu->GetMenuItemCount();
00921     
00922     // Get id of first non sub-menu item in Windows wxMenu
00923     // TargetMenuID is -1 if its a sub-menu item and 0 if its a separator
00924     // No separator check present, added by Neville 31/10/97
00925     TargetMenuId = pMenu->FindItemByPosition( position )->GetId(); 
00926     while (
00927             (noItems > 0) && (position < noItems) &&
00928             ((TargetMenuId == (UINT32)-1) || (TargetMenuId == 0))
00929             )
00930     {
00931         TargetMenuId = pMenu->FindItemByPosition( position )->GetId(); 
00932         position++;
00933     }
00934      
00935     if (TargetMenuId != (UINT32)-1)
00936     {                                                           
00937         //Use ID to get MenuItem object 
00938         *TargetMenu = GetMenuItem(TargetMenuId, pShowHotKeysFlag);
00939     
00940         if (*TargetMenu != NULL)                        // couldn't find it, probably
00941         {                                               // the system menu on the close box
00942             //Get Parent Id of MenuItem
00943             TargetMenuId = (*TargetMenu)->GetMenuItemParentId();
00944 
00945             //Use Parent Id to get menu we want!
00946             *TargetMenu = GetMenuItem(TargetMenuId, pShowHotKeysFlag);
00947             if (*TargetMenu)
00948                 return TRUE;
00949             else
00950                 return FALSE;
00951         }
00952     }   
00953     return FALSE;
00954 }

MenuItem* GetCurrentContextMenu (   ) 
 

Find out whether the popup menu is open or not and what it is...

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/03/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
A pointer to the current context menu (kernel form) if it exists AND the Windows equivalent exists AND it's currently on screen.

Errors: None.

Definition at line 1273 of file oilmenus.cpp.

01274 {
01275     if (WinContextMenu!=NULL && CamelotContextMenu!=NULL)
01276         return CamelotContextMenu;
01277     else
01278         return NULL;
01279 }

MenuItem* GetMainMDIMenu (   ) 
 

To find the menu item associated with the main kernelly MDI menu.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/1/97
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
A pointer to the main MDI menu.

Errors: None.

Definition at line 1295 of file oilmenus.cpp.

01296 {
01297     return CamelotMDIMenu;
01298 }

MenuItem* GetMenuItem (  UINT32  menuId,
BOOL *  pShowHotKeysFlag
) 
 

To find a menu item in one of the platform independent menu systems.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/9/93
Parameters:
Menu ID [INPUTS]
None. [OUTPUTS]
Returns:
MenuItem if found NULL if menu item is not found

Errors: None.

See also:
MenuItem

FindMenuItem

Definition at line 831 of file oilmenus.cpp.

00832 {      
00833     // If There are no active child windows Then search for menu option in default menu
00834     // Else search for menu option in MDI shared menu.
00835     
00836     MenuItem* pItem = NULL;
00837     if (pShowHotKeysFlag) *pShowHotKeysFlag = TRUE;
00838 
00839 PORTNOTE( "other", "We always use MDIMenu" )
00840 /*  if( NULL == ( (wxDocMDIParentFrame *)CCamFrame::GetMainFrame() )->GetActiveChild() )
00841     {
00842         // There is no document (MDI child) window, so we want to look only in the 
00843         // current context-sensitive menu (if any), and then (if that fails), in the
00844         // default camelot menu.
00845 
00846         pItem = FindMenuItem(menuId, CamelotContextMenu);   // Look in Context sensitive menu first
00847         if (pItem == NULL)
00848             pItem = FindMenuItem(menuId, CamelotDefMenu);   // Look in default menu
00849     }
00850     else */
00851     {
00852         pItem = FindMenuItem(menuId, CamelotContextMenu);   // Look in Context sensitive menu first
00853         if (pItem == NULL)
00854             pItem = FindMenuItem(menuId, CamelotMDIMenu);
00855         else
00856             if (pShowHotKeysFlag) *pShowHotKeysFlag = FALSE;    // ContextMenu shouldn't show hot keys
00857     }
00858 
00859     return pItem;
00860 }

BOOL InitMenuSystem (   ) 
 

Creates both the platform-independent and windows specific menu systems.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/6/93
Parameters:
None. [INPUTS]
None. [OUTPUTS]
Returns:
TRUE if initialisation was successful

Errors: None.

See also:
OilMenus

MenuItem

SetupDefaultMenu()

SetupSharedMenu()

ConvertToWinMenu()

DeInitMenuSystem()

Definition at line 649 of file oilmenus.cpp.

00650 {
00651     CamelotDefMenu = SetupDefaultMenu();            //MainFrame Menu
00652     CamelotMDIMenu = SetupSharedMenu();             //MDI Menu
00653     CamelotContextMenu = NULL;
00654 
00655     if (CamelotDefMenu)
00656         WinDefMenu = ConvertToWinMenu(CamelotDefMenu);  //Windows MainFrame Menu        
00657     else
00658         return FALSE;
00659         
00660     if (CamelotMDIMenu)
00661         WinMDIMenu = ConvertToWinMenu(CamelotMDIMenu);  //Windows MDI Menu
00662     else
00663         return FALSE;
00664     
00665     return TRUE;
00666 }

BOOL IsMenuCommand (  wxCommandEvent &  event  ) 
 

To identify menu item commands.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/7/93
Parameters:
wParam & lParam - Windows API command parameters. [INPUTS]
None. [OUTPUTS]
Returns:
TRUE if command is a menu command FALSE otherwise

Errors: None.

See also:
CMainFrame

Definition at line 756 of file oilmenus.cpp.

00757 {
00758     return event.GetEventType() == wxEVT_COMMAND_MENU_SELECTED;
00759 }

BOOL PerformMenuCommand (  wxCommandEvent &  event  ) 
 

To perform menu item command.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/7/93
Parameters:
wParam & lParam - Windows API command parameters. [INPUTS]
None. [OUTPUTS]
Returns:
TRUE if MenuItem found and command is performed FALSE otherwise

Errors: None.

See also:
CMainFrame

MenuItem

FindMenuItem()

MenuItem::PerformAction()

Definition at line 881 of file oilmenus.cpp.

00882 {                     
00883     MenuItem* TargetItem;
00884                            
00885     // Get appropriate menu item given the menu id
00886     TargetItem = GetMenuItem( event.GetId() );
00887 
00888     if (TargetItem)
00889     {
00890         TargetItem->PerformAction();
00891         return TRUE;
00892     }               
00893     
00894     return FALSE;
00895 }

MenuItem* SetupDefaultMenu (   ) 
 

Creates the default mainframe menu for an MDI type interface.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/6/93
Parameters:
None. [INPUTS]
None. [OUTPUTS]
Returns:
MenuItem - A platform independent mainframe menu.

Errors: None

See also:
OilMenus

MenuItem

SetupSharedMenu()

GetMenuPreferences()

Definition at line 156 of file oilmenus.cpp.

00157 {
00158     MenuItem* pMenu = GetMenuPreferences(_R(IDM_DEFAULT_MENU));
00159     return pMenu;
00160 }                               

MenuItem* SetupSharedMenu (   ) 
 

Creates a MDI type shared menu.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/6/93
Parameters:
None. [INPUTS]
None. [OUTPUTS]
Returns:
MenuItem - A platform independent MDI menu.

Errors: None

See also:
OilMenus

MenuItem

SetupDefaultMenu()

GetMenuPreferences()

Definition at line 180 of file oilmenus.cpp.

00181 {
00182     MenuItem* pMenu = GetMenuPreferences(_R(IDM_SHARED_MENU));
00183     return pMenu;
00184 }

BOOL UpdateMenu (  wxMenu *  pMenu  ) 
 

To update menu.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/7/93
Parameters:
A pointer to a wxMenu [INPUTS]
None. [OUTPUTS]
Returns:
FALSE if Menu is not found in the Kernel TRUE otherwize.

Errors: None.

See also:
CMainFrame

wxMenu

MenuItem

Definition at line 974 of file oilmenus.cpp.

00975 {                     
00976     MenuItem*   TargetMenu = NULL;
00977     BOOL        ShowHotKeys = TRUE;
00978     
00979     if (FindMenu(&TargetMenu, pMenu, &ShowHotKeys))
00980     {
00981         ERROR3IF(TargetMenu==NULL,"FindMenu returned TRUE but didn't fill in menu pointer");
00982 
00983 #ifdef PHOTOSHOPPLUGINS
00984 // Only add in if required - general plug-in removal at present
00985 //#ifdef NEW_NATIVE_FILTER
00986         // Must check if we are going to drop down the Plug-Ins menu item
00987         // If so then check that we have parsed the plug-ins.
00988         PlugInManager* pManager = GetApplication()->GetPlugInManager();
00989         if (pManager != NULL && !pManager->SearchedPathsYet())
00990         {
00991             MenuItem * pPlugInsMenu = pManager->FindPlugInMainMenuItem();
00992             // a pointer compare should be an adequote test
00993             if (pPlugInsMenu != NULL && TargetMenu != NULL && pPlugInsMenu == TargetMenu)
00994             {
00995                 pManager->CheckHaveDetailsOnPlugIns();
00996                 // Now done in UpdatePlugInsWinMenu
00997                 // Force the menu bar to be redrawn as we are in the middle of pulling the
00998                 // menu down and we have changed it.
00999                 //HWND hwnd = GetMainFrame()->GetSafeHwnd();
01000                 //DrawMenuBar(hwnd);
01001                 // Cannot fall through to the code below as the pMenu we have had passed in
01002                 // may now be completely false. This will cause problems in the UpdateWinMenu call.
01003                 // So return now.
01004                 return TRUE;
01005             }
01006         }
01007 //#endif
01008 #endif
01009         // Update Kernel Menu 
01010         TargetMenu->UpdateMenuState(ShowHotKeys);
01011     
01012         // Update OIL Menu 
01013         UpdateWinMenu(pMenu, TargetMenu);
01014         
01015         return TRUE;
01016     }
01017     else
01018         return FALSE;
01019 }

BOOL UpdatePlugInsWinMenu (  MenuItem *  pPlugInsMenu  ) 
 

This searches for the equivalent Win menu in the main MDI menu structure, destroys anything that is there already and then puts in the new structure.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/1/97
Parameters:
pPlugInsMenu Pointer to the plug-ins kernel menu structure [INPUTS]
- [OUTPUTS]
Returns:
TRUE if win menu was updated succesfully. FALSE otherwise

Errors: None.

Definition at line 1315 of file oilmenus.cpp.

01316 {
01317 #ifdef PHOTOSHOPPLUGINS
01318 // Only add in if required - general plug-in removal at present
01319     ERROR2IF(pPlugInsMenu == NULL,FALSE,"UpdatePlugInsWinMenu null plug-ins menu supplied");
01320 
01321     BOOL worked = FALSE;
01322 
01323     // Find the section in the current MDI main win menu
01324     INT32 PlugInMenuPos = -1;
01325     wxMenu * pWinMainMenu = FindSubMenu(WinMDIMenu, PlugInMenuPos, (TCHAR *) pPlugInsMenu->GetMenuText());
01326 
01327     if (pWinMainMenu == NULL)
01328         return FALSE;
01329     wxMenu * pPlugInsWinMenu = pWinMainMenu->GetSubMenu(PlugInMenuPos);
01330     if (pPlugInsWinMenu == NULL)
01331         return FALSE;
01332 
01333     // If the previous plug-ins menu is hanging around for some reason
01334     // get rid of it.
01335     // Try and destroy all the sub-menu items first
01336     BOOL ok = DestroyWinMenuMFC(pPlugInsWinMenu);
01337     ok = ok && pWinMainMenu->DeleteMenu( PlugInMenuPos, MF_BYPOSITION );
01338     pPlugInsWinMenu->Detach();
01339     delete pPlugInsWinMenu;
01340 
01341     // Now setup the new plug-ins menu inserting it at the old position
01342     // First create the new windows menu from the kernel version
01343     wxMenu * pNewWinMenu = CreatePopup(pPlugInsMenu);
01344     ERROR3IF(pNewWinMenu == NULL,"Failed to create new plug-ins main menu item");
01345     if (pNewWinMenu)
01346     {
01347         // That went ok so now add it in at the old position in the main menu
01348         pWinMainMenu->InsertMenu(PlugInMenuPos,
01349                                  MF_POPUP | MF_BYPOSITION, 
01350                                  (UINT32)(pNewWinMenu->GetSafeHmenu()), 
01351                                  pPlugInsMenu->GetMenuText()
01352                                  );                      
01353     }
01354 
01355     // Force the menu bar to be redrawn as we are in the middle of pulling the
01356     // menu down and we have changed it.
01357     HWND hwnd = GetMainFrame()->GetSafeHwnd();
01358     DrawMenuBar(hwnd);
01359 
01360     // This code should happen in the UpdateMenu after our issuing of the DrawMenuBar command
01361     // Update Kernel Menu 
01362     pPlugInsMenu->UpdateMenuState(FALSE);
01363 
01364     // Update OIL Menu 
01365     UpdateWinMenu(pNewWinMenu, pPlugInsMenu);
01366 
01367     return worked;
01368 #else
01369     return TRUE;
01370 #endif // PHOTOSHOPPLUGINS
01371 }


Variable Documentation

const UINT32 AUTO_MENU_ID_MAX = 2000
 

Definition at line 195 of file oilmenus.h.

const UINT32 AUTO_MENU_ID_MIN = 1000
 

Definition at line 194 of file oilmenus.h.

wxMenu* WinContextMenu
 

Definition at line 136 of file oilmenus.cpp.

wxCamMenuBar* WinDefMenu
 

Definition at line 134 of file oilmenus.cpp.

wxCamMenuBar* WinMDIMenu
 

Definition at line 135 of file oilmenus.cpp.


Generated on Sat Nov 10 03:49:34 2007 for Camelot by  doxygen 1.4.4