Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Objective Toolkit User's Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

11.6 Using SECShortcutBar

The following topics describe how you can use SECShortcutBar in your projects.

11.6.1 To incorporate an SECShortcutBar into your application

  1. In the class for the parent window, instantiate an SECShortcutBar object. For example:

  2. During the creation of the parent frame, call the SECShortcutBar::Create() method to create the shortcut bar window. For example:

11.6.2 To add selectable icons to a shortcut bar

  1. In one of your classes, create two CImageList members to hold the normal and small bitmap images. You need to create both lists for the images to ensure the icons appear correctly in the shortcut bar. For example, in the declaration file type:

      CImageList m_imlNormal;
      CImageList m_imlSmall;
      
      

    In the implementation file, insert:

      m_imlNormal.Create( 32, 32, ILC_COLOR|ILC_MASK, 8, 1);
      m_imlSmall.Create( 16, 16, ILC_COLOR|ILC_MASK, 8, 1);
      
      CBitmap bmpNormal;
      CBitmap bmpSmall;
      
      VERIFY(bmpNorm.LoadBitmap(IDB_INBOX));
      VERIFY(bmpSmall.LoadBitmap(IDB_INBOX_SMALL));
      m_idInbox = m_imlNormal.Add( &bmpNorm,
                                   RGB(255,0,255));
                  m_imlSmall.Add(  &bmpSmall,
                                   RGB(255,0,255));
      bmpNorm.DeleteObject();
      bmpSmall.DeleteObject();
      
      VERIFY(bmpNorm.LoadBitmap(IDB_CONTACTS));
      VERIFY(bmpSmall.LoadBitmap(IDB_CONTACTS_SMALL));
      m_idContacts = m_imlNormal.Add( &bmpNorm,
                                      RGB(255,0,255));
                     m_imlSmall.Add(  &bmpSmall,
                                      RGB(255,0,255));
      bmpNorm.DeleteObject();
      bmpSmall.DeleteObject();
      
  2. Use the AddBar() method to create an SECListBar with a label. For example:

      SECListBar* pListBar = NULL;
      pListBar = m_wndShortcutBar.AddBar(_T("Fill With"));
      ASSERT_VALID(pListBar);
      


    When you embed CWnd objects in the shortcut bar, the bar class is SECBar, not SECListBar.

  3. Add the image lists to the SECListBar.

      pListBar->SetImageList( &m_imgNormal, LVSIL_NORMAL );
      pListBar->SetImageList( &m_imgSmall, LVSIL_SMALL  );
      
  4. Set the notification window if you want to receive notification messages. This is important if the shortcut bar is embedded in a splitter window.

      pListBar->SetNotifyWnd( this );
      
  5. You can also set some extra information about the list bar.

      //Little bit of info used to figure out who I am...
      pListBar->SetExtraData( (void*)FillPane );
      
  6. Add icons using the image ID's in the image lists using either the InsertItem() or AddItem() methods. For example:

      //School Data records...
      pListBar->InsertItem( 0, _T("School Data"), 0 );
      pListBar->SetItemData( 0, (DWORD)IDS_SCHOOL_FILE );
      
      //Factory Data records
      pListBar->InsertItem( 1, _T("Factory Data"), 1 );
      pListBar->SetItemData( 1, (DWORD)IDS_FACTORY_FILE );
      

11.6.3 To embed a window in a shortcut bar

Call the overloaded AddBar() method, which accepts a CWnd parameter. For example:

11.6.4 To change the way the bars are drawn

Derive a class from SECBar and then override the Draw() method. For example:


For an SECListBar derivative, the call to SetBarClass()in the above code should be replaced with a call to SetListBarClass().

11.6.5 To allow shortcut bars to behave like buttons

Use the SEC_OBS_BUTTONFEEDBACK style flag as a parameter for the Create() or ModifyBarStyles() methods. When this style is specified, the bar remains pressed, like a button, giving the user additional feedback on which bar was clicked. For example:

See Section 11.3 for more style flags and their descriptions.

11.6.6 To enable context menus in a shortcut bar

  1. Use the SEC_OBS_CONTEXTMENU style as a parameter for the Create() or ModifyBarStyles() methods. For example:

  2. Associate a context menu with the shortcut bar by calling the SetBarMenu() method.


    The context menu specified here does not appear when an SECShortcutListCtrl window is right clicked. The SECShortcutListCtrl has its own context menu that is displayed when a right click occurs.

See Section 11.3 for more style flags and their descriptions.

11.6.7 To have the shortcut bars display the focus rectangle

Use the SEC_OBS_BUTTONFOCUS style flag as a parameter for the Create() or ModifyBarStyles() methods. For example:

See Section 11.3 for more style flags and their descriptions.

11.6.8 To enable/disable animated scrolling

  1. Use the SEC_OBS_ANIMATESCROLL style flag as a parameter for the Create() or ModifyBarStyles() methods. For example:

  2. To control the scrolling behavior further, call the SetAnimationSpeed() and SetAnimationStep() methods.

See Section 11.3 for more style flags and their descriptions.

11.6.9 To receive notifications when an icon in the SECShortcutListCtrl is clicked

  1. In your parent window class (frame window, dialog, or other), add the ON_NOTIFY_RANGE macro to your message map macro list using the SEC_NM_ITEMCLICKED notification message. For example:

  2. Override SECShortcutBar::OnListBarClicked(). The prototype looks like this.

See Section 11.4 for more information on notification messages.

11.6.10 To determine which icon is clicked in an SECListBar window

When the user clicks an icon, it generates an SEC_NM_ITEMCLICKED notification. Typically, you would add a message map entry like the following to your listbar's parent window (frame window, dialog).

The prototype for OnListBarClicked() is as follows:

The following is an example handler.

11.6.11 To change the orientation of the shortcut bar at run time

Call the SetAlignStyle() method. For example:

11.6.12 To embed an SECShortcutBar into a splitter pane

  1. Derive a new class from CSplitterWnd. In the derived splitter class, introduce a handler for the WM_MOUSEWHEEL message and remove the call to the base CSplitterWnd handler. Return FALSE instead. For example:

  2. Create a splitter window using the run-time class SECShortcutBar to create the shortcut bar as a child of the splitter window. For example:

  3. Retrieve a pointer to the shortcut bar from the splitter window. For example:

  4. Use the AddBar() method to add bars to the shortcut bar. See Section 11.6.2 and Section 11.6.3.



Previous fileTop of DocumentContentsNo linkNext file

Copyright © Rogue Wave Software, Inc. All Rights Reserved.

The Rogue Wave name and logo, and Stingray, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.