Introduction

The LEADTOOLS Toolbar API provides dynamic link library (DLL) functions to let you incorporate toolbars into your Windows applications. The LEADTOOLS Toolbar API provides a means of creating and customizing user-defined toolbars. When used with the LEADTOOLS Automation API it provides a means for conveniently adding Vector and Paint automated toolbars for drawing and painting.

The toolkit comes in WIN32 editions so that it can support development of software applications for any of the following environments:

Windows WIN32s 3.x
Windows 3.x NT
Windows 4.x NT
Windows 95

Please note that if you have purchased an eval version of a LEADTOOLS toolkit, this help file contains the same information as the help file included in the standard release toolkit. Consequently, references to the .DLL and .LIB files contain an N designation. The .DLL and .LIB files included with the evaluation toolkit contain an E designation. Therefore, any references in the help file to xx14N.DLL or xx_N.LIB files refer to the corresponding xx14E.DLL or xx_E.LIB files. For example, if the help file refers to LTBAR14N.DLL, your corresponding file is LTBAR14E.DLL.


Example Programs

The following example programs are in separate EXAMPLES subdirectories (such as C:\LEAD Technologies, Inc\LEADTOOLS\Examples\DLL\COLOR). The executable files for these examples were compiled with Document/Medical capabilities. To get Document/Medical capabilities, you must buy a LEADTOOLS Document/Medical toolkit. Otherwise, if you recompile the examples, the resulting executable files will not have the Document/Medical capabilities.

Note:

You can run the example programs on your system by clicking the appropriate buttons in online help. If you try to run an example program that is not on your system, an error message will appear.

VECAUT

Vector Automation Demo is the main vector automation example program. It uses pull-down menus to demonstrate most of the LEADTOOLS Automation and Container features in one application.


Version History

Current version: | 14.5
Last update: | October 20, 2005

Changes from Version 14 to Version 14.5

Change from Version 13 to Version 14.

Change from Version 12.1 to Version 13.

Changes from Version 12 to Version 12.1

Version 12


Changes from Version 14 to Version 14.5

Version 14.5 of the LEADTOOLS Toolbar API has not changed from Version 14.


Changes from Version 13 to Version 14

Version 14 of the LEADTOOLS Toolbar API has changed from Version 13 as follows:

LEADTOOLS Toolbar API now supports UNICODE.

Changed functions:

The following functions have been changed from the previous version of LEADTOOLS Toolbar API:

L_TBGetButtonInfo (1 new or changed parameter)

L_TBGetToolbarInfo (1 new or changed parameter)

Changed structures:

The following structures have been changed from the previous version of LEADTOOLS Toolbar API:

LBUTTONINFO (1 member's name changed)

LTOOLBARINFO (1 member's name changed)

LTOOLBARTOOL (1 member's name changed)


Changes from Version 12.1 to Version 13

Version 13 of the LEADTOOLS Toolbar API has not changed from Version 12.1.


Changes from Version 12 to Version 12.1

Version 12.1 of the LEADTOOLS Toolbar API has changed from Version 12 as follows:

The LEADTOOLS Toolbar API now supports the DigitalPaint toolbar.


Version 12

Version 12 is the first version of the LEADTOOLS Toolbar API.

The rest of the topic lists the new functions:

L_TBAddButton

L_TBCreate

L_TBFree

L_TBFreeToolbarInfo

L_TBGetButtonChecked

L_TBGetButtonInfo

L_TBGetCallback

L_TBGetPosition

L_TBGetRows

L_TBGetToolbarInfo

L_TBInit

L_TBIsButtonEnabled

L_TBIsButtonVisible

L_TBIsValid

L_TBIsVisible

L_TBRemoveButton

L_TBSetButtonChecked

L_TBSetButtonEnabled

L_TBSetButtonInfo

L_TBSetButtonVisible

L_TBSetCallback

L_TBSetPosition

L_TBSetRows

L_TBSetToolbarInfo

L_TBSetVisible


Copyright notice

Copyright Notices

©Copyright LEAD Technologies, Inc. 1991-2005. ALL RIGHTS RESERVED

Portions of the PCDLIB32.DLL, PCDLIB.DLL, LFFPX7.DLL, LFKODAK.DLL, EKFPIXJPEG140.DLL, PDC_SDK.DLL, PROFIRE.DLL, DC120V154_32.DLL, LFDCR14N.DLL, DCSPROBACK.DLL, DCSPRO3SLR.DLL, LFDCS14N.DLL, and LFKDC14N.DLL files contain material that is ©Copyright Eastman Kodak Company, 1996-2001. This software is based in part on the work of the Independent JPEG Group.

Portions of the LFCRW14N.DLL, LTCMP14.DLL, CDSDK.reg, CDSDK.dll, CDRAPCLS.dll, czs_ui.dll, deimg.dll, deImg010.dll, deImg110.dll, deImg153.dll, deimg301.dll, deimg401.dll, deImg404.dll, deimg602.dll, Deimg603.dll, DeImgd60.dll, pscAdimg.dll, pscCllct.dll, pscCStUI.dll, pscDcd.dll, pscDevUI.dll, pscDvlp.dll, Pscl2STI.dll, pscll.dll, pscParse.dll, pscSetup.dll, psdkdll.dll, psdkReg.dll, psParse.dll. file contain material that is © Canon, Inc. 2002

Portions of the LFFPX7.DLL and LFKODAK.DLL files contain material that is ©Copyright Hewlett Packard, 1996.

Portions of the OCR/ICR/OMR Features and the help file for the OCR/ICR/OMR Features are ©Copyright Scansoft, Inc. 1995-2003. ALL RIGHTS RESERVED

Portions of the Barcode Modules contain material that is ©Copyright Axtel Inc., 1999.

Portions of the LEADTOOLS PDF Plug in and the LEADTOOLS Vector Imaging Pro are ©Copyright 1996, 2000 Artifex Software Inc. All rights reserved.

File filters for decoding MrSID ® and DjVu ® formats are provided under a license from Lizardtech, Inc.

The "FlashPix" format uses Microsoft's OLE structured storage.

Portions of the DICOM help files in Medical Imaging product line are reprinted with permission from the National Electrical Manufacturers Association ©Copyright 1998 by the National Electrical Manufacturers Association. All rights including translation into other languages, reserved under the Universal Copyright Convention, the Berne Convention or the Protection of Literacy and Artistic Works, and the International and Pan American Copyright Conventions.

Portions of LEADTOOLS Data Security Add On contain software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/), including cryptographic software written by Eric Young (eay@cryptsoft.com) and by Tim Hudson (tjh@cryptsoft.com). Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) All rights reserved. Copyright Tim Hudson 1995-1998 (tjh@cryptsoft.com) All rights reserved.

Portions of LEADTOOLS Data Security Add On contain software based on the MD5 Message Digest Algorithm developed by RSA Data Security, Inc.. Copyright (c) 1991-92 RSA Data Security, Inc. All Rights Reserved.

Portions hereof licensed under US patent 5,327,254 and foreign counterparts.

Portions of the LEADTOOLS ICC Profiles material is © Copyright 2004, International Color Consortium.

Trademarks

LEAD® and LEADTOOLS® are registered trademarks of LEAD Technologies, Inc.
Microsoft, Windows, Windows NT, Visual Basic, Visual FoxPro, and Microsoft Access are either trademarks or registered trademarks of the Microsoft Corporation.
OS/2® is a registered trademark of International Business Machines Corporation.

TextBridge®OCR is a registered trademark of Scansoft, Inc.

ISIS® is a registered trademark of Pixel Translations, Inc.

ScanAhead™ is a trademark of Pixel Translations, Inc.

FlashPix™ is a trademark of Eastman Kodak Company.

All other brand or product names used in this online help are trademarks of their respective holders.

Address and Contact Information

LEAD Technologies, Inc.
Suite 400
1201 Greenwood Cliff
Charlotte, NC 28204

(704) 332-5532
FAX: (704) 372-8161
E-mail: support@leadtools.com
Technical support: (704) 372-9681 or support@leadtools.com
Home page: http://www.leadtools.com


Programming with LEADTOOLS

The following topics provide a systematic approach to understanding how to program with the LEADTOOLS Toolbar API.

Introduction to Toolbars

Initializing and Freeing Toolbars

Creating a Toolbar

Getting and Setting Toolbar Information

Getting and Setting Toolbar Characterisitcs

Getting and Setting Toolbar Button Information

Receiving Toolbar Events


Introduction to Toolbars

The LEADTOOLS Toolbar API provides a means of adding either predefined or custom designed toolbars to an application. Adding toolbars to applications provides a quick and convenient way of drawing or performing other functions.

A toolbar consists of one or more tools and each tool has one or more buttons associated with it. General information about the toolbar can be accessed through an LTOOLBARINFO structure. This includes information about the number of buttons present in the toolbar, the size of the bitmaps used for the buttons and an array of tools in the toolbar.

Information about each tool in a toolbar can be accessed through an LTOOLBARTOOL structure. This structure includes information about the number of buttons associated with the tool and an array of buttons associated with the tool.

LBUTTONINFO structures contain information about each button associated with each tool in a toolbar. This information includes a button identifier, the state of the button, the bitmap displayed for the button and tool tip text that is displayed when the user places the cursor over the button.

For more information about toolbars, refer to Getting and Setting Toolbar Information

For more information about buttons on the toolbar, refer to Getting and Setting Toolbar Button Information


Initializing and Freeing Toolbar

Initializing and Freeing Toolbars

LEADTOOLS accesses toolbars through the TOOLBARHANDLE structure. This structure provides a working area for the toolbar functions. The toolbar handle must be initialized before calling any of the toolbar functions. This is done using the L_TBInit function. The following example shows how to initialize the toolbar handle.

pTOOLBARHANDLE pLeadToolbar ;

/* Initiate the toolbar handle */
L_TBInit ( &pLeadToolbar ) ;
…

A toolbar handle is valid only after L_TBInit and L_TBCreate have been called. The validity of the toolbar should be checked before calling any other toolbar functions. This is done using L_TBIsValid.

When the TOOLBARHANDLE structure is no longer needed, it should be freed using the L_TBFree function. The following example shows how to free a toolbar handle:

if (SUCCESS == L_TBIsValid
 ( pLeadToolbar ) )
{
L_TBFree ( pLeadToolbar
 ) ;

return SUCCESS ;
}
else
{
return FAILURE ;
}

Once L_TBFree has been called, the toolbar handle is no longer valid.


Creating a Toolbar

After initializing the toolbar handle, the toolbar must be created using the L_TBCreate function. The toolbar is created in a regular child window. The user has the option of creating a toolbar "from scratch" and entering the desired buttons, or the user may create a Vector or Paint toolbar, complete with a predefined set of buttons. The following example shows how to create a toolbar:

/* This example will initiate, create a toolbar, set its position and make it visible */

/* Global LEAD toolbar handle */
pTOOLBARHANDLE g_pLeadToolbar ;

L_INT ToolbarTest ( HWND hWnd )
{
/* Initiate the toolbar handle */
L_TBInit ( &g_pLeadToolbar ) ;

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

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

/* Initiate the point will be used to align the toolbar at the 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 ) ;

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

return SUCCESS ;
}


Getting and Setting Toolbar Information

General information about a toolbar can be accessed through an LTOOLBARINFO structure. This includes information about the size of bitmaps used to display any associated buttons, the number of tools present on the toolbar, an array of structures that contain information about the individual tools on the toolbar and any user-defined information included in the toolbar. To get the current information about a toolbar, use the L_TBGetToolbarInfo. This function will update an LTOOLBARINFO structure with the current toolbar information.

The toolbar information can be changed using the L_TBSetToolbarInfo function. This may be used to modify an existing toolbar, or to set the information for a new toolbar created using the TOOLBAR_EMPTY flag in L_TBCreate.

When the toolbar information is no longer needed, it should be freed by calling L_TBFreeToolbarInfo.

The following example shows how create a user-defined toolbar (we have assumed that the toolbar handle is already initialized and the application instance has the necessary bitmaps and strings):

#define TOOL_BUTTONS_COUNT 5
#define NUM_OF_TOOLS 1
#define DEF_BITMAP_WIDTH 18
#define DEF_BITMAP_HEIGHT 17

LBUTTONINFO ButtonsInfo [ TOOL_BUTTONS_COUNT ] ;
LTOOLBARTOOL ToolInfo ;
LTOOLBARINFO ToolbarInfo ;
L_INT i ;

// initialize buttons information.
for ( i = 0; i < TOOL_BUTTONS_COUNT; i ++ )
{
ButtonsInfo[i].uStructSize = sizeof ( LBUTTONINFO ) ;
ButtonsInfo[i].uID = i ;
ButtonsInfo[i].fsState= TBSTATE_ENABLED ;
ButtonsInfo[i].hBitmap = LoadBitmap ( g_hInstance,
MAKEINTRESOURCE ( i ) ) ;

// Load the string resource with the button ID.
LoadString ( g_hInstance,
i,
ButtonsInfo[i].szToolTipText,
sizeof ( ButtonsInfo[i].szToolTipText ) ) ;

ButtonsInfo[i].dwTag = 0 ;
}

// initialize the tool information.
ToolInfo.uStructSize = sizeof ( LTOOLBARTOOL ) ;
ToolInfo.uButtonsCount = TOOL_BUTTONS_COUNT ;
ToolInfo.pButtons = ButtonsInfo ;
ToolInfo.dwTag = 0 ;

//initialize the toolbar information.
ToolbarInfo.uStructSize = sizeof ( LTOOLBARINFO ) ;
ToolbarInfo.cxBitmapWidth = DEF_BITMAP_WIDTH ;
ToolbarInfo.cyBitmapHeight = DEF_BITMAP_HEIGHT ;
ToolbarInfo.uToolsCount = NUM_OF_TOOLS ;
ToolbarInfo.pTools = &ToolInfo ;
ToolbarInfo.dwTag = 0 ;

// set the toolar information.
L_TBSetToolbarInfo ( pToolbar, &ToolbarInfo ) ;


Getting and Setting Toolbar Characteristics

In addition to the toolbar information mentioned in Getting and Setting Toolbar Information, other toolbar characteristics can be modified. These include toolbar visibility, position and the number of rows present in the toolbar.

A toolbar can be made visible or hidden using L_TBSetVisible. To determine whether the toolbar is visible or hidden, call L_TBIsVisible.

The position of the toolbar can be changed using L_TBSetPosition. This function allows the user to specify a point and orient the toolbar around that point. To get the current position, call L_TBGetPosition.

The number of rows in the toolbar can also be set. This is done using the L_TBSetRows function. However, the number of rows cannot exceed the number of buttons in the toolbar. To determine the current number of rows in the toolbar, call L_TBGetRows.

The following example gets the current number of rows in the toolbar. If it's not 2, then it will make 2 rows:

L_INT SetToolbarRows ( pTOOLBARHANDLE pLeadToolbar
 )
{
if (SUCCESS == L_TBIsValid
 ( pLeadToolbar ) ) /* check the validity of the toolbar handle */
{
L_INT nRow ;

/* Get the number of rows in the toolbar
 */
L_TBGetRows ( pLeadToolbar, &nRow ) ;

if ( nRow != 2 )
{
/* Set the number
 of rows to 2 */
L_TBSetRows
 ( pLeadToolbar, 2 ) ;
}

return SUCCESS ;
}
else
{
return FAILURE ;
}
}

A toolbar can also be changed by changing the buttons contained in the toolbar. For more information about functions that affect toolbar buttons, refer to Getting and Setting Toolbar Button Information.


Getting and Setting Toolbar Button Information

A toolbar can be changed by changing the buttons that make up that toolbar. LEADTOOLS provides several functions for getting and setting information about toolbar buttons.

General information about toolbar buttons can be accessed through an LBUTTONINFO structure, including button identifier, the state of the button, the bitmap used to display the button, the tool tip text displayed when the user places the mouse over the button and user-defined information included about the button. To get the current information on a specific button, call L_TBGetButtonInfo. To alter the information about a specific button uses the L_TBSetButtonInfo function.

Only one button can be selected or checked at a time. The selected button is the active button of the toolbar. To determine the current selected button of a toolbar, call L_TBGetButtonChecked. To set a different button as the selected button use L_TBSetButtonChecked.

In order to be selected, a toolbar button must be enabled. To determine if a specific button is enabled, call L_TBIsButtonEnabled. To enable or disable a button, use L_TBSetButtonEnabled.

Toolbar buttons may be visible or hidden. The visibility of a button may be changed using L_TBSetButtonVisible. To determine a button's current visibility status all L_TBIsButtonVisible.

The following example determines the button's visibility status and then toggles it.

L_INT ToggleToolbarButton ( pTOOLBARHANDLE pLeadToolbar,
 L_UINT uButtonID )
{
if (SUCCESS == L_TBIsValid
 ( pLeadToolbar ) ) /* check the validity of the toolbar handle */
{
L_BOOL fVisible ;

/* Get the state of the toolbar button
 visibility */
L_TBIsButtonVisible( pLeadToolbar,
 uButtonID, &fVisible ) ;

if ( fVisible )
{
/* Hid the button
 */
L_TBSetButtonVisible
 ( pLeadToolbar, uButtonID, FALSE ) ;
}
else
{
/* Show the button
 */
L_TBSetButtonVisible
 ( pLeadToolbar, uButtonID, TRUE ) ;
}

return SUCCESS ;
}
else
{
return FAILURE ;
}
}

In addition, buttons can be added or removed from a toolbar using L_TBAddButton and L_TBRemoveButton.


Receiving Toolbar events

When a toolbar button is selected, the application is notified through a callback function. The callback function must adhere to the prototype described in TOOLBARCALLBACK. To set the callback function to use for notification, call L_TBSetCallback. To determine which callback function is currently being used, call L_TBGetCallback. The following is an example of processing toolbar events:

/* This example will create a toolbar and set its callback and then use some of
its buttons messages to dispaly messages to the user */

L_INT EXT_CALLBACK LeadToolbarProc
(
pTOOLBARHANDLE pToolbar,
L_UINT nButtonID,
L_UINT32 dwData,
L_VOID L_FAR *pUserData
)
{
switch ( nButtonID )
{
case ID_TOOL_PAINT_BRUSH:
{
MessageBox ( * ( HWND * ) pUserData, TEXT("BRUSH"), TEXT("Toolbar Message"), MB_OK ) ;
}

break ;

case ID_TOOL_PAINT_SHAPE_LINE:
{
MessageBox ( * ( HWND * ) pUserData, TEXT("LINE"), TEXT("Toolbar Message"), MB_OK ) ;
}

break ;

case ID_TOOL_PAINT_REGION_RECT:
{
MessageBox ( * ( HWND * ) pUserData, TEXT("RECT"), TEXT("Toolbar Message"), MB_OK ) ;
}

break ;
}

return SUCCESS ;
}

/* Global toolbar handle */
pTOOLBARHANDLE g_pLeadToolbar ;

L_INT ToolbarTest ( HWND hWnd )
{
static HWND hwndToolbarOwner ;

/* Save the owner window handle */
hwndToolbarOwner = hWnd ;

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

if (SUCCESS == L_TBIsValid ( g_pLeadToolbar ) ) /* check the validity of the toolbar handle */
{
/* Create the toolbar */
L_TBCreate ( g_pLeadToolbar, hWnd, TEXT("Tools Window"), TOOLBAR_PAINT ) ;

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

/* Set the toolbar callback with the owner window as the user defined data */
L_TBSetCallback ( g_pLeadToolbar, LeadToolbarProc, ( L_VOID L_FAR * ) &hwndToolbarOwner ) ;
}

return SUCCESS ;
}


Toolbar Files To Be Included With Your Application

The installation procedure creates a directory tree for the LEADTOOLS files, and adds the demonstration programs and online help to your desktop. You specify the root directory during installation. The following subdirectory is created:

REDIST\

Redistributable Toolbar files.

Note: | You may not copy or redistribute any of the following files without obtaining the proper license. In some cases, the license is included with your initial purchase of LEADTOOLS. In other cases, you must obtain a license from a third party or enter into a royalty agreement with LEAD to obtain the proper license. For these special licensing situations, see the notes below accompanying the specific file.
Note: | You may not distribute the header files with your application, and you may not provide software development capabilities in your application.

The following table summarizes the files you must include on your distribution diskettes to support the LEADTOOLS functions. Most files in the table are optional. 32-bit DLLs are listed. These files are referred to as "Redistributables" in the License Agreement.

Please note that LTKRN is required for ALL API applications. For more information on LTKRN and other files for the Main API, refer to Files To Be Included With Your Application .

Redistributables: | Explanation: | If you are using a standard release without Unicode, the files to use are: | If you are using a standard release with Unicode, the files to use are: | If you are using an evaluation release without Unicode, the files to use are: | If you are using an evaluation release with Unicode, the files to use are:
LTTLB | LEADTOOLS Toolbar. The header file is LTTLB.H. | DLL: LTTLB14N.DLL Library: LTTLB_N.LIB | DLL: LTTLB14NU.DLL Library: LTTLB_NU.LIB | DLL: LTTLB14E.DLL Library: LTTLB_E.LIB | DLL: LTTLB14EU.DLL Library: LTTLB_EU.LIB


Installation Directory

The installation procedure creates a directory tree for the LEADTOOLS files, and adds the demonstration programs and online help to your desktop. You specify the root directory during installation.

Please note that due to the large size of the PDF files that contain the LEADTOOLS manuals, these files are no longer included in the setup. Instead, these PDF files can be downloaded from our website at http://support.leadtools.com/SupportPortal/DesktopDefault.aspx?tabindex=3&tabid=27.

The following is a list of the subdirectories in the root directory:

ACROBAT | LEADTOOLS manuals in the PDF format, which you can view and print using Adobe Acrobat. These files are optional and are available when installing from the CD-ROM.
BIN | Executable files for the demonstration programs.
HELP | Online help files.
IMAGES | Sample images and databases containing images.
EXAMPLES\DLL | One subdirectory for each example API program.
EXAMPLES\OCX | One subdirectory for each example ActiveX program.
EXAMPLES\COM | One subdirectory for each example COM program.
EXAMPLES\CLASSLIB | One subdirectory for each example Class Library program.
EXAMPLES\RES | Resource files for the example programs.
INCLUDE | Header files, BAS files, and the ActiveX's MFC interface files for versions of Visual C++ earlier than 4.0.
INCLUDE\CLASSLIB | Header files for the Class Library
LIB | Library files.
REDIST | Redistributable files. These are copies of the LEADTOOLS files and other files that you may need to distribute with your application. For exact information about required files, refer to Files To Be Included With Your Application.


Technical Support

As a registered user, free technical support is available. You must register your software to receive any technical support. Technical support is available 9 a.m. through 6 p.m. Eastern Standard Time. If you are calling by phone, please be at your computer. You can also contact us through the following methods:

Phone: | (704) 372-9681
E-mail: | support@leadtools.com
FAX: | (704) 372-8161
Home page: | http://www.leadtools.com
FTP: | ftp.leadtools.com

You can also contact LEAD by mail at:

LEAD Technologies, Inc.
Attn: Technical Support
Suite 400
1201 Greenwood Cliff
Charlotte, NC 28204

Before calling technical support, please look in the online documentation and the example programs for an answer to your question.


Toolbar API Function Groups

Toolbar Functions: Creating Toolbars

Toolbar Functions: Initializing and Freeing

Toolbar Functions: Toolbar Button Information

Toolbar Functions: Toolbar Characteristics

Toolbar Functions: Toolbar Information

Toolbar Functions: Callbacks


Toolbar Functions: Callbacks

L_TBGetCallback

L_TBSetCallback

TOOLBARCALLBACK


Toolbar Functions: Creating Toolbars

L_TBCreate

L_TBInit


Toolbar Functions: Initializing and Freeing

L_TBFree

L_TBInit

L_TBIsValid


Toolbar Functions: Toolbar Button Information

L_TBGetButtonInfo

L_TBSetButtonInfo

L_TBGetButtonChecked

L_TBSetButtonChecked

L_TBIsButtonEnabled

L_TBSetButtonEnabled

L_TBIsButtonVisible

L_TBSetButtonVisible


Toolbar Functions: Toolbar Characteristics

L_TBAddButton

L_TBGetPosition

L_TBGetRows

L_TBIsVisible

L_TBRemoveButton

L_TBSetPosition

L_TBSetRows

L_TBSetVisible


Toolbar Functions: Toolbar Information

L_TBFreeToolbarInfo

L_TBGetToolbarInfo

L_TBSetToolbarInfo


Data Types

Basic Data Types and Keywords

LEADTOOLS Basic Data Types

Keywords Used in Declarations

Toolbar Structures

LBUTTONINFO

TOOLBARHANDLE

LTOOLBARINFO

LTOOLBARTOOL


LEADTOOLS Basic Data Types

LEADTOOLS has defined the following basic data types for portability:

Data Type | Definition and Usage
L_BITFIELD | Defined as L_UINT; used as a bit field.
L_BOOL | Defined as L_UINT; used as a boolean value.
L_CHAR | Defined as char; used as a signed 8-bit integer.
L_DOUBLE | Defined as double; used as a double precision floating point number.
L_FLOAT | Defined as float; used as a floating point number.
L_INT | Defined as int; used as a signed integer, 16-bits or larger.
L_INT16 | Defined as short; used as a signed 16-bit integer.
L_INT32 | Defined as long; used as a signed 32-bit integer.
L_UCHAR | Defined as unsigned char; used as an unsigned 8-bit integer.
L_UINT | Defined as unsigned; used as an unsigned integer, 16-bits or larger.
L_UINT16 | Defined as unsigned short; used as an unsigned 16-bit integer.
L_UINT32 | Defined as unsigned long; used as an unsigned 32-bit integer.
L_VOID | Defined as void; used as a void.
L_COMP | Defined as L_UINT; used as a handle to a computer
L_MEDIA | Defined as L_VOID L_FAR *; used as a void pointer
L_TCHAR | Defined as either char or TCHAR. If FOR_UNICODE is defined, then L_TCHAR will be defined as TCHAR.


Keywords Used in Declarations

LEADTOOLS uses the following keywords in declarations of functions, structures, and datatypes:

Keyword | Definition and Usage
L_FAR | Defined as nothing; used as a placeholder.
L_HUGE | Defined as nothing; used as a placeholder.
L_EXPORT | Defined as nothing; used as a placeholder.
L_PASCAL | Defined as nothing; used as a placeholder.
EXT_FUNCTION | Defined as WINAPI; used as an attribute for all toolkit functions.
pEXT_FUNCTION | Defined as EXT_FUNCTION L_FAR *; used as an attribute when defining pointers to toolkit functions.
EXT_CALLBACK | Defined as _cdecl L_FAR; used as an attribute for all toolkit callback functions.
pEXT_CALLBACK | Defined as EXT_CALLBACK L_FAR *; used as an attribute when defining pointers to toolkit callback functions.


LBUTTONINFO

typedef struct _LBUTTONINFO
{
L_UINT uStructSize;
L_UINT uID;
L_UCHAR fsState;
HBITMAP hBitmap;
L_TCHAR szToolTipText [ TOOLBAR_TOOLTIP_MAX_TEXT ];
L_UINT32 dwTag;

} LBUTTONINFO, L_FAR *pLBUTTONINFO;

Contains information about a button associated with a tool in a toolbar.

Member | Description
uStructSize | Size of this structure.
uID | Command identifier associated with the button. This identifier will be used in the user specified callback to identify the button that initiated the call.
fsState | Button state flags. This member can be a combination of the values listed below:
 | Value | Meaning
 | TBSTATE_ENABLED | The button accepts user input
 | TBSTATE_HIDDEN | The button is not visible and cannot receive user input.
 | TBSTATE_PRESSED | The button is being clicked.
hBitmap | A DDB (device dependent bitmap) that will represent the Cold (enabled) bitmap of the button. The toolbar will automatically create the hot and the disabled bitmaps.
szToolTipText | A null terminated array of characters that will become the button tool tip. The maximum length of this string is TOOLBAR_TOOLTIP_MAX_TEXT.
dwTag | User defined data associated with the button information.

Comments

A toolbar is made up of one or more tools. The LTOOLBARINFO structure contains information about the toolbar in general. Information about each tool that makes up the toolbar is contained in an LTOOLBARINFO structure. Each tool in a toolbar may have one or more buttons associated with it. A tool with more than one button associated with it is said to be a sub-toolbar. Information about the button(s) associated with a tool in the toolbar is contained in one or more LBUTTONINFO structures.

Buttons on a toolbar may have the same ID number without the toolkit complaining. If a function is called that uses a button ID, such as L_TBAddButton, then the toolkit function will act on the first button found with the specified ID.


LTOOLBARINFO

typedef struct _LTOOLBARINFO
{
L_UINT uStructSize;
L_INT cxBitmapWidth;
L_INT cyBitmapHeight;
L_UINT uToolsCount;
pLTOOLBARTOOL pTools;
L_UINT32 dwTag;

} LTOOLBARINFO, L_FAR *pLTOOLBARINFO;

Contains the information that will be used to create the toolbar.

Member | Description
uStructSize | Size of this structure.
cxBitmapWidth | The width of the bitmaps that will be used in the buttons of this toolbar.
cyBitmapHeight | The Height of the bitmaps that will be used in the buttons of this toolbar.
uToolsCount | The number of the tool buttons in the toolbar.
pTools | An array of LTOOLBARTOOL structures that will be used to create this toolbar.
dwTag | User defined data associated with the toolbar information.

Comments

A toolbar is made up of one or more tools. This structure contains information about the toolbar in general. Information about each tool that makes up the toolbar is contained in an LTOOLBARTOOL structure. Each tool in a toolbar may have one or more buttons associated with it. A tool with more than one button associated with it is said to be a sub-toolbar. Information about the button(s) associated with a tool in the toolbar is contained in one or more LBUTTONINFO structures.

The uToolsCount member represents the number of primary buttons in the toolbar.


LTOOLBARTOOL

typedef struct _LTOOLBARTOOL
{
L_UINT uStructSize;
L_UINT uButtonsCount;
pLBUTTONINFO pButtons;
L_UINT32 dwTag;

} LTOOLBARTOOL, L_FAR *pLTOOLBARTOOL;

The LTOOLBARTOOL structure contains information about a tool in the toolbar. This tool may be associated with one or more buttons (sub toolbar).

Member | Description
uStructSize | The size of this structure.
uButtonsCount | Number of buttons associated with the tool. For most tools this will be 1. If a tool represents a sub-toolbar, then this value is the number of buttons associated with the tool.
pButtons | Address of an array of LBUTTONINFO structures that contain information about the button(s) associated with this tool.
dwTag | User defined data associated with the tool information.

Comments

A toolbar is made up of one or more tools. The LBUTTONINFO structure contains information about the toolbar in general. Information about each tool that makes up the toolbar is contained in an LTOOLBARTOOL structure. Each tool in a toolbar may have one or more buttons associated with it. A tool with more than one button associated with it is said to be a sub-toolbar. Information about the button(s) associated with a tool in the toolbar is contained in one or more LBUTTONINFO structures.


TOOLBARHANDLE

The TOOLBARHANDLE structure serves as a working area for the toolbar functions. The user can initialize the toolbar handle at the start of a program and save it in a variable. The toolbar handle can then be used with any LEAD toolbar function. When the toolbar handle is no longer needed, the user can free it. Therefore, the user doesn’t have to initialize the toolbar handle and free it every time it is used.


Return Codes

For a list of all possible return codes for LEADTOOLS Toolbar API functions, refer to LEADTOOLS API Return Codes in the Main API help file.


Toolbar Tutorials

Implementing Toolbars - Initializing, Creating and Freeing

Changing the Toolbar State

Changing the Toollbar Button State

Receiving Toolbar Events


Implementing Toolbars - Initializing, Creating and Freeing

The following tutorials are designed to guide you, step by step through creating toolbars, setting toolbar and button characteristics and receiving event notifications. These tutorials were developed using a Visual C++ version 4.2 compiler and they are designed for the WIN32 API platform.

Take the following steps to start a project and add some code that will create a new toolbar handle:

1. | Start Visual C++, version 4.2.
2. | Select the File->New menu option, and in the dialog box, select Project Workspace.
3. | In the New Project Workspace dialog box, enter the location (c:\lead\examples\toolbar). Make sure to select Application (Win32 Application) as the project type. Give the project the name "tutorial" and press Enter.
4. | Select the File->New menu option, and in the dialog box, select Text File and press Enter.
5. | Copy and paste the following code into the text file you have just created:

#include <windows.h>
#include <windowsx.h>
#include "l_bitmap.h"
#include "lttlb.h"

static LRESULT WINAPI WndProc ( HWND hWnd, L_UINT uMessage, WPARAM wParam, LPARAM lParam )
{
static HWND hwndMain ;
static pTOOLBARHANDLE pToolbar ;

switch( uMessage )
{
case WM_CREATE:
if ( SUCCESS == L_TBInit ( &pToolbar ) )
{
POINT pt = { 0, 0 } ;

hwndMain = hWnd ;

// Create the toolbar
L_TBCreate ( pToolbar, hWnd, TEXT("LEAD Toolbar"), TOOLBAR_PAINT ) ;

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

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

// Show the toolbar
L_TBSetVisible ( pToolbar, TRUE ) ;

return 0L ;
}
else
{
return -1L ;
}

case WM_DESTROY:
if ( SUCCESS == L_TBIsValid ( pToolbar ) )
{
L_TBFree ( pToolbar ) ;
}

PostQuitMessage( 0 ) ;
return 0L ;

default:
break ;
}

return DefWindowProc ( hWnd, uMessage, wParam, lParam ) ;
}

L_INT WINAPI WinMain ( HINSTANCE hInst, HINSTANCE hInstPrev, LPSTR pCmdLine, L_INT nCmdShow )
{
const L_TCHAR szClassName [ ] = TEXT("lead_toolbar_tutorial") ;
WNDCLASSEX WndClass ;
HWND hWnd ;
MSG Msg ;

UNREFERENCED_PARAMETER ( hInstPrev ) ;
UNREFERENCED_PARAMETER ( pCmdLine ) ;

// unlock lead file formats support
UNLOCKSUPPORT ( ) ;

WndClass.cbSize = sizeof ( WNDCLASSEX ) ;
WndClass.style = CS_HREDRAW | CS_VREDRAW ;
WndClass.lpfnWndProc = WndProc ;
WndClass.cbClsExtra = 0 ;
WndClass.cbWndExtra = 0 ;
WndClass.hInstance = hInst ;
WndClass.hIcon = LoadIcon ( NULL, IDI_APPLICATION ) ;
WndClass.hCursor = LoadCursor ( NULL, IDC_ARROW ) ;
WndClass.hbrBackground = ( HBRUSH ) ( COLOR_WINDOW + 1 ) ;
WndClass.lpszMenuName = NULL ;
WndClass.lpszClassName = szClassName ;
WndClass.hIconSm = NULL ;

RegisterClassEx ( &WndClass ) ;

hWnd = CreateWindowEx( 0L,
szClassName,
TEXT("Toolbar Tutorial"),
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
0,
CW_USEDEFAULT,
0,
NULL,
NULL,
hInst,
NULL ) ;

ShowWindow ( hWnd, nCmdShow ) ;
UpdateWindow ( hWnd ) ;

while ( GetMessage ( &Msg, NULL, 0, 0 ) != 0 )
{
TranslateMessage ( &Msg ) ;
DispatchMessage ( &Msg ) ;
}

UnregisterClass ( szClassName, hInst ) ;

return Msg.wParam ;
}

6. | Select File->Save from the menu and give the text file the name "tlbtut.c".
7. | Select Insert->Files into Project from the menu. In the dialog box that appears, browse to the tlbtut.c file you have just created, select it and click Add.
8. | Select Insert->Files into Project from the menu. In the dialog box that appears, browse to c:\lead\lib\ltkrn_n.lib, select it and click Add. Please note that "c:\lead" represents the directory where the LEADTOOLS 14 Toolkit was installed.
9. | Select Insert->Files into Project from the menu. In the dialog box that appears, browse to c:\lead\lib\lttlb_n.lib, select it and click Add.
10. | Compile and run the project by selecting Build->Execute tutorial.exe from the menu.


Changing the Toolbar State

Start with the project you created in Implementing Toolbars - Initializing, Creating and Freeing.

1. | Select the File->New menu option, and in the dialog box, select Resource Script and press Enter.
2. | Right click the script you just created. Select Insert and then Menu from the dialog box that appears, then click OK.
3. | Create this Menu structure:

IDR_MENU1

&View
&Toolbar with ID = IDM_VIEW_TOOLBAR

&Rows
&1 with ID = IDM_ROWS_1
&2 with ID = IDM_ROWS_2
&3 with ID = IDM_ROWS_3
&4 with ID = IDM_ROWS_4
&5 with ID = IDM_ROWS_5
&6 with ID = IDM_ROWS_6
&8 with ID = IDM_ROWS_8

&Set Position
Test &1 with ID = IDM_SETPOSITION_TEST1
Test &2 with ID = IDM_SETPOSITION_TEST2
Test &3 with ID = IDM_SETPOSITION_TEST3
Test &4 with ID = IDM_SETPOSITION_TEST4

4. | Select File->Save from the menu, enter Tutorial.rc in the Save As box and click Save.
5. | Select Insert->Files into Project, browse to the Tutorial.rc file just created and click Add.
6. | Add the following line right under #include "c:\lead\include\lttlb.h".

#include "resource.h"

7.

In the WinMain function definition change the line

WndClass.lpszMenuName = NULL;

In the WinMain function to:

WndClass.lpszMenuName = MAKEINTRESOURCE( IDR_MENU1 ) ;

8.

Add the following function calls to the WndProc function definition, after the L_TBSetVisible function call in the WM_CREATE message:

CheckMenuItem ( GetMenu ( hWnd ),
IDM_VIEW_TOOLBAR,
MF_BYCOMMAND | MF_CHECKED ) ;

CheckMenuRadioItem ( GetMenu ( hWnd ),
IDM_ROWS_1,
IDM_ROWS_8,
IDM_ROWS_1,
MF_BYCOMMAND ) ;

CheckMenuRadioItem ( GetMenu ( hWnd ),
IDM_SETPOSITION_TEST1,
IDM_SETPOSITION_TEST4,
IDM_SETPOSITION_TEST1,
MF_BYCOMMAND ) ;

9.

Add the following functions before the WndProc function definition:

static L_VOID OnViewToolbar ( pTOOLBARHANDLE pToolbar
 )
{
L_BOOL bVisible ;

L_TBIsVisible
 ( pToolbar, &bVisible ) ;

L_TBSetVisible
 ( pToolbar, ! bVisible ) ;
}

static L_VOID OnRows ( pTOOLBARHANDLE pToolbar, L_INT nRows )
{
L_TBSetRows
 ( pToolbar, nRows ) ;
}

static L_VOID OnSetPoistionTest ( HWND hWnd, pTOOLBARHANDLE pToolbar, L_INT
 nTest )
{
RECT rcClient ;
POINT pt ;

GetClientRect ( hWnd, &rcClient ) ;

switch ( nTest )
{
case 1:

pt.x = rcClient.left
 ;
pt.y = rcClient.top
 ;

ClientToScreen (
 hWnd, &pt ) ;

L_TBSetPosition
 ( pToolbar, &pt, TOOLBAR_POSITION_TOP | TOOLBAR_POSITION_LEFT ) ;

break ;

case 2:

pt.x = rcClient.right
 ;
pt.y = rcClient.top
 ;

ClientToScreen (
 hWnd, &pt ) ;

L_TBSetPosition
 ( pToolbar, &pt, TOOLBAR_POSITION_TOP | TOOLBAR_POSITION_RIGHT ) ;

break ;

case 3:

pt.x = rcClient.right
 ;
pt.y = rcClient.bottom
 ;

ClientToScreen (
 hWnd, &pt ) ;

L_TBSetPosition
 ( pToolbar, &pt, TOOLBAR_POSITION_BOTTOM | TOOLBAR_POSITION_RIGHT
 ) ;

break ;

case 4:

pt.x = rcClient.left
 ;
pt.y = rcClient.bottom
 ;

ClientToScreen (
 hWnd, &pt ) ;

L_TBSetPosition
 (pToolbar, &pt, TOOLBAR_POSITION_BOTTOM | TOOLBAR_POSITION_LEFT);

break ;
}
}

10.

Add the following variable declaration in the WndProc function after "static pTOOLBARHANDLE pToolbar ;" declaration:

L_BOOL fState ;

11.

Add the following code to the WndProc function definition after the "return 0L ;" statement in the case WM_DESTROY message:

case WM_COMMAND:
{
switch ( LOWORD ( wParam ) )
{
case IDM_VIEW_TOOLBAR:

OnViewToolbar ( pToolbar ) ;

L_TBIsVisible ( pToolbar, &fState ) ;

CheckMenuItem ( GetMenu ( hWnd ),
IDM_VIEW_TOOLBAR,
MF_BYCOMMAND | ( fState ? MF_CHECKED : MF_UNCHECKED ) ) ;
return 0L ;

case IDM_ROWS_1:
OnRows ( pToolbar, 1 ) ;

CheckMenuRadioItem ( GetMenu ( hWnd ),
IDM_ROWS_1,
IDM_ROWS_8,
IDM_ROWS_1,
MF_BYCOMMAND ) ;
return 0L ;

case IDM_ROWS_2:
OnRows ( pToolbar, 2 ) ;

CheckMenuRadioItem ( GetMenu ( hWnd ),
IDM_ROWS_1,
IDM_ROWS_8,
IDM_ROWS_2,
MF_BYCOMMAND ) ;
return 0L ;

case IDM_ROWS_3:
OnRows ( pToolbar, 3 ) ;

CheckMenuRadioItem ( GetMenu ( hWnd ),
IDM_ROWS_1,
IDM_ROWS_8,
IDM_ROWS_3,
MF_BYCOMMAND ) ;
return 0L ;

case IDM_ROWS_4:
OnRows ( pToolbar, 4 ) ;

CheckMenuRadioItem ( GetMenu ( hWnd ),
IDM_ROWS_1,
IDM_ROWS_8,
IDM_ROWS_4,
MF_BYCOMMAND ) ;
return 0L ;

case IDM_ROWS_5:
OnRows ( pToolbar, 5 ) ;

CheckMenuRadioItem ( GetMenu ( hWnd ),
IDM_ROWS_1,
IDM_ROWS_8,
IDM_ROWS_5,
MF_BYCOMMAND ) ;
return 0L ;

case IDM_ROWS_6:
OnRows ( pToolbar, 6 ) ;

CheckMenuRadioItem ( GetMenu ( hWnd ),
IDM_ROWS_1,
IDM_ROWS_8,
IDM_ROWS_6,
MF_BYCOMMAND ) ;
return 0L ;

case IDM_ROWS_8:
OnRows ( pToolbar, 7 ) ;

CheckMenuRadioItem ( GetMenu ( hWnd ),
IDM_ROWS_1,
IDM_ROWS_8,
IDM_ROWS_8,
MF_BYCOMMAND ) ;
return 0L ;

case IDM_SETPOSITION_TEST1:

OnSetPoistionTest ( hWnd, pToolbar, 1 ) ;

CheckMenuRadioItem ( GetMenu ( hWnd ),
IDM_SETPOSITION_TEST1,
IDM_SETPOSITION_TEST4,
IDM_SETPOSITION_TEST1,
MF_BYCOMMAND ) ;

return 0L ;

case IDM_SETPOSITION_TEST2:

OnSetPoistionTest ( hWnd, pToolbar, 2 ) ;

CheckMenuRadioItem ( GetMenu ( hWnd ),
IDM_SETPOSITION_TEST1,
IDM_SETPOSITION_TEST4,
IDM_SETPOSITION_TEST2,
MF_BYCOMMAND ) ;
return 0L ;

case IDM_SETPOSITION_TEST3:

OnSetPoistionTest ( hWnd, pToolbar, 3 ) ;

CheckMenuRadioItem ( GetMenu ( hWnd ),
IDM_SETPOSITION_TEST1,
IDM_SETPOSITION_TEST4,
IDM_SETPOSITION_TEST3,
MF_BYCOMMAND ) ;
return 0L ;

case IDM_SETPOSITION_TEST4:

OnSetPoistionTest ( hWnd, pToolbar, 4 ) ;

CheckMenuRadioItem ( GetMenu ( hWnd ),
IDM_SETPOSITION_TEST1,
IDM_SETPOSITION_TEST4,
IDM_SETPOSITION_TEST4,
MF_BYCOMMAND ) ;
return 0L ;
}
}

break ;

12.

Compile and run the project by selecting Build->Execute tutorial.exe from the menu.


Changing the Toolbar Button State

Start with the project you created in Changing the Toolbar State

1.

Add the following popup menu to the main menu created in Changing the Toolbar State:

&Check Button
&Brush with ID = IDM_CHECKBUTTON_BRUSH
&Shape Polygon with ID = IDM_CHECKBUTTON_SHAPE_POLYGON
&Fill Color with ID = IDM_CHECKBUTTON_FILL_COLORREPLACE
&Mover with ID = IDM_CHECKBUTTON_MOVER

&Disable Button
&Brush with ID = IDM_DISABLEBUTTON_BRUSH
&Shape Polygon with ID = IDM_DISABLEBUTTON_SHAPE_POLYGON
&Fill Color with ID = IDM_DISABLEBUTTON_FILL_COLORREPLACE
&Mover with ID = IDM_DISABLEBUTTON_MOVER

&Hide Button
&Brush with ID = IDM_HIDEBUTTON_BRUSH
&Shape Polygon with ID = IDM_HIDEBUTTON_SHAPE_POLYGON
&Fill Color with ID = IDM_HIDEBUTTON_FILL_COLORREPLACE
&Mover with ID = IDM_HIDEBUTTON_MOVER

2.

Add the following code to the WndProc after "return 0L;" statement of the case IDM_SETPOSITION_TEST4 in the WM_COMMAND message:

case IDM_CHECKBUTTON_BRUSH:
L_TBSetButtonChecked ( pToolbar, ID_TOOL_PAINT_BRUSH ) ;
break ;

case IDM_CHECKBUTTON_SHAPE_POLYGON:
L_TBSetButtonChecked ( pToolbar, ID_TOOL_PAINT_SHAPE_POLYGON ) ;
break ;

case IDM_CHECKBUTTON_FILL_COLORREPLACE:
L_TBSetButtonChecked ( pToolbar, ID_TOOL_PAINT_FILL_COLORREPLACE ) ;
break ;

case IDM_CHECKBUTTON_MOVER:
L_TBSetButtonChecked ( pToolbar, ID_TOOL_PAINT_MOVER ) ;
break ;

case IDM_DISABLEBUTTON_BRUSH:
L_TBIsButtonEnabled ( pToolbar, ID_TOOL_PAINT_BRUSH, &fState ) ;

L_TBSetButtonEnabled ( pToolbar, ID_TOOL_PAINT_BRUSH, ! fState ) ;

CheckMenuItem ( GetMenu ( hWnd ),
IDM_DISABLEBUTTON_BRUSH,
MF_BYCOMMAND | ( fState ? MF_CHECKED : MF_UNCHECKED ) ) ;
break ;

case IDM_DISABLEBUTTON_SHAPE_POLYGON:
L_TBIsButtonEnabled ( pToolbar, ID_TOOL_PAINT_SHAPE_POLYGON, &fState ) ;

L_TBSetButtonEnabled ( pToolbar, ID_TOOL_PAINT_SHAPE_POLYGON, ! fState ) ;

CheckMenuItem ( GetMenu ( hWnd ),
IDM_DISABLEBUTTON_SHAPE_POLYGON,
MF_BYCOMMAND | ( fState ? MF_CHECKED : MF_UNCHECKED ) ) ;

break ;

case IDM_DISABLEBUTTON_FILL_COLORREPLACE:
L_TBIsButtonEnabled ( pToolbar, ID_TOOL_PAINT_FILL_COLORREPLACE, &fState ) ;

L_TBSetButtonEnabled ( pToolbar, ID_TOOL_PAINT_FILL_COLORREPLACE, ! fState ) ;

CheckMenuItem ( GetMenu ( hWnd ),
IDM_DISABLEBUTTON_FILL_COLORREPLACE,
MF_BYCOMMAND | ( fState ? MF_CHECKED : MF_UNCHECKED ) ) ;
break ;

case IDM_DISABLEBUTTON_MOVER:
L_TBIsButtonEnabled ( pToolbar, ID_TOOL_PAINT_MOVER, &fState ) ;

L_TBSetButtonEnabled ( pToolbar, ID_TOOL_PAINT_MOVER, ! fState ) ;

CheckMenuItem ( GetMenu ( hWnd ),
IDM_DISABLEBUTTON_MOVER,
MF_BYCOMMAND | ( fState ? MF_CHECKED : MF_UNCHECKED ) ) ;
break ;

case IDM_HIDEBUTTON_BRUSH:
L_TBIsButtonVisible ( pToolbar, ID_TOOL_PAINT_BRUSH, &fState ) ;

L_TBSetButtonVisible ( pToolbar, ID_TOOL_PAINT_BRUSH, ! fState ) ;

CheckMenuItem ( GetMenu ( hWnd ),
IDM_HIDEBUTTON_BRUSH,
MF_BYCOMMAND | ( fState ? MF_CHECKED : MF_UNCHECKED ) ) ;

EnableMenuItem ( GetMenu ( hWnd ),
IDM_DISABLEBUTTON_BRUSH,
MF_BYCOMMAND | ( fState ? MF_GRAYED : MF_ENABLED ) ) ;
break ;

case IDM_HIDEBUTTON_SHAPE_POLYGON:
L_TBIsButtonVisible ( pToolbar, ID_TOOL_PAINT_SHAPE_POLYGON, &fState ) ;

L_TBSetButtonVisible ( pToolbar, ID_TOOL_PAINT_SHAPE_POLYGON, ! fState ) ;

CheckMenuItem ( GetMenu ( hWnd ),
IDM_HIDEBUTTON_SHAPE_POLYGON,
MF_BYCOMMAND | ( fState ? MF_CHECKED : MF_UNCHECKED ) ) ;

EnableMenuItem ( GetMenu ( hWnd ),
IDM_DISABLEBUTTON_SHAPE_POLYGON,
MF_BYCOMMAND | ( fState ? MF_GRAYED : MF_ENABLED ) ) ;
break ;

case IDM_HIDEBUTTON_FILL_COLORREPLACE:
L_TBIsButtonVisible ( pToolbar, ID_TOOL_PAINT_FILL_COLORREPLACE, &fState ) ;

L_TBSetButtonVisible ( pToolbar, ID_TOOL_PAINT_FILL_COLORREPLACE, ! fState ) ;

CheckMenuItem ( GetMenu ( hWnd ),
IDM_HIDEBUTTON_FILL_COLORREPLACE,
MF_BYCOMMAND | ( fState ? MF_CHECKED : MF_UNCHECKED ) ) ;

EnableMenuItem ( GetMenu ( hWnd ),
IDM_DISABLEBUTTON_FILL_COLORREPLACE,
MF_BYCOMMAND | ( fState ? MF_GRAYED : MF_ENABLED ) ) ;

break ;

case IDM_HIDEBUTTON_MOVER:
L_TBIsButtonVisible ( pToolbar, ID_TOOL_PAINT_MOVER, &fState ) ;

L_TBSetButtonVisible ( pToolbar, ID_TOOL_PAINT_MOVER, ! fState ) ;

CheckMenuItem ( GetMenu ( hWnd ),
IDM_HIDEBUTTON_MOVER,
MF_BYCOMMAND | ( fState ? MF_CHECKED : MF_UNCHECKED ) ) ;

EnableMenuItem ( GetMenu ( hWnd ),
IDM_DISABLEBUTTON_MOVER,
MF_BYCOMMAND | ( fState ? MF_GRAYED : MF_ENABLED ) ) ;
break ;

3.

Compile and run the project by selecting Build->Execute tutorial.exe from the menu.


Receiving Toolbar Events

Start with the project you created in Changing the Toolbar button State

1.

Add the following callback function before the WndProc function definition:

L_INT EXT_CALLBACK LeadToolbarProc
(
pTOOLBARHANDLE pToolbar,
L_UINT nButtonID,
L_UINT32 dwData,
L_VOID L_FAR *pUserData
)
{
switch ( nButtonID )
{
case ID_TOOL_PAINT_BRUSH:
{
MessageBox ( * ( HWND * ) pUserData, TEXT("BRUSH"), TEXT("Toolbar Message"), MB_OK ) ;
}

break ;

case ID_TOOL_PAINT_SHAPE_LINE:
{
MessageBox ( * ( HWND * ) pUserData, TEXT("LINE"), TEXT("Toolbar Message"), MB_OK ) ;
}

break ;

case ID_TOOL_PAINT_SHAPE_RECT:
{
MessageBox ( * ( HWND * ) pUserData, TEXT("RECT"), TEXT("Toolbar Message"), MB_OK ) ;
}

break ;

case ID_TOOL_PAINT_SHAPE_ROUNDRECT:
{
MessageBox ( * ( HWND * ) pUserData, TEXT("ROUND RECT"), TEXT("Toolbar Message"), MB_OK ) ;
}

break ;

case ID_TOOL_PAINT_SHAPE_BEZIER:
{
MessageBox ( * ( HWND * ) pUserData, TEXT("BEZIER"), TEXT("Toolbar Message"), MB_OK ) ;
}

break ;

case ID_TOOL_PAINT_REGION_RECT:
{
MessageBox ( * ( HWND * ) pUserData, TEXT("RECT"), TEXT("Toolbar Message"), MB_OK ) ;
}

break ;

case ID_TOOL_PAINT_FILL_SURFACE:
{
MessageBox ( * ( HWND * ) pUserData, TEXT("SURFACE"), TEXT("Toolbar Message"), MB_OK ) ;
}

break ;

case ID_TOOL_PAINT_TEXT:
{
MessageBox ( * ( HWND * ) pUserData, TEXT("TEXT"), TEXT("Toolbar Message"), MB_OK ) ;
}

break ;
}

return SUCCESS ;
}

2.

Add the following function call to the WndProc function after the L_TBSetVisible function call in the WM_CREATE message:

// Set the toolbar callback with the owner window as the user defind data
L_TBSetCallback ( pToolbar, LeadToolbarProc, ( L_VOID L_FAR * ) &hwndMain ) ;

3.

Compile and run the project by selecting Build->Execute tutorial.exe from the menu.


L_TBAddButton

#include "ltTLB.h"

L_INT EXT_FUNCTION L_TBAddButton( pToolbar, uButtonRefId, pButtonInfo, dwFlags )

pTOOLBARHANDLE pToolbar; | /* pointer to a toolbar handle */
L_UINT uButtonRefId; | /* button ID */
Const pLBUTTONINFO pButtonInfo; | /* pointer to a structure */
L_UINT32 dwFlags; | /* flags */

Adds a new button to the toolbar.

Parameter | Description
pToolbar | Pointer to a toolbar handle that references the toolbar to which to add the button.
uButtonRefId | Reference to use for positioning new button inside the toolbar.
pButtonInfo | Point to a LBUTTONINFO structure containing data for the new button.
dwFlags | Flag that indicates where to add the new button, with respect to the button specified in uButtonRefId. Possible values are:
 | Flag | Meaning
 | TOOLBAR_ADD_BEFORE | Add this button before the button specified by uButtonRefId in the toolbar.
 | TOOLBAR_ADD_AFTER | Add this button after the button specified by uButtonRefId in the toolbar.
 | TOOLBAR_ADD_TOOL | If this flag is specified, the toolkit will create a new tool and make this button the first button of the new tool.
 | If this flag is not specified, the toolkit will add the new button to the same tool as uButtonRefId.
 | Note, if the toolbar contains no buttons, both uButtonRefId and dwFlags will be ignored and the new tool and button will be added to the toolbar.

Comments

As an example, if dwFlags is set to TOOLBAR_ADD_BEFORE | TOOLBAR_ADD_TOOL, then a new tool will be added before the button specified by uButtonRefId. If dwFlags is set to TOOLBAR_ADD_BEFORE, then the new button will be added before the button specified by uButtonRefId and it will become part of the same tool as the button specified by uButtonRefId.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes

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_TBRemoveButton, L_TBGetButtonInfo, L_TBSetButtonInfo, L_TBGetToolbarInfo, L_TBSetToolbarInfo
Topics: | Getting and Setting Toolbar Button Information

Example

/*This example will create a new toolbar and add 2 tools with 2 buttons each.*/

#include "commctrl.h"
.
.
void CreateMyToolbar( HWND hWndParent, ppTOOLBARHANDLE ppToolbar )
{
/* assume these resource IDs contain valid bitmaps */
const L_INT nResId[ 4 ] = { IDB_BITMAP1, IDB_BITMAP2, IDB_BITMAP3, IDB_BITMAP4 };
const L_TCHAR *szToolTipText[ 4 ] = { TEXT("Button 1"), TEXT("Button 2"), TEXT("Button 3"), TEXT("Button 4") };
LBUTTONINFO ButtonInfo;
L_INT i;
L_UINT uRefId;
L_UINT32 dwFlags;

L_TBInit ( ppToolbar );
L_TBCreate ( *ppToolbar, hWndParent, "Toolbar", TOOLBAR_EMPTY );

uRefId = 0; /* we dont need a reference button when adding the first one */

for( i = 0; i < 4; i++ )
{
ButtonInfo.uID = i + 1;
ButtonInfo.hBitmap = LoadBitmap( (HINSTANCE) GetWindowLong( hWndParent, GWL_HINSTANCE ),
MAKEINTRESOURCE( nResId[ i ] ) );
lstrcpy( ButtonInfo.szToolTipText, szToolTipText[ i ] );
ButtonInfo.dwTag = 0L;
ButtonInfo.fsState = TBSTATE_ENABLED;

dwFlags = TOOLBAR_ADD_AFTER;
if( i == 0 || i == 2 )
dwFlags |= TOOLBAR_ADD_TOOL;

L_TBAddButton( *ppToolbar, uRefId, &ButtonInfo, dwFlags );

DeleteObject( ButtonInfo.hBitmap ); /* the toolbar toolkit keeps its own copy */

uRefId = ButtonInfo.uID; /* save last button ID */
}
}


L_TBCreate

#include "LtTLB.h"

L_INT EXT_FUNCTION L_TBCreate(pToolbar, hwndParent, szTitle, dwFlags )

pTOOLBARHANDLE pToolbar; | /* pointer to a toolbar handle */
HWND hwndParent; | /* window handle */
L_TCHAR L_FAR* szTitle; | /* window title string */
L_UINT32 dwFlags; | /* flag that indicates the toolbar type */

Creates a toolbar.

Parameter | Description
pToolbar | Pointer to a toolbar handle. This toolbar handle should be initialized before calling this function.
hwndParent | Window handle to the toolbar's parent window.
szTitle | Character string that contains the title for the toolbar window. This is a NULL terminated string.
dwFlags | Flags that will indicate the type of the toolbar to be created. Possible values are:
 | Value | Meaning
 | TOOLBAR_PAINT | Creates a digital painting toolkit toolbar.
 | TOOLBAR_VECTOR | Creates a vector toolkit toolbar.
 | TOOLBAR_EMPTY | Create an empty toolbar.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes

Comments

L_TBInit must be called before calling this function.

The toolbar is created as a child window to the window specified in hwndParent.

Note:

Vector and Paint toolbars are Automation toolbars. When using the Automation API in addition to the Toolbar API, these toolbars automatically handle the buttons and the necessary function calls. If automation is not used, then it is the user's responsibility to create buttons, assign ID numbers, process the events and handle all necessary function calls.

The paint toolbar contains the following buttons:

Description | Button ID
Paintbrush tool | ID_TOOL_PAINT_BRUSH
Line shape tool | ID_TOOL_PAINT_SHAPE_LINE
Rectangle shape tool | ID_TOOL_PAINT_SHAPE_RECT
Rounded rectangle shape tool | ID_TOOL_PAINT_SHAPE_ROUNDRECT
Ellipse shape tool | ID_TOOL_PAINT_SHAPE_ELLIPSE
Polygon shape tool | ID_TOOL_PAINT_SHAPE_POLYGON
Bezier shape tool | ID_TOOL_PAINT_SHAPE_BEZIER
Region rectangle tool | ID_TOOL_PAINT_REGION_RECT
Rounded rectangle region too | D_TOOL_PAINT_REGION_ROUNDRECT
Ellipse region tool | ID_TOOL_PAINT_REGION_ELLIPSE
Polygon region tool | ID_TOOL_PAINT_REGION_POLYGON
Surface region tool | ID_TOOL_PAINT_REGION_SURFACE
Border region tool | ID_TOOL_PAINT_REGION_BORDER
Color region tool | ID_TOOL_PAINT_REGION_COLOR
Surface fill tool | ID_TOOL_PAINT_FILL_SURFACE
Border fill tool | ID_TOOL_PAINT_FILL_BORDER
Color replace tool | ID_TOOL_PAINT_FILL_COLORREPLACE
Text tool | ID_TOOL_PAINT_TEXT
Zoom tool | ID_TOOL_PAINT_ZOOM
Border color picker tool | ID_TOOL_PAINT_BORDERCOLORPICKER
Mover tool | ID_TOOL_PAINT_MOVER

The vector toolbar contains the following buttons:

Neutral (No tool selected) | ID_TOOL_VECTOR_NONE
Select object(s) | ID_TOOL_VECTOR_SELECT
Vertex | ID_TOOL_VECTOR_VERTEX
Line | ID_TOOL_VECTOR_LINE
Rectangle | ID_TOOL_VECTOR_RECTANGLE
Polyline | ID_TOOL_VECTOR_POLYLINE
Polybezier | ID_TOOL_VECTOR_POLYBEZIER
Polygon | ID_TOOL_VECTOR_POLYGON
Ellipse | ID_TOOL_VECTOR_ELLIPSE
Circle | ID_TOOL_VECTOR_CIRCLE
Arc | ID_TOOL_VECTOR_ARC
Text | ID_TOOL_VECTOR_TEXT
Pie | ID_TOOL_VECTOR_PIE
Chord | ID_TOOL_VECTOR_CHORD
Raster | ID_TOOL_VECTOR_RASTER
Rotate | ID_TOOL_VECTOR_ROTATE
Pan | ID_TOOL_VECTOR_PAN

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_TBInit, L_TBFree, L_TBIsValid
Topics: | Creating a Toolbar

Example

/* This example will initiate, create a toolbar, set its position and make it visible */

/* Global LEAD toolbar handle */
pTOOLBARHANDLE g_pLeadToolbar ;

L_INT ToolbarTest ( HWND hWnd )
{
/* Initiate the toolbar handle */
L_TBInit ( &g_pLeadToolbar ) ;

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

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

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

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

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

return SUCCESS ;
}


L_TBFree

#include "LtTLB.h"

L_INT EXT_FUNCTION L_TBFree(pToolbar )

pTOOLBARHANDLE pToolbar;

/* pointer to a toolbar handle */

Frees the toolbar handle.

Parameter | Description
pToolbar | Pointer to a toolbar handle.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes

Comments

When the toolbar handle is no longer needed, this function should be called to free it.

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_TBInit, L_TBCreate
Topics: | Initializing and Freeing Toolbars

Example

L_INT FreeToolbar ( pTOOLBARHANDLE pLeadToolbar )
{
if (SUCCESS == L_TBIsValid ( pLeadToolbar ) )
{
L_TBFree ( pLeadToolbar ) ;

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


L_TBFreeToolbarInfo

#include "LtTLB.h"

L_INT EXT_FUNCTION L_TBFreeToolbarInfo (pToolbar, pToolbarInfo )

pTOOLBARHANDLE pToolbar; | /* pointer to a toolbar handle */
pLTOOLBARINFO pToolbarInfo; | /* pointer to structure */

Frees the toolbar information allocated by calling L_TBGetToolbarInfo .

Parameter | Description
pToolbar | Pointer to a toolbar handle.
pToolbarInfo | Pointer to LTOOLBARINFO structure that contains the toolbar information to be freed.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes

Comments

When the toolbar information is no longer needed, it should be freed by calling this function.

To get the current toolbar information, call L_TBGetToolbarInfo.

To change the current toolbar information calls L_TBGetToolbarInfo to get the current toolbar information. Change the information in the LTOOLBARINFO structure. Then call L_TBSetToolbarInfo to set the new toolbar information.

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_TBGetToolbarInfo, L_TBSetToolbarInfo
Topics: | Getting and Setting Toolbar Information

Example

For an example, refer to L_TBGetToolbarInfo.


L_TBGetButtonChecked

#include "LtTLB.h"

L_INT EXT_FUNCTION L_TBGetButtonChecked(pToolbar, pnChecked)

pTOOLBARHANDLE pToolbar; | /* pointer to a toolbar handle */
L_INT * pnChecked; | /* pointer to integer */

Gets the selected (checked) button in the toolbar.

Parameter | Description
pToolbar | Pointer to a toolbar handle.
pnChecked | Pointer to an integer variable to be updated with the identifier of the current selected ( checked ) button.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes

Comments

To set the selected button in the toolbar, call L_TBSetButtonChecked.

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_TBSetButtonChecked
Topics: | Getting and Setting Toolbar Button Information

Example

For short example refer to L_TBSetButtonChecked.


L_TBGetButtonInfo

#include "ltTLB.h"

L_INT EXT_FUNCTION L_TBGetButtonInfo( pToolbar, uButtonId, pButtonInfo, uStructSize)

pTOOLBARHANDLE pToolbar; | /* pointer to a handle */
L_UINT uButtonId; | /* button Id */
pLBUTTONINFO pButtonInfo; | /* pointer to a structure */
L_UINT uStructSize; | /* size in bytes, of the structure pointed to by pButtonInfo */

Gets the information for the specified toolbar button.

Parameter | Description
pToolbar | Pointer to a toolbar handle.
uButtonId | Identifier that indicates the button for which to get the information.
pButtonInfo | Pointer to LBUTTONINFO structure to be updated with the button information.
uStructSize | Size in bytes, of the structure pointed to by pButtonInfo, for versioning. Use sizeof(LBUTTONINFO).

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes

Comments

To change the information on the specified toolbar button, call this function to get the current information. Change the information in pButtonInfo and then call L_TBSetButtonInfo.

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_TBAddButton, L_TBRemoveButton, L_TBSetButtonInfo, L_TBGetToolbarInfo, L_TBSetToolbarInfo.
Topics: | Getting and Setting Toolbar Button Information

Example

/*This example returns a copy of the given button's bitmap image.*/

HBITMAP CreateCopyOfButtonBitmap ( pTOOLBARHANDLE pToolbar, L_UINT uButtonId )
{
LBUTTONINFO ButtonInfo;
HBITMAP hBitmap;

/* get button info */
ButtonInfo.uStructSize = sizeof( LBUTTONINFO );
L_TBGetButtonInfo( pToolbar, uButtonId, &ButtonInfo, sizeof(LBUTTONINFO) );

/* create a copy of the bitmap image */
hBitmap = (HBITMAP) CopyImage( ButtonInfo.hBitmap, IMAGE_BITMAP, 0, 0, 0 );
return hBitmap;
}


L_TBGetCallback

#include "LtTLB.h"

L_INT EXT_FUNCTION L_TBGetCallback (pToolbar, ppCallback, ppUserData )

pTOOLBARHANDLE pToolbar; | /* pointer to a toolbar handle */
pTOOLBARCALLBACK ppCallback; | /* pointer to a pointer to a callback */
L_VOID L_FAR **ppUserData; | /* pointer to a pointer to user defined data */

Returns the current callback function used to notify the user about toolbar events.

Parameter | Description
pToolbar | Pointer to a toolbar handle.
ppCallback | Pointer to the current callback function set by the user. If there is no callback currently set by the user this function will return NULL.
ppUserData | Void pointer to be updated with the value of any user defined data associated with the callback. If you are not interested in the user defined data, pass NULL for this parameter.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes

Comments

To set the callback function used to notify the user of toolbar events, call L_TBSetCallback.

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: | TOOLBARCALLBACK, L_TBSetCallback
Topics: | Receiving Toolbar Events

Example

L_BOOL IsToolbarCallbackInstalled ( pTOOLBARHANDLE pLeadToolbar )
{
if ( L_TBIsValid ( pLeadToolbar ) ) /* check the validity of the toolbar handle */
{
pTOOLBARCALLBACK *pCallback ;

/* get the current toolbar callback */
L_TBGetCallback ( pLeadToolbar, pCallback, NULL ) ;

if ( NULL != pCallback )
{
return TRUE ;
}
else
{
return FALSE ;
}
}
else
{
return FALSE ;
}
}


L_TBGetPosition

#include "LtTLB.h"

L_INT EXT_FUNCTION L_TBGetPosition(pToolbar, lpptPos, dwFlags )

pTOOLBARHANDLE pToolbar; | /* pointer to a toolbar handle */
LPPOINT lpptPos; | /* pointer to a structure */
L_UINT32 dwFlags; | /* position flags */

Gets the toolbar's current position.

Parameter | Description
pToolbar | Pointer to a toolbar handle.
lpptPos | Pointer to a POINT structure to be updated with the toolbar's position. The coordinates are with respect to the screen.
dwFlags | Value indicates which corner of the toolbar to get. One of the following values:
 | Value | Meaning
 | TOOLBAR_POSITION_LEFT | The x coordinate of the specified point is the left of the toolbar.
 | TOOLBAR_POSITION_RIGHT | The x coordinate of the specified point is the right of the toolbar.
 | must be combined using the bitwise OR with one of these values:
 | Value | Meaning
 | TOOLBAR_POSITION_TOP | The y coordinate of the specified point is the top of the toolbar.
 | TOOLBAR_POSITION_BOTTOM | The y coordinate of the specified point is the bottom of the toolbar.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes

Comments

To set the position of the toolbar, call L_TBSetPosition.

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_TBSetPosition.
Topics: | Getting and Setting Toolbar Characterisitcs

Example

L_INT GetToolbarWidth ( pTOOLBARHANDLE pLeadToolbar )
{
if (L_TBIsValid ( pLeadToolbar ) ) /* check the validity of the toolbar handle */
{
POINT ptPos00, ptPos01 ;

/* get the toolbar position */
L_TBGetPosition ( pLeadToolbar, &ptPos00, TOOLBAR_POSITION_LEFT | TOOLBAR_POSITION_TOP ) ;
L_TBGetPosition ( pLeadToolbar, &ptPos01, TOOLBAR_POSITION_RIGHT | TOOLBAR_POSITION_TOP ) ;

return ( ptPos01.x - ptPos00.x ) ;
}
else
{
return -1 ;
}
}


L_TBGetRows

#include "LtTLB.h"

L_INT EXT_FUNCTION L_TBGetRows (pToolbar, pnRows )

pTOOLBARHANDLE pToolbar; | /* pointer to a toolbar handle */
L_INT * pnRows; | /* pointer to a variable */

Gets the current number of rows in the toolbar.

Parameter | Description
pToolbar | Pointer to a toolbar handle.
pnRows | Pointer to an integer variable to be updated with the current number of rows in the toolbar.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes

Comments

To set the number of rows in a toolbar, call L_TBSetRows.

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_TBGetRows.
Topics: | Getting and Setting Toolbar Characterisitcs

Example

For an example, refer to L_TBSetRows.


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 ;
}

}


L_TBInit

#include "LtTLB.h"

L_INT EXT_FUNCTION L_TBInit(ppToolbar )

ppTOOLBARHANDLE ppToolbar;

/* pointer to a pointer to a toolbar handle */

Initializes the toolbar handle.

Parameter | Description
ppToolbar | Pointer to a pointer to the toolbar handle to be initialized.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes

Comments

This function must be called before calling any other toolbar functions.

A toolbar handle will be valid after this function is called. However, L_TBCreate must be called in order to call any other Toolbar functions.

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_TBFree, L_TBCreate
Topics: | Initializing and Freeing Toolbars

Example

For an example, refer to L_TBCreate.


L_TBIsButtonEnabled

#include "LtTLB.h"

L_INT EXT_FUNCTION L_TBIsButtonEnabled (pToolbar, uButtonID, pfEnable);

pTOOLBARHANDLE pToolbar; | /* pointer to a toolbar handle */
L_UINT uButtonID; | /* button ID */
L_BOOL * pfEnable; | /* pointer to a variable */

Determines whether the specified button is enabled for mouse input.

Parameter | Description
pToolbar | Pointer to a toolbar handle.
uButtonID | Identifier of the button for which to retrieve the status.
pfEnable | Pointer to a variable to be updated with a value that indicates whether the specified button is enabled or disabled. Possible values are:
 | Value | Meaning
 | TRUE | The specified button is enabled.
 | FALSE | The specified button is disabled.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes

Comments

To change the enabled status of a button, call L_TBSetButtonEnabled.

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_TBSetButtonEnabled
Topics: | Getting and Setting Toolbar Button Information

Example

For an example, refer to L_TBSetButtonEnabled.


L_TBIsButtonVisible

#include "LtTLB.h"

L_INT EXT_FUNCTION L_TBIsButtonVisible(pToolbar, uButtonID, *pfVisible )

pTOOLBARHANDLE pToolbar; | /* pointer to a toolbar handle */
L_UINT uButtonID; | /* button ID */
L_BOOL * pfVisible; | /* visibility flag */

Determines whether the specified button is visible.

Parameter | Description
pToolbar | Pointer to a toolbar handle.
uButtonID | Identifier of the button for which to retrieve the visibility status.
pfVisible | Pointer to the variable that will receive the visibility status of the button. Possible values are:
 | Value | Meaning
 | TRUE | The specified button is visible.
 | FALSE | The specified button is not visible.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes

Comments

To change the visibility status of a button, call L_TBSetButtonVisible.

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_TBSetButtonVisible
Topics: | Getting and Setting Toolbar Button Information

Example

For an example, refer to L_TBSetButtonVisible.


L_TBIsValid

#include "LtTLB.h"

L_INT EXT_FUNCTION L_TBIsValid(pToolbar )

pTOOLBARHANDLE pToolbar;

/* pointer to a toolbar handle */

Determines the validity of the given toolbar handle.

Parameter | Description
pToolbar | Pointer to a toolbar handle.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes

Comments

The toolbar handle will be valid after calling L_TBInit. However, L_TBCreate must be called before calling any other Toolbar functions.

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_TBInit, L_TBCreate, L_TBFree.
Topics: | Initializing and Freeing Toolbars

Example

For an example, refer to L_TBCreate.


L_TBIsVisible

#include "LtTLB.h"

L_INT EXT_FUNCTION L_TBIsVisible(pToolbar, *pfVisible );

pTOOLBARHANDLE pToolbar; | /* pointer to a toolbar handle */
L_BOOL * pfVisible; | /* visibility flag */

Determines the visibility of the toolbar window.

Parameter | Description
pToolbar | Pointer to a toolbar handle.
pfVisible | Point to a variable to be updated with the visibility status of the toolbar. Possible values are:
 | Value | Meaning
 | TRUE | The specified toolbar is visible.
 | FALSE | The specified toolbar is not visible.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes

Comments

To change the visibility status of the toolbar, call L_TBSetVisible.

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_TBSetVisible.
Topics: | Getting and Setting Toolbar Characterisitcs

Example

/* This function will toggle the toolbar visibility state */

L_INT ToggleToolbar (pTOOLBARHANDLE pLeadToolbar )
{
if (SUCCESS == L_TBIsValid ( pLeadToolbar ) ) /* check the validity of the toolbar handle */
{
L_BOOL fVisible ;

/* Get the visibility state of the toolbar */
L_TBIsVisible ( pLeadToolbar, &fVisible ) ;

if ( fVisible )
{
/* Hide the toolbar */
L_TBIsVisible ( pLeadToolbar, FALSE ) ;
}
else
{
/* Show the toolbar */
L_TBIsVisible ( pLeadToolbar, TRUE ) ;
}

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


L_TBRemoveButton

#include "ltTLB.h"

L_INT EXT_FUNCTION L_TBRemoveButton( pToolbar, uButtonId )

pTOOLBARHANDLE pToolbar; | /* pointer to a toolbar handle */
L_UINT uButtonId; | /* button Id */

Removes a button from the toolbar.

Parameter | Description
pToolbar | Pointer to a toolbar handle.
uButtonId | Button identifier that indicates the button to be removed. Note if this button is the only remaining button in its tool, the whole tool is removed too.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes

Comments

To add a button to a toolbar, call L_TBAddButton.

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_TBAddButton, L_TBGetButtonInfo, L_TBSetButtonInfo, L_TBGetToolbarInfo, L_TBSetToolbarInfo
Topics: | Getting and Setting Toolbar Button Information

Example

/*This example will remove all buttons from a given toolbar.*/

void RemoveAllButtons( pTOOLBARHANDLE pToolbar )
{
LTOOLBARINFO ToolbarInfo;
L_UINT i, j;

/* get toolbar info */
ToolbarInfo.uStructSize = sizeof( LTOOLBARINFO );
L_TBGetToolbarInfo ( pToolbar, &ToolbarInfo, sizeof(LTOOLBARINFO) );

/* iterate through tools */
for( i = 0; i < ToolbarInfo.uToolsCount; i++ )
{
/* remove all buttons of this tool */
for( j = 0; j < ToolbarInfo.pTools[ i ].uButtonsCount; i++ )
L_TBRemoveButton( pToolbar, ToolbarInfo.pTools[ i ].pButtons[ j ].uID );
}

/* free the info structure */
L_TBFreeToolbarInfo ( pToolbar, &ToolbarInfo );
}


L_TBSetButtonChecked

#include "LtTLB.h"

L_INT EXT_FUNCTION L_TBSetButtonChecked (pToolbar, uButtonID )

pTOOLBARHANDLE pToolbar; | /* pointer to a toolbar handle */
L_UINT uButtonID; | /* button ID */

Selects (checks) the given button in the toolbar.

Parameter | Description
pToolbar | Pointer to a toolbar handle.
uButtonID | Identifier of the button to select (check) .

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes

Comments

Only one button may be selected (checked) at a time.

To determine whether a button is selected (checked), call L_TBGetButtonChecked.

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_TBGetButtonChecked
Topics: | Getting and Setting Toolbar Button Information

Example

/* This example will check the current check button in the toolbar
and then if the checked button is not equal the required button, the required button will be checked */

L_INT CheckButtonTest ( pTOOLBARHANDLE pLeadToolbar, L_UINT uButtonID )
{
if (SUCCESS == L_TBIsValid ( pLeadToolbar ) ) /* check the validity of the toolbar handle */
{
L_INT nCheckedID ;

/* Get the current checked button in the toolbar */
L_TBGetButtonChecked ( pLeadToolbar, &nCheckedID ) ;

if ( nCheckedID != ( L_INT ) uButtonID )
{
/* Check the required button */
L_TBSetButtonChecked ( pLeadToolbar, uButtonID ) ;
}

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


L_TBSetButtonEnabled

#include "LtTLB.h"

L_INT EXT_FUNCTION L_TBSetButtonEnabled(pToolbar, uButtonID, fEnable )

pTOOLBARHANDLE pToolbar; | /* pointer to a toolbar handle */
L_UINT uButtonID; | /* button ID */
L_BOOL fEnable; | /* flag */

Enables or disables the specified button in a toolbar.

Parameter | Description
pToolbar | Pointer to a toolbar handle.
uButtonID | Identifier of the button to enable or disable.
fEnable | Flag that indicates whether to enable or disable the specified button. Possible values are:
 | Value | Meaning
 | TRUE | Enable the specified button.
 | FALSE | Disable the specified button.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes

Comments

To determine whether a button is enabled or disabled, call L_TBIsButtonEnabled.

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_TBIsButtonEnabled.
Topics: | Getting and Setting Toolbar Button Information

Example

L_INT ToggleToolbarButton ( pTOOLBARHANDLE pLeadToolbar, L_UINT uButtonID )
{
if (SUCCESS == L_TBIsValid ( pLeadToolbar ) ) /* check the validity of the toolbar handle */
{
L_BOOL fEnabled;

/* Get the state of the toolbar button */
L_TBIsButtonEnabled ( pLeadToolbar, uButtonID, &fEnabled );

if ( fEnabled )
{
/* Disable the button */
L_TBSetButtonEnabled ( pLeadToolbar, uButtonID, FALSE );
}
else
{
/* Enable the button */
L_TBSetButtonEnabled ( pLeadToolbar, uButtonID, TRUE );
}

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


L_TBSetButtonInfo

#include "ltTLB.h"

L_INT EXT_FUNCTION L_TBSetButtonInfo( pToolbar, uButtonId, pButtonInfo )

pTOOLBARHANDLE pToolbar; | /* pointer to a handle */
L_UINT uButtonId; | /* button Id */
const pLBUTTONINFO pButtonInfo; | /* pointer to a structure */

Sets the information for the specified toolbar button.

Parameter | Description
pToolbar | Pointer to a toolbar handle.
uButtonId | Identifier that indicates the button for which to set the specified information.
pButtonInfo | Pointer to LBUTTONINFO structure that contains the button information to set.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes

Comments

To get the current information for a toolbar button calls L_TBGetButtonInfo.

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_TBAddButton, L_TBRemoveButton, L_TBGetButtonInfo, L_TBGetToolbarInfo, L_TBSetToolbarInfo.
Topics: | Getting and Setting Toolbar Button Information

Example

/*This example will change the bitmap image of the given toolbar button. */

L_VOID SetButtonBitmap( pTOOLBARHANDLE pToolbar, L_UINT uButtonId, HBITMAP hBitmap )
{
LBUTTONINFO ButtonInfo;

/* get button info */
ButtonInfo.uStructSize = sizeof( LBUTTONINFO );
L_TBGetButtonInfo ( pToolbar, uButtonId, &ButtonInfo, sizeof(LBUTTONINFO) );

/* set new bitmap image */
ButtonInfo.hBitmap = hBitmap;

/* set new button info */
L_TBSetButtonInfo( pToolbar, uButtonId, &ButtonInfo );
}


L_TBSetButtonVisible

#include "LtTLB.h"

L_INT EXT_FUNCTION L_TBSetButtonVisible(pToolbar, uButtonID, fVisible )

pTOOLBARHANDLE pToolbar; | /* pointer to a toolbar handle */
L_UINT uButtonID; | /* button ID */
L_BOOL fVisible; | /* visibility flag */

Sets the specified button to be visible or hidden.

Parameter | Description
pToolbar | Pointer to a toolbar handle.
uButtonID | Identifier of the button to set.
fVisible | Flag that indicates whether to make the specified button visible or invisible. Possible values are:
 | Value | Meaning
 | TRUE | Make the specified button visible.
 | FALSE | Make the specified button hidden.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes

Comments

To determine whether a button is visible or hidden, call L_TBIsButtonVisible.

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_TBIsButtonVisible.
Topics: | Getting and Setting Toolbar Button Information

Example

L_INT ToggleToolbarButton ( pTOOLBARHANDLE pLeadToolbar, L_UINT uButtonID )
{
if (SUCCESS == L_TBIsValid ( pLeadToolbar ) ) /* check the validity of the toolbar handle */
{
L_BOOL fVisible ;

/* Get the state of the toolbar button visibility */
L_TBIsButtonVisible ( pLeadToolbar, uButtonID, &fVisible ) ;

if ( fVisible )
{
/* Hid the button */
L_TBSetButtonVisible ( pLeadToolbar, uButtonID, FALSE ) ;
}
else
{
/* Show the button */
L_TBSetButtonVisible ( pLeadToolbar, uButtonID, TRUE ) ;
}

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


L_TBSetCallback

#include "LtTLB.h"

L_INT EXT_FUNCTION L_TBSetCallback(pToolbar, pCallback, *pUserData )

pTOOLBARHANDLE pToolbar; | /* pointer to a toolbar handle */
const pTOOLBARCALLBACK pCallback; | /* optional callback function */
L_VOID L_FAR * pUserData; | /* pointer to more parameters for the callback */

Specifies a callback function that will be used to notify the user about the toolbar events.

Parameter | Description
pToolbar | Pointer to a toolbar handle.
pCallback | Optional callback function for additional processing. If you do not provide a callback function, use NULL as the value of this parameter. If you do provide a callback function, use the function pointer as the value of this parameter. The callback function must adhere to the function prototype described in TOOLBARCALLBACK Function.
pUserData | Void pointer that you can use to pass one or more additional parameters that the callback function needs.
 | To use this feature, assign a value to a variable or create a structure that contains as many fields as you need. Then, in this parameter, pass the address of the variable or structure, casting it to L_VOID L_FAR *. The callback function, which receives the address in its own pUserData parameter, can cast it to a pointer of the appropriate data type to access your variable or structure.
 | If the additional parameters are not needed, you can pass NULL in this parameter.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes

Comments

To determine the current callback function used to notify the user of toolbar events, call L_TBGetCallback.

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: | TOOLBARCALLBACK, L_TBGetCallback.
Topics: | Receiving Toolbar Events

Example

/* This example will create a toolbar, set its callback and then use some of
its button messages to display messages to the user. */

L_INT EXT_CALLBACK LeadToolbarProc
(
pTOOLBARHANDLE pToolbar,
TOOLBARBUTTONID nButtonID,
L_UINT32 dwData,
L_VOID L_FAR *pUserData
)
{
switch ( nButtonID )
{
case ID_TOOL_PAINT_BRUSH:
{
MessageBox ( * ( HWND * ) pUserData, TEXT("BRUSH"), TEXT("Toolbar Message"), MB_OK ) ;
}

break ;

case ID_TOOL_PAINT_SHAPE_LINE:
{
MessageBox ( * ( HWND * ) pUserData, TEXT("LINE"), TEXT("Toolbar Message"), MB_OK ) ;
}

break ;

case ID_TOOL_PAINT_REGION_RECT:
{
MessageBox ( * ( HWND * ) pUserData, TEXT("RECT"), TEXT("Toolbar Message"), MB_OK ) ;
}

break ;

case ID_TOOL_PAINT_FILL_SURFACE:
{
MessageBox ( * ( HWND * ) pUserData, TEXT("SURFACE"), TEXT("Toolbar Message"), MB_OK ) ;
}

break ;

case ID_TOOL_PAINT_TEXT:
{
MessageBox ( * ( HWND * ) pUserData, TEXT("TEXT"), TEXT("Toolbar Message"), MB_OK ) ;
}

break ;
}

return SUCCESS ;
}

/* Global toolbar handle */
pTOOLBARHANDLE g_pLeadToolbar ;

L_INT ToolbarTest ( HWND hWnd )
{
static HWND hwndToolbarOwner ;

/* Save the owner window handle */
hwndToolbarOwner = hWnd ;

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

if (SUCCESS == L_TBIsValid ( g_pLeadToolbar ) ) /* check the validity of the toolbar handle */
{
/* Create the toolbar */
L_TBCreate ( g_pLeadToolbar, hWnd, TEXT("Tools Window"), TOOLBAR_PAINT ) ;

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

/* Set the toolbar callback with the owner window as the user defined data */
L_TBSetCallback ( g_pLeadToolbar, LeadToolbarProc, ( L_VOID L_FAR * ) &hwndToolbarOwner ) ;
}

return SUCCESS ;
}


L_TBSetPosition

#include "LtTLB.h"

L_INT EXT_FUNCTION L_TBSetPosition(pToolbar, lpptPos, dwFlags )

pTOOLBARHANDLE pToolbar; | /* pointer to a toolbar handle */
LPPOINT lpptPos; | /* pointer to a structure */
L_UINT32 dwFlags; | /* position flags */

Sets the toolbar position.

Parameter | Description
pToolbar | Pointer to a toolbar handle.
lpptPos | Pointer to a POINT structure that contains values used to align the toolbar. The coordinates are with respect to the screen.
dwFlags | Flags that indicate which corner of the toolbar is located at lpptPos. Possible values are:
 | One of the following values:
 | Value | Meaning
 | TOOLBAR_POSITION_LEFT | The x coordinate of the specified point will become the left of the toolbar.
 | TOOLBAR_POSITION_RIGHT | The x coordinate of the specified point will become the right of the toolbar.
 | must be combined using the bitwise OR with one of these values:
 | Value | Meaning
 | TOOLBAR_POSITION_TOP | The y coordinate of the specified point will become the top of the toolbar.
 | TOOLBAR_POSITION_BOTTOM | The y coordinate of the specified point will become the bottom of the toolbar.
 | For example, TOOLBAR_POSITION_LEFT | TOOLBAR_POSITION_TOP indicates that lpptPos is the top left point of the toolbar.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes

Comments

To get the current toolbar position and alignment, call L_TBGetPosition.

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_TBGetPosition.
Topics: | Getting and Setting Toolbar Characterisitcs

Example

For an example, refer to L_TBCreate.


L_TBSetRows

#include "LtTLB.h"

L_INT EXT_FUNCTION L_TBSetRows(pToolbar, nRows )

pTOOLBARHANDLE pToolbar; | /* pointer to a toolbar handle */
L_INT nRows; | /* number of rows */

Sets the number of rows of buttons in the toolbar.

Parameter | Description
pToolbar | Pointer to a toolbar handle.
nRows | Number of rows requested. The minimum number of rows is one, and the maximum number of rows is equal to the
 | number of buttons in the toolbar.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes

Comments

Buttons are arranged on the rows from left to right.

To determine the current number of rows set, call L_TBGetRows.

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_TBGetRows.
Topics: | Getting and Setting Toolbar Characterisitcs

Example

/* This example gets the current number of rows in the toolbar. If it is not 2, then it will make 2 rows. */

L_INT SetToolbarRows ( pTOOLBARHANDLE pLeadToolbar )
{
if (SUCCESS == L_TBIsValid ( pLeadToolbar ) ) /* check the validity of the toolbar handle */
{
L_INT nRow ;

/* Get the number of rows in the toolbar */
L_TBGetRows ( pLeadToolbar, &nRow ) ;

if ( nRow != 2 )
{
/* Set the number of rows to 2 */
L_TBSetRows ( pLeadToolbar, 2 ) ;
}

return SUCCESS ;
}
else
{
return FAILURE ;
}
}


L_TBSetToolbarInfo

#include "LtTLB.h"

L_INT EXT_FUNCTION L_TBSetToolbarInfo(pToolbar, pToolbarInfo )

pTOOLBARHANDLE pToolbar; | /* pointer to a toolbar handle */
pLTOOLBARINFO pToolbarInfo; | /* pointer to a structure */

Sets the toolbar information.

Parameter | Description
pToolbar | Pointer to a toolbar handle.
pToolbarInfo | Pointer to an LTOOLBARINFO structure that contains the information that will be used to set the toolbar information.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes

Comments

This function may be used to assign information to a toolbar created using the TOOLBAR_EMPTY flag in the L_TBCreate function, or it may be used to modify an existing toolbar.

To get the current toolbar information, call L_TBGetToolbarInfo.

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_TBGetToolbarInfo, L_TBFreeToolbarInfo
Topics: | Getting and Setting Toolbar Information

Example

For an example, refer to L_TBGetToolbarInfo.


L_TBSetVisible

#include "LtTLB.h"

L_INT EXT_FUNCTION L_TBSetVisible (pToolbar, fVisible )

pTOOLBARHANDLE pToolbar; | /* pointer to a toolbar handle */
L_BOOL fVisible; | /* visibility flag */

Sets the toolbar visibility.

Parameter | Description
pToolbar | Pointer to a toolbar handle.
fVisible | Flag that indicates whether to show or hide the toolbar. Possible values are:
 | Value | Meaning
 | TRUE | Show the toolbar.
 | FALSE | Hide the toolbar.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes

Comments

To determine the current toolbar visibility status, call L_TBIsVisible.

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_TBIsVisible.
Topics: | Getting and Setting Toolbar Characterisitcs

Example

For an example, refer to L_TBCreate.


TOOLBARCALLBACK

TOOLBARCALLBACK function

#include "LtTLB.h"

L_INT EXT_CALLBACK YourFunction(pToolbar, nButtonID, dwData, pUserData )

pTOOLBARHANDLE pToolbar; | /* pointer to a toolbar handle */
L_UINT nButtonID; | /* button ID */
L_UINT32 dwData; | /* reserved */
L_VOID L_FAR * pUserData; | /* pointer to additional data */

Handles each action that occurs in the toolbar.

Parameter | Description
pToolbar | Pointer to a toolbar handle.
nButtonID | An integer that identifies the button that was responsible for creating the toolbar event.
dwData | Reserved for future use.
pUserData | A void pointer that you can use it to access a variable or structure containing data that your callback function needs. This gives you a way to receive data indirectly from the function that uses this callback function. (This is the same pointer that you pass in the pUserData parameter of the calling function.)
 | Keep in mind that this is a void pointer, which must be cast to the appropriate data type within your callback function.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes

Comments

This function is called for each event that occurs in the toolbar. To receive notification of toolbar events the callback function must be set using L_TBSetCallback. To determine that current callback function that is handling toolbar events, call L_TBGetCallback.

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_TBSetCallback, L_TBGetCallback
Topics: | Receiving Toolbar Events

Example:

For an example, refer to L_TBSetCallback.


Raster Pro/Document/Medical Features

Raster Pro:

LEADTOOLS Raster Imaging Pro provides some imaging capabilities that are not available in the LEADTOOLS Raster Imaging product. In order to access these features, you must unlock them by calling L_UnlockSupport(L_SUPPORT_LTPRO, L_KEY_LTPRO). L_KEY_LTPRO can be found in ltkey.h.

If you are a licensed user of LEADTOOLS Raster Imaging, and would like to access Raster Imaging Pro features, you must contact Tech Support for information on obtaining a license and the unlock key for calling L_UnlockSupport.

Document/Medical:

LEADTOOLS Document Imaging, LEADTOOLS Document Imaging Suite, LEADTOOLS Medical Imaging and LEADTOOLS Medical Imaging Suite are the most comprehensive imaging toolkits on the market. No other toolkit provides as many imaging features for color, gray-scale and black & white images in one development package, and for one price. These toolkits comprise LEAD's best code and are designed for the programmer who is looking for the fastest performance, and/or the most extensive color, document, and medical imaging capabilities available.

These toolkits contain powerful annotation capabilities and optimized document image processing filters, and high performance compression, decompression and viewing of JPEG, LEAD CMP, MRC and CCITT G3/G4. The annotation capabilities enable the programmer to add text, highlights, sticky notes, audio, ellipses, buttons, lines, arrows, rectangles, polygons, redaction (blackout), hotspots, freehand scribble, pointers, bitmap and text stamps, to black & white and color images. Programmers working with document imaging will also find special processing filters such as despeckle, deskew, favor black, and scale to gray to enhance their black and white 1 bit images. Additionally, you can achieve faster rotation in 90-degree increments by applying a rotated view perspective to the bitmap. These LEADTOOLS toolkits offer the fastest software-only JPEG decoder available.

LEADTOOLS Document Imaging

The LEADTOOLS Document Imaging toolkit contains all the features available in the LEADTOOLS Raster Imaging Pro. In addition, it contains the following capabilities:

Special functions for Document (bitonal) images. The LEADTOOLS functions for bitonal images are especially useful for working with images from black-and-white scanners or FAX machines. These functions let you do things such as automatically straighten (deskew) an image, remove spots (despeckle), or clarify a scaled display (using scale-to-gray and favor-black features).

Annotation. LEADTOOLS supports annotation of images by letting you overlay images with text, lines, shapes, arrows, buttons, highlights, hot spots, sticky notes, stamps, buttons, and sounds.

Fast rotation. LEADTOOLS achieves fast rotation in 90-degree increments by applying a rotated view perspective to the bitmap.

ISIS support. LEADTOOLS supports ISIS interfaces for driving scanning devices.

Faster compression and decompression. The Document/Medical editions work faster when loading and saving LEAD CMP, JPEG, and CCITT Group 3 and Group 4 images. The LEADTOOLS functions for loading and saving are the same in all products. The only difference is in performance.

1-bit Image Clean-up. The Document toolkits include support for removing dots, blobs, holes, inverted text, lines, borders, bumps and nicks from 1-bit images.

Region Clean-up. [Document/Medical] Remove all the holes from a region.

Embedded Messages. The Document toolkits include support for embedding messages in lossless image formats like bmp, tiff, lossless jpeg, etc. The message is embedded without any visible changes to the image, and does not appreciably increase the size of the image. The message is password-protected.

Image Conversion. The Document toolkits include support for transforming a bitmap into a binary image using specified thresholds or a threshold calculated automatically based on statistical features of the bitmap.

12 and 16 bit grayscale images. [Document/Medical] Load, process, display, window level and save 12 and 16 bit grayscale images (including support for 16-bit grayscale TIFF).

48 and 64 bit color images. [Document/Medical] Load, process, display, and save 48 and 64 bit color images.

MRC Support. [Document/Medical] LEADTOOLS supports the Mixed Raster Content format for color documents containing mixed image and text components. For more information, refer to the .

Halftoning. [Document/Medical] Convert 1-, 4-, 8-, 16-, 24-, or 32-bit bitmaps to a halftoned bitmap, with a specified pattern rotation. A halftoned bitmap is a 1-bit bitmap that has been dithered for black and white printing or display.

LEADTOOLS Document Imaging Suite

The LEADTOOLS Document Imaging Suite toolkit contains all the capabilities of LEADTOOLS Document Imaging, and includes the features listed below. Please note that the OCR features are included in this toolkit, however they can also be purchased as a plug-in for the LEADTOOLS Document Imaging toolkit. Also, JBIG support is provided in this toolkit, however a JBIG Module may be added on to LEADTOOLS Document Imaging, LEADTOOLS Medical Imaging or LEADTOOLS Medical Imaging Suite.

OCR features. [Document/Medical] LEAD offers OCR features that use Scansoft Textbridge technology. Support for these features is included in the LEADTOOLS Document Imaging Suite, and can be added, via plug-in to the LEADTOOLS Document Imaging, LEADTOOLS Medical Imaging and LEADTOOLS Medical Imaging Suite toolkits. The OCR features allow you to perform optical character recognition and turn images into documents. Features include preset confidence and accuracy levels for controlling how sensitive the engine is to unrecognized text, artificial intelligence for improving recognition on documents of the same type, and built-in and user-defined lexicons for limiting the type of text to recognize within a particular zone. LEADTOOLS provides the ability to verify or correct text during, and (using LEAD's unique OCR editor) after recognition. LEAD's OCR editor ties the text being edited directly to the image, providing a visual reference to the original bitmap data. The OCR engine can perform Automatic area segmentation creating multi-layered zones, recognizing areas such as tables, rules, images and text. Or, you can manually designate up to 250 such zones. The OCR features support different fonts, sizes (5 to 72 point) and styles. Fax, dot matrix and halftones can be preprocessed to improve recognition results. The OCR Engine supports major European and Scandinavian languages (Danish, Dutch, Finnish, French, German, Italian, Norwegian, Portuguese, Russian, Spanish, and Swedish) as well as English. Support for dialects such as US. English, French Canadian, Latin American Spanish, Swiss German, and Brazilian Portuguese is also provided.

Recognized text can be exported to more than 40 different formats, including MS Word, MS Excel, Dbase andWordPerfect. The LEADTOOLS OCR features contain superior OCR processing speeds, for use in form recognition and processing applications.

LEAD's JBIG filter. [Document/Medical] LEAD includes support for this filter in the LEADTOOLS Document Imaging Suite toolkit. Support for this filter can be added to LEADTOOLS Document Imaging, LEADTOOLS Medical Imaging or LEADTOOLS Medical Imaging Suite by purchasing the JBIG Module. JBIG defines a method for lossless compression encoding of a bi-level image (two-color image). This method can also be used for coding grayscale and color images. LEADTOOLS completely supports all three types of images, giving you the ability to make full use of this powerful compression technology. LEADTOOLS also supports the progressive capability of JBIG, allowing you to store and send multiple representations of images at different resolutions without any extra storage overhead.

LEADTOOLS Medical Imaging

LEADTOOLS Medical Imaging contains all the capabilities of LEADTOOLS Document Imaging. It also includes general medical imaging technologies (1-16,24,32 bit color, 1-16 bit grayscale and window leveling of 12 and 16-bit grayscale images) and support for the DICOM file format.

DICOM file support. [Medical] LEADTOOLS Medical Imaging provides COMPLETE support for the DICOM 3.0 specification, including all standard IOD classes and modalities (CR, CT, MR, NM, US, RF, SC, VL, etc.) and complete DICOM Basic Directory support.

Window leveling. [Document/Medical] Detect and set LowBit and HighBit for image data, display images with automatic LUT intensity expansion, or set LUT entries and ranges with specific values and gradients. Display images through the LUT without changing the data, or process the image data using the LUT. Linearize the number of pixels locally in a bitmap, based on the specified color space in order to bring out the detail in dark areas of an image, and smooth the edges between blocks.

Medical Imaging Processing. [Medical] LEADTOOLS Medical Imaging provides image processing functionality designed specifically to allow you to examine and improve the quality of medical images.

LEADTOOLS Medical Imaging Suite

LEADTOOLS Medical Imaging Suite contains all the capabilities of LEADTOOLS Medical Imaging. In addition, it supports the following:

DICOM Communication support. [Medical Suite] LEADTOOLS provides COMPLETE support for DICOM Communications, including all Service Classes (Verification, Storage, Query/Retrieve, Patient Management, etc), and contains high-level communications functions simplifying the creation of DICOM client/server applications.

(Document/Medical) is used in the documentation to designate the features that are available in LEADTOOLS Document Imaging, LEADTOOLS Document Imaging Suite, LEADTOOLS Medical Imaging and LEADTOOLS Medical Imaging Suite. Those features that are available only in the Medical toolkits are indicated in the documentation by (Medical). Features available only in the LEADTOOLS Medical Imaging Suite toolkit are indicated in the documentation by (Medical Suite).

(Internet only) is used in the documentation to designate the features that are available only in the LEADTOOLS Internet toolkit.

For more information, refer to Document/Medical Edition Support and Licensing Requirements .


LEADTOOLS Reference Manuals

LEADTOOLS provides reference manuals that contain the same information as the online help. You can print them from PDF files. Please note that due to the large size of the PDF files that contain the LEADTOOLS manuals, these files are no longer included in the setup. Instead, these PDF files can be downloaded from our website at http://support.leadtools.com/SupportPortal/DesktopDefault.aspx?tabindex=3&tabid=27.

To print the PDF files, you must use the Adobe Acrobat Reader 3.0 or higher. You can download a copy of the Acrobat Reader from the Adobe web site (http://www.adobe.com). Note that different versions of the Acrobat Reader are available for different operating systems, but they all can read the same PDF files.


Topic Selection

LEAD Technologies, Inc.
Suite 400
1201 Greenwood Cliff
Charlotte, NC 28204

Sales@Leadtools.com
www.leadtools.com

(704) 332-5532
FAX: (704) 372-8161
Tech Support: (704) 372-9681

LEADTOOLS is ideal for developers involved in still frame, multimedia, document, medical, and vector imaging projects, including Internet/Intranet applications. Independent of the specific application requirement – scanning, file format support/conversion, compression, image processing, annotation, database support, multimedia, etc. – LEADTOOLS provides the most comprehensive, robust, flexible, and powerful imaging solution available.

Click this button to start the Licensing help file to review the License Agreements governing your use of the software.

Click this button to start the Products help file to review the full line of LEADTOOLS Products.

Click this button to start the Imaging help file to review the full line of LEADTOOLS Image Categories.