L_TBGetToolbarInfo

#include "LtTLB.h"

L_INT EXT_FUNCTION L_TBGetToolbarInfo (pToolbar, pToolbarInfo, uStructSize)

pTOOLBARHANDLE pToolbar;

/* pointer to a toolbar handle */

pLTOOLBARINFO pToolbarInfo;

/* pointer to a structure */

L_UINT uStructSize;

/* size in bytes, of the structure pointed to by pToolbarInfo */

Gets the current toolbar information.

Parameter

Description

pToolbar

Pointer to a toolbar handle.

pToolbarInfo

Pointer to LTOOLBARINFO structure to be updated with the current toolbar information.

uStructSize

Size in bytes, of the structure pointed to by pToolbarInfo, for versioning. Use sizeof(LTOOLBARINFO).

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes

Comments

When the TOOLBARINFO structure is no longer needed, it should be freed using L_TBFreeToolbarInfo.

Required DLLs and Libraries

LTTLB

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

L_TBSetToolbarInfo, L_TBFreeToolbarInfo.

Topics:

Getting and Setting Toolbar Information

Example

/* This example will create a digital paint toolbar and then gets its information,
   then changes its button IDs and it will set this information as the new information 
   for the toolbar */

/* Global toolbar handle */
pTOOLBARHANDLE g_pLeadToolbar ; 

L_INT ToolbarTest ( HWND hWnd )
{
   LTOOLBARINFO ToolbarInfo ;

   /* Initiate the toolbar handle */
   L_TBInit ( &g_pLeadToolbar ) ; 

   if (SUCCESS == L_TBIsValid ( g_pLeadToolbar ) ) /* check the validity of the toolbar handle */
   {
      POINT pt = { 0, 0 } ;

      /* Create the toolbar */
      L_TBCreate ( g_pLeadToolbar, hWnd, TEXT("Tools Window"), TOOLBAR_PAINT ) ;

       /* Get the toolbar information */
      L_TBGetToolbarInfo ( g_pLeadToolbar, &ToolbarInfo, sizeof(LTOOLBARINFO) ) ;

      /* Change all buttons IDs */
      for ( L_UINT i = 0; i < ToolbarInfo.uToolsCount; i ++ )
      {
         for ( L_UINT j; j < ToolbarInfo.pTools[i].uButtonsCount; j ++ )
         {
            ToolbarInfo.pTools[i].pButtons[j].uID ++ ;
         }
      }

      /* Get the point that will be used to align the toolbar to 
      top-left of its owner client area */
      ClientToScreen ( hWnd, &pt ) ;

      /* Set the toolbar position */
      L_TBSetPosition ( g_pLeadToolbar, &pt, TOOLBAR_POSITION_TOP | TOOLBAR_POSITION_LEFT ) ;

      /* Set the new toolbar information */
      L_TBSetToolbarInfo ( g_pLeadToolbar, &ToolbarInfo ) ;

      /* Free the information that was allocated by L_TBGetToolbarInfo */
      L_TBFreeToolbarInfo ( g_pLeadToolbar, &ToolbarInfo ) ;

      /* Show the toolbar */
      L_TBSetVisible ( g_pLeadToolbar, TRUE ) ;

      return SUCCESS ;
   }
   else
   {
      return FAILURE ;
   }

}