/*++ Copyright (c) 1992 Microsoft Corporation Module Name: toolbar.c Abstract: This module implements the cdplayer toolbar. Author: Rick Turner (ricktu) 04-Aug-1992 Revision History: --*/ #include #include "cdplayer.h" #include "cdwindef.h" #include "toolbar.h" // // local function defs // BOOL FAR PASCAL ToolBarWndProc( IN HWND, IN DWORD, IN DWORD, IN LONG ); // // Module globals // WNDCLASS toolbarwndclass; static CHAR szToolBarClassName[] = "CdToolBar"; HBITMAP hbmToolBtns; HWND hSingle,hMulti,hDispT,hDispTR,hDispDR,hRand,hOrder; BOOL ToolBarInit( VOID ) /*++ Routine Description: This routine creates the toolbar window class and initializes local and global variables for the toolbar. Arguments: none Return Value: TRUE if success, FALSE if not --*/ { // // do toolbar initialization // gToolBarWnd = NULL; // // Register ToolBar Window Proc // toolbarwndclass.style = CS_HREDRAW | CS_VREDRAW; toolbarwndclass.lpfnWndProc = (WNDPROC)ToolBarWndProc; toolbarwndclass.cbClsExtra = 0; toolbarwndclass.cbWndExtra = 0; toolbarwndclass.hInstance = (HINSTANCE)gInstance; toolbarwndclass.hIcon = NULL; toolbarwndclass.hCursor = LoadCursor( NULL, IDC_ARROW ); toolbarwndclass.hbrBackground = CreateSolidBrush( cdLTGRAY ); toolbarwndclass.lpszMenuName = NULL; toolbarwndclass.lpszClassName = szToolBarClassName; RegisterClass( (CONST WNDCLASS *)&toolbarwndclass ); return( TRUE ); gToolBarWnd = NULL; return TRUE; } // // Create Routine // BOOL ToolBarCreate( IN INT x, IN INT y, IN INT width, IN INT height ) /*++ Routine Description: This routine creates the ToolBar section and child controls at the given coordinates, and for the given width and height. Arguments: x - x coord (in gMainWnd coords) of toolbar y - y coord (in gMainWnd coords) of toolbar width - width of toolbar height - height of toolbar Return Value: TRUE if success, FALSE if not --*/ { BOOL result; gToolBarWnd = CreateWindow( szToolBarClassName, "CdToolBarWindow", WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN, x, y, width, height, gMainWnd, (HMENU)ID_CHILD_TOOLBAR, (HINSTANCE)gInstance, NULL ); if (!gToolBarWnd) return FALSE; // // Create children of ToolBar window (tool buttons) // result = CreateChildWindows(ID_CHILD_TOOLBAR,gToolBarWnd); return result; } // // Destroy routine // BOOL ToolBarDestroy( VOID ) /*++ Routine Description: This routine destroys the toolbar windows and its children. Arguments: none Return Value: TRUE if success, FALSE is not. --*/ { INT i; if (!gToolBarWnd) return TRUE; if (DestroyWindow( gToolBarWnd )) { gToolBarWnd = NULL; // // re-Initialize each of the child windows. // for (i=0; i