home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / BC_502 / DYNAMENU.PAK / DMDECFR.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-06  |  1.6 KB  |  58 lines

  1. // ---------------------------------------------------------------------------
  2. // ObjectWindows
  3. // Copyright (C) 1995, 1995 by Borland International, All Rights Reserved
  4. // ---------------------------------------------------------------------------
  5. #include <owl/pch.h>
  6. #include "dynmnu.h"
  7.  
  8. //
  9. // constructor
  10. //
  11. TDynamicMenuDecoratedFrame::TDynamicMenuDecoratedFrame(
  12.   TWindow* parent,
  13.   const char far* title,
  14.   TWindow* clientWnd,
  15.   bool trackMenuSelection,
  16.   TModule* module)
  17. :
  18.   TDecoratedFrame(parent, title, clientWnd, trackMenuSelection, module)
  19. {
  20. }
  21.  
  22.  
  23. //
  24. // On idle message, set the hint text
  25. //
  26. void
  27. TDynamicMenuDecoratedFrame::EvEnterIdle(uint source, HWND hWndDlg)
  28. {
  29.   if (source == MSGF_MENU && MenuItemId) {
  30.     if (CM_DYNFIRST <= MenuItemId && MenuItemId < CM_DYNLAST) {
  31.       // is a dynamic menu item
  32.       //
  33.       TMenuTestWindow* mtWin = TYPESAFE_DOWNCAST(GetClientWindow(), TMenuTestWindow);
  34.       TMessageBar* messageBar = TYPESAFE_DOWNCAST(ChildWithId(IDW_STATUSBAR), TMessageBar);
  35.       if (messageBar && mtWin) {
  36.         // client window and statusbar are valid
  37.         //
  38.         int index = MenuItemId - CM_DYNFIRST;
  39.         if (index >= 0 && index < CM_DYNLAST - CM_DYNFIRST && mtWin->DynamicMenuAttr[index])
  40.           messageBar->SetHintText(mtWin->DynamicMenuAttr[index]->GetHintText().c_str());
  41.       }
  42.     }
  43.     else {
  44.       // default action
  45.       //
  46.       TDecoratedFrame::EvEnterIdle(source, hWndDlg);
  47.     }
  48.   }
  49. }
  50.  
  51.  
  52. //
  53. // Response table
  54. //
  55. DEFINE_RESPONSE_TABLE1(TDynamicMenuDecoratedFrame, TDecoratedFrame)
  56.   EV_WM_ENTERIDLE,
  57. END_RESPONSE_TABLE;
  58.