/*
============================================================================
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 __BBAPI_H_
#define __BBAPI_H_
#if _MSC_VER > 1000
#pragma once
#endif
//#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers (more aggressive)
#define NOCRYPT // Exclude encryption stuff
#define NOSERVICE // Exclude service stuff
#define NOIME // ...etc...
#define NOMCX
#define NO_INTSHCUT_GUIDS
#define NO_SHDOCVW_GUIDS
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0500
#endif
#ifndef DLL_EXPORT // Removes compiler dependencies
#define DLL_EXPORT __declspec(dllexport)
#endif
#include <windows.h>
#include <stdio.h>
//===========================================================================
#define MAX_LINE_LENGTH 4096
//====================
// BImage gradients
#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
// BImage bevels
#define BEVEL_FLAT 0
#define BEVEL_RAISED 1
#define BEVEL_SUNKEN 2
#define BEVEL1 1
#define BEVEL2 2
//====================
// Blackbox messages
#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_EXITTYPE 10105 // (definition reserved by bb4win)
//#define BB_TOOLBARUPDATE 10106 // (definition reserved by bb4win)
#define BB_SETTHEME 10107
#define BB_EDITFILE 10201 // Param3: 0=CurrentStyle 1=menu.rc, 2=plugins.rc, 3=extensions.rc, 4=blackbox.rc
//#define BB_EXECUTE 10202 // (definition reserved by bb4win)
//#define BB_ABOUTSTYLE 10203 // (definition reserved by bb4win)
//#define BB_ABOUTPLUGINS 10204 // (definition reserved by bb4win)
#define BB_MENU 10301 // Param3: 0=Main menu, 1=Workspaces menu, 2=Toolbar menu, 3=Systembar menu, 4=Slit menu
#define BB_HIDEMENU 10302
//#define BB_TOGGLETRAY 10303 // This message has been renamed, use BB_TOGGLESYSTEMBAR instead!
#define BB_TOGGLESYSTEMBAR 10303 // Replaces BB_TOGGLETRAY
#define BB_SETTOOLBARLABEL 10304 // Used to set the toolbar label (returns to normal after 2 seconds)
#define BB_TOGGLEPLUGINS 10305
#define BB_SUBMENU 10306
#define BB_TOGGLESLIT 10307
#define BB_TOGGLETOOLBAR 10308
#define BB_SHUTDOWN 10401 // Param3: 0=Shutdown, 1=Reboot, 2=Logoff, 3=Hibernate, 4=Suspend, 5=LockWorkstation
#define BB_RUN 10402
//#define BB_COMMAND 10403 // (definition reserved by bb4win)
#define BB_DESKTOPINFO 10501
#define BB_LISTDESKTOPS 10502
#define BB_SWITCHTON 10503
#define BB_BRINGTOFRONT 10504
#define BB_WORKSPACE 10505 // Param3: 0=DeskLeft, 1=DeskRight, 2=AddDesktop, 3=DelDesktop, 4=DeskSwitchToN,
// 5=GatherWindows 6=MoveWindowLeft, 7=MoveWindowRight
//#define BB_TASKSUPDATE 10506 // (definition reserved by bb4win)
#define BB_TRAYUPDATE 10507
//#define BB_CLEANTRAY 10508 // (definition reserved by bb4win)
//#define BB_CLEANTASKS 10509 // (definition reserved by bb4win)
#define BB_DRAGTODESKTOP 10510
#define BB_ADDTASK 10601 // Hook messages...
#define BB_REMOVETASK 10602
#define BB_ACTIVATESHELLWINDOW 10603
#define BB_ACTIVETASK 10604
#define BB_MINMAXTASK 10605
#define BB_REDRAW 10610
#define BB_WINDOWSHADE 10606 // Window handling messages...
#define BB_WINDOWGROWHEIGHT 10607
#define BB_WINDOWGROWWIDTH 10608
#define BB_WINDOWLOWER 10609
//#define BB_MINIMIZE 10611 // This message has been renamed, use BB_WINDOWMINIMIZE instead!
#define BB_WINDOWMINIMIZE 10611
#define BB_WINDOWRAISE 10612
//#define BB_WINDOWMAXIMIZE 10613 // (definition reserved by bb4win)
//#define BB_WINDOWRESTORE 10614 // (definition reserved by bb4win)
//#define BB_WINDOWCLOSE 10615 // (definition reserved by bb4win)
//#define BB_BBSB_NOTIFY 10882 // (definition reserved by bb4win)
#define BB_BROADCAST 10901 // Broadcast messages (bro@m -> the bang killah! :D <vbg>)
//====================
#define DOCK_ADD 11001 // Plugin docking messages
#define DOCK_REMOVE 11002 // (same def's as SLIT_*, for experimental purposes only!!!)
#define DOCK_UPDATE 11003
#define SLIT_ADD 11001 // Slit plugin docking messages
#define SLIT_REMOVE 11002
#define SLIT_UPDATE 11003
//====================
// pluginInfo
#define PLUGIN_NAME 1
#define PLUGIN_VERSION 2
#define PLUGIN_AUTHOR 3
//#define PLUGIN_RELEASE 4 // This message has been renamed, use PLUGIN_RELEASEDATE instead!
#define PLUGIN_RELEASEDATE 4
#define PLUGIN_LINK 5
#define PLUGIN_EMAIL 6
#define PLUGIN_BROAMS 7
#define PLUGIN_UPDATE_URL 8
//====================
// Support for external system tray plugins (used as LPARAM for BB_TRAYUPDATE)
#define TRAYICON_ADDED 0
#define TRAYICON_MODIFIED 1
#define TRAYICON_REMOVED 2
#define TRAYICON_REFRESH 3
// Support for external task handling plugins (used as LPARAM for BB_TASKSUPDATE)
#define TASKITEM_ADDED 0
#define TASKITEM_MODIFIED 1
#define TASKITEM_ACTIVATED 2
#define TASKITEM_REMOVED 3
#define TASKITEM_REFRESH 4
#define TASKITEM_FLASHED 5
//===========================================================================
// Constants for GetSettingPtr(int index)
enum
{
SN_TOOLBAR = 1 // StyleItem *
,SN_TOOLBARBUTTON // StyleItem *
,SN_TOOLBARBUTTONP // StyleItem *
,SN_TOOLBARLABEL // StyleItem *
,SN_TOOLBARWINDOWLABEL // StyleItem *
,SN_TOOLBARCLOCK // StyleItem *
,SN_MENUTITLE // StyleItem *
,SN_MENUFRAME // StyleItem *
,SN_MENUHILITE // StyleItem *
,SN_MENUBULLET // char *
,SN_MENUBULLETPOS // char *
,SN_BORDERWIDTH // int *
,SN_BORDERCOLOR // int *
,SN_BEVELWIDTH // int *
,SN_FRAMEWIDTH // int *
,SN_HANDLEWIDTH // int *
,SN_ROOTCOMMAND // char *
,SN_MENUALPHA // int *
,SN_TOOLBARALPHA // int *
,SN_METRICSUNIX // bool *
,SN_BULLETUNIX // bool *
//===============================================
// For compatibility with bbLeanSkin/bbIconBox...
// ########### WORK IN PROGRESS / TBD ###########
//===============================================
,SN_WINFOCUS_TITLE // StyleItem *
,SN_WINFOCUS_LABEL // StyleItem *
,SN_WINFOCUS_HANDLE // StyleItem *
,SN_WINFOCUS_GRIP // StyleItem *
,SN_WINFOCUS_BUTTON // StyleItem *
,SN_WINFOCUS_BUTTONP // StyleItem *
,SN_WINUNFOCUS_TITLE // StyleItem *
,SN_WINUNFOCUS_LABEL // StyleItem *
,SN_WINUNFOCUS_HANDLE // StyleItem *
,SN_WINUNFOCUS_GRIP // StyleItem *
,SN_WINUNFOCUS_BUTTON // StyleItem *
,SN_WINFOCUS_FRAME_COLOR // COLORREF *
,SN_WINUNFOCUS_FRAME_COLOR // COLORREF *
,SN_NEWMETRICS // bool (not a pointer)
,SN_LAST
};
//===========================================================================
COLORREF ParseLiteralColor(LPCSTR colour);
void ClearSticky();
// Unique Blackbox DWORD (same as in LiteStep to make apps like Winamp sticky)
// NOTE: This method is obsolete, use MakeSticky/RemoveSticky/CheckSticky instead!
// const long magicDWord = 0x49474541;
//===========================================================================
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]; // Name of the workspace
bool isCurrent; // Is this the current workspace?
int number; // Workspace number
int ScreensX; // Total number of workspaces (for bbLean compatibility only)
string_node *deskNames; // List of all workspace names (for bbLean compatibility only)
};
DLL_EXPORT void GetDesktopInfo(DesktopInfo *deskInfo);
//====================
// Support for external system trays (e.g. BBTray)
typedef struct
{
HWND hWnd;
UINT uID;
UINT uCallbackMessage;
HICON hIcon;
char szTip[256];
int x,y;
RECT iconRect;
// For balloon tooltips -> xobloon notifications (for xoblite internal use only, not aligned with bb4win/bbLean!)
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();
//====================
// Support for external taskbars (NOTE: Not all bb4win functions are supported!)
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();
/*
DLL_EXPORT struct tasklist* GetTaskListPtr(void);
struct tasklist
{
struct tasklist *next;
HWND hwnd;
HICON icon;
int wkspc;
//bool hidden;
char caption[256];
};
*/
};
//===========================================================================
#endif /* __BBAPI_H_ */
| w | e | b | c | p | p |
|
| |||||