#ifndef __BBAPI_H_
#define __BBAPI_H_
#if _MSC_VER > 1000
#pragma once
#endif
#define VC_EXTRALEAN
#define NOCRYPT
#define NOSERVICE
#define NOIME
#define NOMCX
#define NO_INTSHCUT_GUIDS
#define NO_SHDOCVW_GUIDS
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0500
#endif
#ifndef DLL_EXPORT
#define DLL_EXPORT __declspec(dllexport)
#endif
#include <windows.h>
#include <stdio.h>
#define MAX_LINE_LENGTH 4096
#define B_HORIZONTAL 0
#define B_VERTICAL 1
#define B_DIAGONAL 2
#define B_CROSSDIAGONAL 3
#define B_PIPECROSS 4
#define B_ELLIPTIC 5
#define B_RECTANGLE 6
#define B_PYRAMID 7
#define B_SOLID 8
#define BEVEL_FLAT 0
#define BEVEL_RAISED 1
#define BEVEL_SUNKEN 2
#define BEVEL1 1
#define BEVEL2 2
#define BB_REGISTERMESSAGE 10001
#define BB_UNREGISTERMESSAGE 10002
#define BB_QUIT 10101
#define BB_RESTART 10102
#define BB_RECONFIGURE 10103
#define BB_SETSTYLE 10104
#define BB_SETTHEME 10107
#define BB_EDITFILE 10201
#define BB_MENU 10301
#define BB_HIDEMENU 10302
#define BB_TOGGLESYSTEMBAR 10303
#define BB_SETTOOLBARLABEL 10304
#define BB_TOGGLEPLUGINS 10305
#define BB_SUBMENU 10306
#define BB_TOGGLESLIT 10307
#define BB_TOGGLETOOLBAR 10308
#define BB_SHUTDOWN 10401
#define BB_RUN 10402
#define BB_DESKTOPINFO 10501
#define BB_LISTDESKTOPS 10502
#define BB_SWITCHTON 10503
#define BB_BRINGTOFRONT 10504
#define BB_WORKSPACE 10505
#define BB_TRAYUPDATE 10507
#define BB_DRAGTODESKTOP 10510
#define BB_ADDTASK 10601
#define BB_REMOVETASK 10602
#define BB_ACTIVATESHELLWINDOW 10603
#define BB_ACTIVETASK 10604
#define BB_MINMAXTASK 10605
#define BB_REDRAW 10610
#define BB_WINDOWSHADE 10606
#define BB_WINDOWGROWHEIGHT 10607
#define BB_WINDOWGROWWIDTH 10608
#define BB_WINDOWLOWER 10609
#define BB_WINDOWMINIMIZE 10611
#define BB_WINDOWRAISE 10612
#define BB_BROADCAST 10901
#define DOCK_ADD 11001
#define DOCK_REMOVE 11002
#define DOCK_UPDATE 11003
#define SLIT_ADD 11001
#define SLIT_REMOVE 11002
#define SLIT_UPDATE 11003
#define PLUGIN_NAME 1
#define PLUGIN_VERSION 2
#define PLUGIN_AUTHOR 3
#define PLUGIN_RELEASEDATE 4
#define PLUGIN_LINK 5
#define PLUGIN_EMAIL 6
#define PLUGIN_BROAMS 7
#define PLUGIN_UPDATE_URL 8
#define TRAYICON_ADDED 0
#define TRAYICON_MODIFIED 1
#define TRAYICON_REMOVED 2
#define TRAYICON_REFRESH 3
#define TASKITEM_ADDED 0
#define TASKITEM_MODIFIED 1
#define TASKITEM_ACTIVATED 2
#define TASKITEM_REMOVED 3
#define TASKITEM_REFRESH 4
#define TASKITEM_FLASHED 5
enum
{
SN_TOOLBAR = 1
,SN_TOOLBARBUTTON
,SN_TOOLBARBUTTONP
,SN_TOOLBARLABEL
,SN_TOOLBARWINDOWLABEL
,SN_TOOLBARCLOCK
,SN_MENUTITLE
,SN_MENUFRAME
,SN_MENUHILITE
,SN_MENUBULLET
,SN_MENUBULLETPOS
,SN_BORDERWIDTH
,SN_BORDERCOLOR
,SN_BEVELWIDTH
,SN_FRAMEWIDTH
,SN_HANDLEWIDTH
,SN_ROOTCOMMAND
,SN_MENUALPHA
,SN_TOOLBARALPHA
,SN_METRICSUNIX
,SN_BULLETUNIX
,SN_WINFOCUS_TITLE
,SN_WINFOCUS_LABEL
,SN_WINFOCUS_HANDLE
,SN_WINFOCUS_GRIP
,SN_WINFOCUS_BUTTON
,SN_WINFOCUS_BUTTONP
,SN_WINUNFOCUS_TITLE
,SN_WINUNFOCUS_LABEL
,SN_WINUNFOCUS_HANDLE
,SN_WINUNFOCUS_GRIP
,SN_WINUNFOCUS_BUTTON
,SN_WINFOCUS_FRAME_COLOR
,SN_WINUNFOCUS_FRAME_COLOR
,SN_NEWMETRICS
,SN_LAST
};
COLORREF ParseLiteralColor(LPCSTR colour);
void ClearSticky();
typedef struct StyleItem
{
public:
int bevelstyle;
int bevelposition;
int type;
bool parentRelative;
bool interlaced;
COLORREF Color;
COLORREF ColorTo;
COLORREF TextColor;
int FontHeight;
int FontWeight;
int Justify;
int validated;
char Font[128];
// bbLean "experimental"...
int nVersion;
int marginWidth;
int borderWidth;
COLORREF borderColor;
COLORREF foregroundColor;
COLORREF disabledColor;
bool bordered;
bool FontShadow;
} StyleItem;
#define PicColor TextColor
class Menu;
class MenuItem;
extern "C"
{
DLL_EXPORT LPCSTR GetBBVersion();
DLL_EXPORT HWND GetBBWnd();
DLL_EXPORT LPCSTR GetOSInfo();
DLL_EXPORT bool WINAPI GetBlackboxPath(LPSTR path, int maxLength);
DLL_EXPORT HINSTANCE BBExecute(HWND Owner, LPCSTR szOperation, LPCSTR szCommand, LPCSTR szArgs, LPCSTR szDirectory, int nShowCmd, bool noErrorMsgs);
DLL_EXPORT void Log(LPCSTR variable, LPCSTR description);
DLL_EXPORT int MBoxErrorFile(LPCSTR szFile);
DLL_EXPORT int MBoxErrorValue(LPCSTR szValue);
DLL_EXPORT LPSTR Tokenize(LPCSTR sourceString, LPSTR targetString, LPSTR delimiter);
DLL_EXPORT int BBTokenize (LPCSTR sourceString, LPSTR* targetStrings, DWORD numTokensToParse, LPSTR remainingString);
DLL_EXPORT bool IsInString(LPCSTR inputString, LPCSTR searchString);
DLL_EXPORT LPCSTR bbrcPath(LPCSTR bbrcFileName=NULL);
DLL_EXPORT LPCSTR menuPath(LPCSTR menurcFileName=NULL);
DLL_EXPORT LPCSTR plugrcPath(LPCSTR pluginrcFileName=NULL);
DLL_EXPORT LPCSTR extensionsrcPath(LPCSTR extensionsrcFileName=NULL);
DLL_EXPORT LPCSTR stylePath(LPCSTR styleFileName=NULL);
DLL_EXPORT void GetBlackboxEditor(LPSTR editor);
bool DownloadFile(LPCSTR url, LPCSTR path);
DLL_EXPORT FILE *FileOpen(LPCSTR fileName);
DLL_EXPORT bool FileClose(FILE *filePointer);
DLL_EXPORT bool FileRead(FILE *filePointer, LPSTR readString);
DLL_EXPORT bool FileExists(LPCSTR szFileName);
DLL_EXPORT LPCSTR ConfigFileExists(LPCSTR filename, LPCSTR pluginDir);
bool FolderExists(LPCSTR szFolderPath);
DLL_EXPORT LPSTR ReadValue(LPCSTR fp, LPCSTR keyword, LPLONG ptr = NULL);
DLL_EXPORT bool ReadBool(LPCSTR filePointer, LPCSTR string, bool defaultBool);
DLL_EXPORT int ReadInt(LPCSTR filePointer, LPCSTR string, int defaultInt);
DLL_EXPORT LPSTR ReadString(LPCSTR filePointer, LPCSTR string, LPSTR defaultString);
DLL_EXPORT COLORREF ReadColor(LPCSTR filePointer, LPCSTR string, LPCSTR defaultString);
DLL_EXPORT bool ReadNextCommand(FILE *filePointer, LPSTR readLine, DWORD lineLength);
DLL_EXPORT void WriteBool(LPCSTR filePointer, LPCSTR keyword, bool value);
DLL_EXPORT void WriteInt(LPCSTR filePointer, LPCSTR keyword, int value);
DLL_EXPORT void WriteString(LPCSTR filePointer, LPCSTR keyword, LPSTR value);
DLL_EXPORT void WriteColor(LPCSTR filePointer, LPCSTR keyword, COLORREF value);
DLL_EXPORT void* GetSettingPtr(int index);
DLL_EXPORT void ParseItem(LPCSTR szItem, StyleItem *item);
DLL_EXPORT LPSTR StrRemoveEncap(LPSTR string);
DLL_EXPORT void ReplaceEnvVars(LPSTR string);
DLL_EXPORT void ReplaceShellFolders(LPSTR string);
DLL_EXPORT void ParseFontString(LPSTR string, StyleItem *item);
DLL_EXPORT void CheckFontSubstitution(LPSTR font);
bool CopyStringToClipboard(LPSTR string);
bool RetrieveStringFromClipboard(LPSTR target);
DLL_EXPORT void MakeGradient(HDC hdc, RECT rect, int gradientType, COLORREF colourFrom, COLORREF colourTo, bool interlaced, int bevelStyle, int bevelPosition, int bevelWidth, COLORREF borderColour, int borderWidth);
DLL_EXPORT void MakeStyleGradient(HDC hdc, RECT *rect, StyleItem *item, bool withBorder);
DLL_EXPORT void CreateBorder(HDC hdc, RECT *rect, int borderColour, int borderWidth);
DLL_EXPORT HFONT CreateStyleFont(StyleItem *item);
void DrawTextWithShadow(HDC hdc, LPSTR text, RECT r, unsigned int format, COLORREF textColor, COLORREF shadowColor, bool shadow);
DLL_EXPORT Menu *MakeMenu(LPCSTR HeaderText);
DLL_EXPORT void DelMenu(Menu *PluginMenu);
DLL_EXPORT Menu *MakeNamedMenu(LPCSTR HeaderText, LPCSTR MenuId, bool popup);
DLL_EXPORT MenuItem *MakeSubmenu(Menu *ParentMenu, Menu *ChildMenu, LPCSTR Title);
DLL_EXPORT MenuItem *MakeMenuItem(Menu *PluginMenu, LPCSTR Title, LPCSTR Cmd, bool ShowIndicator);
DLL_EXPORT MenuItem *MakeMenuNOP(Menu *PluginMenu, LPCSTR Title);
DLL_EXPORT MenuItem *MakeMenuItemInt(Menu *PluginMenu, LPCSTR Title, LPCSTR Cmd, int val, int minval, int maxval);
DLL_EXPORT MenuItem *MakeMenuItemString(Menu *PluginMenu, LPCSTR Title, LPCSTR Cmd, LPCSTR init_string);
DLL_EXPORT void ShowMenu(Menu *PluginMenu);
DLL_EXPORT bool IsAppWindow(HWND hwnd);
DLL_EXPORT bool SetTransparency(HWND hwnd, BYTE alpha);
DLL_EXPORT void SnapWindowToEdge(WINDOWPOS* windowPosition, int snapDistance, bool useScreenSize);
DLL_EXPORT void MakeSticky(HWND window);
DLL_EXPORT void RemoveSticky(HWND window);
DLL_EXPORT bool CheckSticky(HWND window);
typedef struct string_node
{
struct string_node *next;
char str[1];
} string_node;
class DesktopInfo
{
public:
char name[32];
bool isCurrent;
int number;
int ScreensX;
string_node *deskNames;
};
DLL_EXPORT void GetDesktopInfo(DesktopInfo *deskInfo);
typedef struct
{
HWND hWnd;
UINT uID;
UINT uCallbackMessage;
HICON hIcon;
char szTip[256];
int x,y;
RECT iconRect;
char szInfoTitle[64];
char szInfo[256];
DWORD dwInfoFlags;
UINT uTimeout;
} trayIconItem;
DLL_EXPORT int GetTraySize();
DLL_EXPORT trayIconItem* GetTrayIcon(int pointer);
DLL_EXPORT bool GetUnderExplorer();
DLL_EXPORT int GetTaskListSize();
DLL_EXPORT void SetTaskWorkspace(HWND hwnd, int workspace);
DLL_EXPORT int GetTaskWorkspace(HWND hwnd);
DLL_EXPORT HWND GetTask(int pointer);
DLL_EXPORT int GetActiveTask();
};
#endif
syntax highlighting by