/*
 ============================================================================
 xoblite -> an alternative shell based on Blackbox for Windows
 Copyright © 2002-2005 Karl-Henrik Henriksson [qwilk]
 Copyright © 2001-2004 The Blackbox for Windows Development Team
 http://xoblite.net/ - #bb4win on irc.freenode.net
 ============================================================================

  Blackbox for Windows is free software, released under the
  GNU General Public License (GPL version 2 or later), with an extension
  that allows linking of proprietary modules under a controlled interface.
  What this means is that plugins etc. are allowed to be released
  under any license the author wishes. Please note, however, that the
  original Blackbox gradient math code used in Blackbox for Windows
  is available under the BSD license.

  http://www.fsf.org/licenses/gpl.html
  http://www.fsf.org/licenses/gpl-faq.html#LinkingOverControlledInterface
  http://www.xfree86.org/3.3.6/COPYRIGHT2.html#5

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  GNU General Public License for more details.

  For additional license information, please read the included license.html

 ============================================================================
*/

#ifndef __BBTOOLBAR_H 
#define __BBTOOLBAR_H 

#include "BBApi.h" 
#include "BImage.h" 
#include "Settings.h" 
#include "Systembar.h" 
#include "Menu/MenuMaker.h" 
#include "Desk.h" 

#include <windows.h> 
#include <string> 
#include <shlwapi.h> 
#include <time.h> 
#include <shlobj.h> 

using namespace std;

#define TOOLBAR_UPDATE_TIMER 1 
#define TOOLBAR_AUTOHIDE_TIMER 2 
#define TOOLBAR_MOUSEHOVER_TIMER 3 
#define TOOLBAR_SETLABEL_TIMER 4 

#define WM_MOUSEWHEEL 0x020A 
#define GET_WHEEL_DELTA_WPARAM(wParam) ((short)HIWORD(wParam)) 

#define WM_XBUTTONDOWN 0x020B 
#define WM_XBUTTONUP 0x020C 
#define XBUTTON1 0x0001 
#define XBUTTON2 0x0002 

//===========================================================================

class Toolbar
{
public:
        Toolbar(HINSTANCE hInstance);
        ~Toolbar();

        friend LRESULT CALLBACK ToolbarWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);

        void DrawWindowLabel(HDC hdc, RECT r);
        void DrawArrowBackward(HDC hdc, int xcenter, int ycenter);
        void DrawArrowForward(HDC hdc, int xcenter, int ycenter);

        void GetSettings();
        void UpdatePosition();
        void UpdateDesktopArea();
        void ClickMouse(int mouseX, int mouseY);
        void ToggleAlwaysOnTop();
        bool CheckIfMouseHover();
        void AutoShow();
        void AutoHide();

        //====================

        HINSTANCE hToolbarInstance;
        HWND hBlackboxWnd; // Blackbox window handle
        HWND hToolbarWnd; // Toolbar window handle

        HBITMAP tbBitmap;

        int ScreenWidth, ScreenHeight;
        int ToolbarX, ToolbarY, ToolbarWidth, ToolbarHeight;
        int ButtonX1, ButtonX2, ButtonX3, ButtonX4, ButtonY, ButtonWH;
        bool ButtonPressed1, ButtonPressed2, ButtonPressed3, ButtonPressed4;

        RECT labelRect, winlabelRect, clockRect;

        bool ToolbarAutoHidden, ToolbarAutoShown;
        bool ToolbarAutoHiding, ToolbarAutoShowing;
        int ToolbarAutoCurrentPos;
        int ToolbarAutoHideTarget, ToolbarAutoShowTarget;

        bool ToolbarPosInProgress;

        bool FirstUpdate;
        bool ShowingExternalLabel;
        char ToolbarWorkspaceName[MAX_LINE_LENGTH];
        char CurrentWindow[MAX_LINE_LENGTH];
        char CurrentTime[MAX_LINE_LENGTH];
        int DisplayedMinute;
        char temp[MAX_LINE_LENGTH];

        bool saveWidthOnRestart;

        RECT origDesktopArea;

        HDC cachedBackground;
        HDC cachedToolbarButton;
        HDC cachedToolbarButtonPressed;
        bool cachedBitmapsExist;

        HDC cachedToolbarWindowLabel;
        RECT currentWindowLabelRect;
        int currentWindowLabelWidth, currentWindowLabelHeight;
};

//===========================================================================

#endif /* __BBTOOLBAR_H */ 





syntax highlighting by

w e b c p p
web c plus plus