1: /*
     2:  ============================================================================
     3:  xoblite™ -> an advanced "extended shell" for Microsoft® Windows® 11
     4:  Copyright © 2002-2026 Karl Henrik Henriksson [qwilk/@xoblite]
     5:  Copyright © 2001-2004 The Blackbox for Windows Development Team
     6:  http://xoblite.net/ + https://github.com/xoblite/
     7:  ============================================================================
     8: 
     9:   Blackbox for Windows is free software, released under the
    10:   GNU General Public License (GPL version 2 or later), with an extension
    11:   that allows linking of proprietary modules under a controlled interface.
    12:   What this means is that plugins etc. are allowed to be released
    13:   under any license the author wishes. Please note, however, that the
    14:   original Blackbox gradient math code used in Blackbox for Windows
    15:   is available under the BSD license.
    16: 
    17:   http://www.fsf.org/licenses/gpl.html
    18:   http://www.fsf.org/licenses/gpl-faq.html#LinkingOverControlledInterface
    19:   http://www.xfree86.org/3.3.6/COPYRIGHT2.html#5
    20: 
    21:   This program is distributed in the hope that it will be useful,
    22:   but WITHOUT ANY WARRANTY; without even the implied warranty of
    23:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    24:   GNU General Public License for more details.
    25: 
    26:   For additional license information, please read the included license.html.
    27: 
    28:  ============================================================================
    29: */
    30: 
    31: #ifndef __BBAPI_H_ 
    32: #define __BBAPI_H_ 
    33: 
    34: #if _MSC_VER > 1000 
    35: #pragma once 
    36: #endif 
    37: 
    38: #define WINVER 0x0601               // Note: Assuming minimum Windows 7 here, even though I have only tested xoblite bb5 on Windows 10...  
    39: #define _WIN32_WINNT 0x0601         // ... 
    40: 
    41: #define WIN32_LEAN_AND_MEAN         // Exclude rarely-used stuff from Windows headers 
    42: #define VC_EXTRALEAN                // Exclude rarely-used stuff from Windows headers (more aggressive) 
    43: #define NOCRYPT                     // Exclude encryption stuff 
    44: #define NOSERVICE                   // Exclude service stuff 
    45: #define NOIME                       // ...etc... 
    46: #define NOMCX 
    47: #define NO_INTSHCUT_GUIDS 
    48: #define NO_SHDOCVW_GUIDS 
    49: 
    50: #define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 1   // Enable automatic template overloads of standard CRT functions with more secure variants (e.g. strcpy -> strcpy_s, sprintf -> sprintf_s, etc) 
    51: 
    52: #ifndef DLL_EXPORT 
    53: #define DLL_EXPORT __declspec(dllexport)    // Removes compiler dependencies 
    54: #endif 
    55: 
    56: #include <windows.h> 
    57: #include <winnt.h> 
    58: #include <stdio.h> 
    59: 
    60: #define sizeofArray(array) (sizeof(array)/sizeof(array[0])) 
    61: 
    62: //===========================================================================
    63: //===========================================================================
    64: //===========================================================================
    65: 
    66: #define MAX_LINE_LENGTH 4096    // Remark: Have any of the "bbCLeanModZero's" later redefined this to 1024??? 
    67: 
    68: //====================
    69: 
    70: // BImage: ParentRelative (i.e. no gradient drawn)
    71: #define B_PARENTRELATIVE -1 
    72: 
    73: // BImage: 2-colour regular gradients and 1-colour regular solid
    74: #define B_HORIZONTAL 0 
    75: #define B_VERTICAL 1 
    76: #define B_DIAGONAL 2 
    77: #define B_CROSSDIAGONAL 3 
    78: #define B_PIPECROSS 4 
    79: #define B_ELLIPTIC 5 
    80: #define B_RECTANGLE 6 
    81: #define B_PYRAMID 7 
    82: #define B_SOLID 8 
    83: 
    84: // Non-BImage: Previously loaded mage to be drawn instead of a *box gradient (experimental in xoblite bb5 RC6 == subject to change)
    85: #define B_IMAGEFROMFILE 99 
    86: 
    87: // BImage: 4-colour split gradients (introduced in xoblite bb4)
    88: #define B_SPLITHORIZONTAL B_HORIZONTAL+100 
    89: #define B_SPLITVERTICAL B_VERTICAL+100 
    90: #define B_SPLITSOLID B_SOLID+100 // ...this one is 2-colour obviously :) 
    91: 
    92: // BImage: 8-colour super gradients (introduced in xoblite bb5)
    93: #define B_SUPERHORIZONTAL B_HORIZONTAL+150 // Preliminary - Request For Comments 
    94: #define B_SUPERVERTICAL B_VERTICAL+150 // Preliminary - Request For Comments 
    95: 
    96: // BImage: 2-colour mirrored gradients (introduced in xoblite bb4)
    97: #define B_MIRRORHORIZONTAL B_HORIZONTAL+200 
    98: #define B_MIRRORVERTICAL B_VERTICAL+200 
    99: 
   100: // Other gradients (nb. not currently supported by xoblite, nor all other branches, i.e. included here for reference only)
   101: #define B_WAVEHORIZONTAL B_HORIZONTAL+300 
   102: #define B_WAVEVERTICAL B_VERTICAL+300 
   103: #define B_BLOCKHORIZONTAL B_HORIZONTAL+400 
   104: #define B_BLOCKVERTICAL B_VERTICAL+400 
   105: 
   106: // BImage: Bevel types+positions
   107: #define BEVEL_FLAT 0 
   108: #define BEVEL_RAISED 1 
   109: #define BEVEL_SUNKEN 2 
   110: #define BEVEL1 1 
   111: #define BEVEL2 2 
   112: 
   113: // BImage: Glyph types
   114: #define GLYPH_MENU_EMPTY 0 
   115: #define GLYPH_MENU_SQUARE 1 
   116: 
   117: #define GLYPH_WINDOW_SHADE 101 
   118: #define GLYPH_WINDOW_PIN 102 
   119: #define GLYPH_WINDOW_ALWAYSONTOP 103 
   120: #define GLYPH_WINDOW_MINIMIZE 104 
   121: #define GLYPH_WINDOW_MAXIMIZE 105 
   122: #define GLYPH_WINDOW_CLOSE 106 
   123: 
   124: //====================
   125: 
   126: // Rounded corners (introduced in xoblite bb4 RCs, more broadly used in xoblite bb5)
   127: #define CORNER_TOPLEFT (1<<0) 
   128: #define CORNER_TOPRIGHT (1<<1) 
   129: #define CORNER_BOTTOMLEFT (1<<2) 
   130: #define CORNER_BOTTOMRIGHT (1<<3) 
   131: 
   132: // Metric selectors (used by GetMetricsEvolved())
   133: #define METRIC_BORDER (1<<0) 
   134: #define METRIC_MARGIN (1<<1) 
   135: #define METRIC_BEVEL (1<<2) 
   136: //#define METRIC_FONT (1<<3)
   137: 
   138: //====================
   139: 
   140: // Blackbox messages
   141: 
   142: //#define BB_MSGFIRST           10000   // (definition reserved by bbLean?)
   143: 
   144: #define BB_REGISTERMESSAGE      10001 
   145: #define BB_UNREGISTERMESSAGE    10002 
   146: 
   147: #define BB_QUIT                 10101 
   148: #define BB_RESTART              10102 
   149: #define BB_RECONFIGURE          10103 
   150: #define BB_SETSTYLE             10104 
   151: //#define BB_EXITTYPE           10105   // (definition reserved by bb4win)
   152: //#define BB_TOOLBARUPDATE      10106   // (definition reserved by bb4win)
   153: #define BB_SETTHEME             10107 
   154: //#define BB_REINDEX            10108   // (definition reserved by bbCLeanModZero?)
   155: //#define BB_ABORTINDEX         10109   // (definition reserved by bbCLeanModZero?)
   156: 
   157: #define BB_EDITFILE             10201   // Param3: 0=CurrentStyle 1=menu.rc, 2=plugins.rc, 3=extensions.rc, 4=blackbox.rc 
   158: //#define BB_EXECUTE            10202   // (definition reserved by bb4win)
   159: //#define BB_ABOUTSTYLE         10203   // (definition reserved by bb4win)
   160: //#define BB_ABOUTPLUGINS       10204   // (definition reserved by bb4win)
   161: 
   162: #define BB_MENU                 10301   // Param3: 0=Main menu, 1=Workspaces menu, 2=Toolbar menu, 3=Systembar menu (no longer used -> fallback to toolbar menu), 4=Dock menu 
   163: #define BB_HIDEMENU             10302 
   164: //#define BB_TOGGLETRAY         10303   // This message has been renamed, use BB_TOGGLESYSTEMBAR instead!
   165: #define BB_TOGGLESYSTEMBAR      10303   // Replaces BB_TOGGLETRAY 
   166: #define BB_SETTOOLBARLABEL      10304   // Used to set the toolbar label (returns to normal after 2 seconds) 
   167: #define BB_CONSOLEMESSAGE       10304   // Console introduced in xoblite bb4 RCs; re-using BB_SETTOOLBARLABEL definition since the console replaces the toolbar messages 
   168: #define BB_POPUPMESSAGE         20608   // ### PRELIMINARY xoblite bb5 ### (...using BB_CONSOLEMESSAGE times two for now... ;) ) 
   169: #define BB_TOGGLEPLUGINS        10305 
   170: #define BB_SUBMENU              10306 
   171: #define BB_TOGGLESLIT           10307   // Legacy... 
   172: #define BB_TOGGLEDOCK           10307   // ...xoblite bb5 
   173: #define BB_TOGGLETOOLBAR        10308 
   174: #define BB_AUTOHIDE             10309   // (definition reserved by bbCLeanModZero?) 
   175: #define BB_TOGGLECONSOLE        10310   // PRELIMINARY (not yet finally checked for overlap/compatibility with other *box branches) 
   176: 
   177: #define BB_SHUTDOWN             10401   // Param3: 0=Shutdown, 1=Reboot, 2=Logoff, 3=Hibernate, 4=Standby (Suspend), 5=LockWorkstation 
   178: #define BB_RUN                  10402 
   179: //#define BB_COMMAND            10403   // (definition reserved by bb4win)
   180: 
   181: #define BB_DESKTOPINFO          10501 
   182: #define BB_LISTDESKTOPS         10502 
   183: #define BB_SWITCHTON            10503 
   184: #define BB_BRINGTOFRONT         10504 
   185: #define BB_WORKSPACE            10505   // Param3: 0=DeskLeft, 1=DeskRight, 2=AddDesktop, 3=DelDesktop, 4=DeskSwitchToN, 
   186:                                         //         5=GatherWindows 6=MoveWindowLeft, 7=MoveWindowRight
   187:                                         // Note for reference: bb4win and/or bbCLeanModZero later adding WPARAM values 8=PrevWindow, 9=NextWindow, 10=LastDesk, [...] 20=MinimizeAll, 21=RestoreAll, [...], all the way up to 31.
   188: 
   189: #define BB_TASKSUPDATE          10506   // (definition reserved by bb4win) 
   190: #define BB_TRAYUPDATE           10507 
   191: //#define BB_CLEANTRAY          10508   // (definition reserved by bb4win)
   192: //#define BB_CLEANTASKS         10509   // (definition reserved by bb4win)
   193: #define BB_DRAGTODESKTOP        10510 
   194: //#define BB_SENDWINDOWTON      10511   // (definition reserved by bbCLeanModZero?)
   195: //#define BB_MOVEWINDOWTON      10512   // (definition reserved by bbCLeanModZero?)
   196: 
   197: #define BB_ADDTASK              10601   // Shell hook messages... (nb. these are primarily for core internal task handling; task handling plugins should subscribe to BB_TASKSUPDATE etc instead) 
   198: #define BB_REMOVETASK           10602 
   199: #define BB_ACTIVATESHELLWINDOW  10603 
   200: #define BB_ACTIVETASK           10604 
   201: #define BB_MINMAXTASK           10605 
   202: #define BB_REDRAW               10610 
   203: 
   204: #define BB_WINDOWSHADE          10606   // Window handling messages... 
   205: #define BB_WINDOWGROWHEIGHT     10607 
   206: #define BB_WINDOWGROWWIDTH      10608 
   207: #define BB_WINDOWLOWER          10609 
   208: //#define BB_MINIMIZE           10611   // This message has been renamed, use BB_WINDOWMINIMIZE instead!
   209: #define BB_WINDOWMINIMIZE       10611 
   210: #define BB_WINDOWRAISE          10612 
   211: //#define BB_WINDOWMAXIMIZE     10613   // (definition reserved by bb4win)
   212: //#define BB_WINDOWRESTORE      10614   // (definition reserved by bb4win)
   213: //#define BB_WINDOWCLOSE        10615   // (definition reserved by bb4win)
   214: //#define BB_WINDOWSIZE         10616   // (definition reserved by bbLean)
   215: //#define BB_WINDOWMOVE         10617   // (definition reserved by bbLean)
   216: //#define BB_WINDOWMINIMIZETOTRAY 10618 // (definition reserved by bbCLeanModZero?)
   217: 
   218: //#define BB_BBSB_NOTIFY        10882   // (definition reserved by bb4win)
   219: 
   220: //#define BB_GETBOOL            10870   // (definition reserved by bbLean?)
   221: 
   222: #define BB_REDRAWGUI            10881   // (definition reserved by bbLean for bbStyleMaker) -> Re-used, for now at least?, for xoblite's Designer mode... (which shouldn't trigger a classic full reconfigure on single style param changes etc, only a redraw of the specified element(s)) 
   223: #define BBRG_TOOLBAR (1<<0)             // wParam bitflags for BB_REDRAWGUI 
   224: #define BBRG_MENU    (1<<1)             // ... 
   225: #define BBRG_WINDOW  (1<<2) 
   226: #define BBRG_DESK    (1<<3) 
   227: #define BBRG_DESKTOP BBRG_DESK 
   228: //#define BBRG_FOCUS   (1<<4)
   229: //#define BBRG_PRESSED (1<<5)
   230: //#define BBRG_STICKY  (1<<6)
   231: //#define BBRG_FOLDER  (1<<7)
   232: #define BBRG_SLIT    (1<<8) 
   233: #define BBRG_DOCK BBRG_SLIT 
   234: #define BBRG_HARDWARE (1<<16) 
   235: 
   236: //#define BB_EXECUTEASYNC       10882   // (definition reserved by bbLean?)
   237: //#define BB_DESKCLICK          10884   // (definition reserved by bbLean? -> Desktop clicked, lParam: 0=leftdown 1=left, 2=right, 3=mid, 4=x1, 5=x2, 6=x3 ?)
   238: //#define BB_WINKEY             10886   // (definition reserved by bbLean?)
   239: //#define BB_SENDDATA           10890   // (definition reserved by bbLean for bbStyleMaker?)
   240: //#define BB_GETSTYLE           10891   // (definition reserved by bbLean for bbStyleMaker?)
   241: //#define BB_GETSTYLESTRUCT     10892   // (definition reserved by bbLean for bbStyleMaker?)
   242: //#define BB_SETSTYLESTRUCT     10893   // (definition reserved by bbLean for bbStyleMaker?)
   243: //#define BB_FOLDERCHANGED      10897   // (definition reserved by bbLean?)
   244: //#define BB_DRAGOVER           10898   // (definition reserved by bbLean?)
   245: //#define BB_POSTSTRING         10899   // (definition reserved by bbLean?)
   246: 
   247: #define BB_BROADCAST            10901   // Broadcast messages (bro@m -> the bang killah! :D <vbg>) 
   248: 
   249: #define BB_TRAYICONMESSAGE      10999   // System messages targeting xoblite's own tray icon
   250: 
   251: //====================
   252: 
   253: #define DOCK_ADD                11001   // Dock (nb. formerly known as the "slit") plugin docking messages 
   254: #define DOCK_REMOVE             11002 
   255: #define DOCK_UPDATE             11003 
   256: 
   257: #define SLIT_ADD DOCK_ADD 
   258: #define SLIT_REMOVE DOCK_REMOVE 
   259: #define SLIT_UPDATE DOCK_UPDATE 
   260: 
   261: //====================
   262: 
   263: //#define BB_MSGLAST            12000   // (definition reserved by bbLean?)
   264: 
   265: //===========================================================================
   266: 
   267: // pluginInfo
   268: #define PLUGIN_NAME             1 
   269: #define PLUGIN_VERSION          2 
   270: #define PLUGIN_AUTHOR           3 
   271: #define PLUGIN_RELEASEDATE      4 
   272: #define PLUGIN_LINK             5 
   273: #define PLUGIN_EMAIL            6 
   274: #define PLUGIN_BROAMS           7 
   275: #define PLUGIN_UPDATE_URL       8 
   276: 
   277: #define PLUGIN_RELEASE PLUGIN_RELEASEDATE // This message has been renamed, please use PLUGIN_RELEASEDATE instead... 
   278: 
   279: //====================
   280: 
   281: // Support for external system tray plugins (used as LPARAM for BB_TRAYUPDATE)
   282: #define TRAYICON_ADDED 0 
   283: #define TRAYICON_MODIFIED 1 
   284: #define TRAYICON_REMOVED 2 
   285: #define TRAYICON_REFRESH 3 
   286: 
   287: // Support for external task handling plugins (used as LPARAM for BB_TASKSUPDATE)
   288: #define TASKITEM_ADDED 0 
   289: #define TASKITEM_MODIFIED 1 
   290: #define TASKITEM_ACTIVATED 2 
   291: #define TASKITEM_REMOVED 3 
   292: #define TASKITEM_REFRESH 4 
   293: #define TASKITEM_FLASHED 5 
   294: //#define TASKITEM_LANGUAGE 6 // (definition reserved by bbCLeanModZero for Win9x support?)
   295: 
   296: //====================
   297: 
   298: // Console message types (originally introduced in xoblite bb4 RCs, extended and more broadly used in xoblite bb5)
   299: #define CONSOLE_REGULAR_MESSAGE 0       // Timestamp + message 
   300: #define CONSOLE_INFORMATION_MESSAGE 1   // Information icon + message 
   301: #define CONSOLE_WARNING_MESSAGE 2       // Warning icon + message 
   302: #define CONSOLE_ERROR_MESSAGE 3         // Error icon + message 
   303: #define CONSOLE_SHELL_MESSAGE 4         // Shell icon + message 
   304: #define CONSOLE_PLAIN_MESSAGE 253       // Message only (no timestamp, no icon) 
   305: #define CONSOLE_INDENTED_MESSAGE 254    // Message only, indented (no timestamp, no icon) 
   306: #define CONSOLE_SEPARATOR 255           // Separator 
   307: 
   308: //===========================================================================
   309: 
   310: // Constants for GetSettingPtr(int index)
   311: enum
   312: {
   313:      SN_TOOLBAR = 1             // StyleItem*
   314:     ,SN_TOOLBARBUTTON           // StyleItem*
   315:     ,SN_TOOLBARBUTTONP          // StyleItem*
   316:     ,SN_TOOLBARLABEL            // StyleItem*
   317:     ,SN_TOOLBARWINDOWLABEL      // StyleItem*
   318:     ,SN_TOOLBARCLOCK            // StyleItem*
   319:     ,SN_MENUTITLE               // StyleItem*
   320:     ,SN_MENUFRAME               // StyleItem*
   321:     ,SN_MENUHILITE              // StyleItem*
   322: 
   323:     ,SN_MENUBULLET              // char*
   324:     ,SN_MENUBULLETPOS           // char*
   325: 
   326:     ,SN_BORDERWIDTH             // int*
   327:     ,SN_BORDERCOLOR             // int*
   328:     ,SN_BEVELWIDTH              // int*
   329:     ,SN_FRAMEWIDTH              // int*
   330:     ,SN_HANDLEWIDTH             // int*
   331: 
   332:     ,SN_ROOTCOMMAND             // char*
   333: 
   334:     ,SN_MENUALPHA               // int*
   335:     ,SN_TOOLBARALPHA            // int*
   336: 
   337:     ,SN_METRICSUNIX             // bool*
   338:     ,SN_BULLETUNIX              // bool*
   339: 
   340:     //===============================================
   341:     // For compatibility with bbLeanSkin/bbIconBox...
   342:     // ########### WORK IN PROGRESS / TBD ###########
   343:     //===============================================
   344: 
   345:     ,SN_WINFOCUS_TITLE          // StyleItem*
   346:     ,SN_WINFOCUS_LABEL          // StyleItem*
   347:     ,SN_WINFOCUS_HANDLE         // StyleItem*
   348:     ,SN_WINFOCUS_GRIP           // StyleItem*
   349:     ,SN_WINFOCUS_BUTTON         // StyleItem*
   350:     ,SN_WINFOCUS_BUTTONP        // StyleItem*
   351: 
   352:     ,SN_WINUNFOCUS_TITLE        // StyleItem*
   353:     ,SN_WINUNFOCUS_LABEL        // StyleItem*
   354:     ,SN_WINUNFOCUS_HANDLE       // StyleItem*
   355:     ,SN_WINUNFOCUS_GRIP         // StyleItem*
   356:     ,SN_WINUNFOCUS_BUTTON       // StyleItem*
   357: 
   358:     ,SN_WINFOCUS_FRAME_COLOR    // COLORREF*
   359:     ,SN_WINUNFOCUS_FRAME_COLOR  // COLORREF*
   360: 
   361:     ,SN_NEWMETRICS              // bool (not a pointer)
   362: 
   363:     //===============================================
   364:     // + Stuff added later by bb/C/Lean/Zero/Mod...?
   365:     // ########### WORK IN PROGRESS / TBD ###########
   366:     //===============================================
   367: 
   368:     ,SN_ISSTYLE070              // bool*
   369:     ,SN_SLIT                    // StyleItem*
   370: 
   371:     ,SN_MENUSEPMARGIN           // int*
   372:     ,SN_MENUSEPCOLOR            // COLORREF*
   373:     ,SN_MENUSEPSHADOWCOLOR      // COLORREF*
   374:     ,SN_MENUGRIP                // StyleItem*
   375: 
   376:     ,SN_LAST
   377: };
   378: 
   379: #define SN_HANDLEHEIGHT SN_HANDLEWIDTH // ...used by BBZero? (see enum above) + SN_HANDLEHEIGHT matches the corresponding bb4nix window.handleHeight definition 
   380: 
   381: //===========================================================================
   382: //===========================================================================
   383: //===========================================================================
   384: 
   385: typedef struct StyleItemImage
   386: {
   387:     char path[MAX_PATH];
   388:     HBITMAP bitmap;
   389:     bool argb;
   390:     int mode; // Note: Only "stretched" supported for now == included for forwards compatibility only.
   391:     int width;
   392:     int height;
   393:     int left;
   394:     int top;
   395:     int right;
   396:     int bottom;
   397: } StyleItemImage;
   398: 
   399: typedef struct StyleItem
   400: {
   401: public:
   402:     int bevelstyle;
   403:     int bevelposition;
   404:     int type;
   405:     bool parentRelative;
   406:     bool interlaced;
   407: 
   408:     COLORREF Color;         // -> Color1
   409:     COLORREF ColorTo;       // -> Color2
   410:     COLORREF TextColor;
   411:     int FontHeight;
   412:     int FontWeight;
   413:     int Justify;
   414:     int validated;          // bbLean (not used by xoblite)
   415:     char Font[128];
   416: 
   417:     int nVersion;           // bbLean (not used by xoblite)
   418:     int marginWidth;
   419:     int borderWidth;
   420:     COLORREF borderColor;
   421:     COLORREF foregroundColor;
   422:     COLORREF disabledColor;
   423:     bool bordered;
   424: 
   425:     bool FontShadow;
   426:     union // BlackboxZero 1.4+ preliminary? (read: we really need to re-align some basic API definitions/assumptions across branches some day)
   427:     {
   428:         struct { char ShadowX; char ShadowY; };
   429:         unsigned short ShadowXY;
   430:     };
   431:     COLORREF ShadowColor;
   432:     bool FontOutline;
   433:     COLORREF OutlineColor;
   434: 
   435:     COLORREF Color3;
   436:     COLORREF Color4;
   437: 
   438:     COLORREF Color5;
   439:     COLORREF Color6;
   440:     COLORREF Color7;
   441:     COLORREF Color8;
   442: 
   443:     StyleItemImage Image;
   444: 
   445: //  char reserved[62];      // BlackboxZero failsafe: Adjust to maintain sizeof(StyleItem) == 300. (### DEPRECATED ###)
   446: 
   447: } StyleItem;
   448: 
   449: //#define PicColor TextColor
   450: #define PicColor foregroundColor 
   451: #define BulletColor foregroundColor 
   452: #define Color1 Color 
   453: #define Color2 ColorTo 
   454: 
   455: #define CORE_SHELL_STYLEITEM 315185 // "core" (c=3, o=15, r=18, e=5) -> Special "nVersion" value used to detect if a given StyleItem belongs to the core shell or not... 
   456: 
   457: //====================
   458: 
   459: class Menu;
   460: class MenuItem;
   461: 
   462: //===========================================================================
   463: //===========================================================================
   464: //===========================================================================
   465: 
   466: extern "C"
   467: {
   468:     DLL_EXPORT LPCSTR GetBBVersion();
   469:     DLL_EXPORT HWND GetBBWnd();
   470:     DLL_EXPORT LPCSTR GetOSInfo();
   471:     DLL_EXPORT bool WINAPI GetBlackboxPath(LPSTR path, int maxLength);
   472: 
   473:     //====================
   474: 
   475:     DLL_EXPORT HINSTANCE BBExecute(HWND Owner, LPCSTR szOperation, LPCSTR szCommand, LPCSTR szArgs, LPCSTR szDirectory, int nShowCmd, bool noErrorMsgs);
   476:     DLL_EXPORT void BBSmartExecute(LPSTR inputString);
   477: 
   478:     DLL_EXPORT void Log(LPCSTR variable, LPCSTR description);
   479:     DLL_EXPORT int MBoxErrorFile(LPCSTR szFile);
   480:     DLL_EXPORT int MBoxErrorValue(LPCSTR szValue);
   481: 
   482:     //====================
   483: 
   484:     DLL_EXPORT LPSTR Tokenize(LPCSTR sourceString, LPSTR targetString, LPSTR delimiter);
   485:     DLL_EXPORT int BBTokenize (LPCSTR sourceString, LPSTR* targetStrings, DWORD numTokensToParse, LPSTR remainingString);
   486:     DLL_EXPORT bool IsInString(LPCSTR inputString, LPCSTR searchString);
   487:     bool IsInStringUnicode(LPWSTR inputString, LPWSTR searchString);
   488: 
   489:     //====================
   490: 
   491:     bool GetConfigFilePath(LPSTR filePath, LPCSTR setPath, LPCSTR checkName1, LPCSTR checkName2);
   492:     DLL_EXPORT LPCSTR ConfigFileExists(LPCSTR filename, LPCSTR pluginDir);
   493:     DLL_EXPORT bool FileExists(LPCSTR szFileName);
   494:     DLL_EXPORT bool FolderExists(LPCSTR szFolderPath);
   495: 
   496:     DLL_EXPORT LPCSTR bbrcPath(LPCSTR bbrcFileName=NULL);
   497:     DLL_EXPORT LPCSTR extensionsrcPath(LPCSTR extensionsrcFileName=NULL);
   498:     DLL_EXPORT LPCSTR plugrcPath(LPCSTR pluginrcFileName=NULL);
   499:     DLL_EXPORT LPCSTR menuPath(LPCSTR menurcFileName=NULL);
   500:     DLL_EXPORT LPCSTR stylePath(LPCSTR styleFileName=NULL);
   501: 
   502:     DLL_EXPORT void GetBlackboxEditor(LPSTR editor);
   503: 
   504:     //====================
   505: 
   506:     DLL_EXPORT bool DownloadFile(LPCSTR url, LPCSTR path);
   507: 
   508:     DLL_EXPORT FILE *FileOpen(LPCSTR fileName);
   509:     DLL_EXPORT bool FileClose(FILE *filePointer);
   510:     DLL_EXPORT bool FileRead(FILE *filePointer, LPSTR readString);
   511: 
   512:     int GetParentFolder(LPSTR path);
   513: 
   514:     //====================
   515: 
   516:     DLL_EXPORT LPSTR ReadValue(LPCSTR fp, LPCSTR keyword, LPLONG ptr = NULL);
   517:     DLL_EXPORT bool ReadBool(LPCSTR filePointer, LPCSTR string, bool defaultBool);
   518:     DLL_EXPORT int ReadInt(LPCSTR filePointer, LPCSTR string, int defaultInt);
   519:     DLL_EXPORT LPSTR ReadString(LPCSTR filePointer, LPCSTR string, LPSTR defaultString);
   520:     DLL_EXPORT COLORREF ReadColor(LPCSTR filePointer, LPCSTR string, LPCSTR defaultString);
   521:     DLL_EXPORT bool ReadNextCommand(FILE *filePointer, LPSTR readLine, DWORD lineLength);
   522: 
   523:     void WriteValue(LPCSTR fp, LPCSTR keyword, LPCSTR value);
   524:     DLL_EXPORT void WriteBool(LPCSTR filePointer, LPCSTR keyword, bool value);
   525:     DLL_EXPORT void WriteInt(LPCSTR filePointer, LPCSTR keyword, int value);
   526:     DLL_EXPORT void WriteString(LPCSTR filePointer, LPCSTR keyword, LPSTR value);
   527:     DLL_EXPORT void WriteColor(LPCSTR filePointer, LPCSTR keyword, COLORREF value);
   528: 
   529:     DLL_EXPORT void* GetSettingPtr(int index);
   530: 
   531:     DLL_EXPORT void ParseItem(LPCSTR szItem, StyleItem *item);
   532: 
   533:     DLL_EXPORT LPSTR StrRemoveEncap(LPSTR string);
   534: //  LPWSTR StrRemoveEncapUnicode(LPWSTR string);
   535:     DLL_EXPORT void ReplaceEnvVars(LPSTR string);
   536:     DLL_EXPORT void ReplaceShellFolders(LPSTR string);
   537:     DLL_EXPORT void ParseFontString(LPSTR string, StyleItem *item);
   538:     DLL_EXPORT void CheckFontSubstitution(LPSTR font);
   539:     COLORREF ParseLiteralColor(LPCSTR colour);
   540: 
   541:     int ParseDropFiles(HWND hwnd, WPARAM wParam);
   542: 
   543:     DLL_EXPORT bool CopyStringToClipboard(LPSTR string);
   544:     DLL_EXPORT bool RetrieveStringFromClipboard(LPSTR target);
   545: 
   546:     //====================
   547: 
   548:     // ##############################################################################################
   549:     // ### PRELIMINARY: Work-in-progress relative+adaptive positioning for plugins, cf. the core! ###
   550:     DLL_EXPORT void GetPositionEvolved(LPSTR placement, SIZE size, POINT* pt);
   551:     // ##############################################################################################
   552: 
   553:     // ###########################################################################################################
   554:     // ### PRELIMINARY: Intended as an *internal* helper function to MakeGradientEvolved() and DrawTextEvolved(), see below! ###
   555:     StyleItem* FindStyleElement(LPSTR styleElement); // Not to be exported! (*internal* helper function to MakeGradientEvolved() and DrawTextEvolved())
   556:     // ### PRELIMINARY: Intended to provide better isolation/abstraction than MakeStyleGradient by not passing pointers to unreliable (e.g. non version-handled) SI structs etc. ###
   557:     DLL_EXPORT bool MakeGradientEvolved(HDC hdc, RECT rect, LPSTR styleElement, bool drawBevel, bool drawBorder);
   558:     // ### PRELIMINARY: Intended as the "DrawText" companions to MakeGradientEvolved(), see above! ###
   559: //  bool DrawTextEvolvedEx(HDC hdc, RECT* rect, LPSTR styleElement, LPWSTR textUnicode, LPSTR textANSI, unsigned int fontHeightOverride, unsigned int format, bool getSize); // Unicode or ANSI (i.e. the more flexible option)
   560: //  DLL_EXPORT bool DrawTextEvolved(HDC hdc, RECT* rect, LPSTR styleElement, LPSTR text, unsigned int fontHeightOverride, unsigned int format, bool getSize); // ANSI only (i.e. the legacy option)
   561:     DLL_EXPORT bool DrawTextEvolved(HDC hdc, RECT* rect, LPSTR styleElement, LPWSTR textUnicode, LPSTR textANSI, unsigned int fontHeightOverride, unsigned int format, bool getSize); // Unicode or ANSI (i.e. the more flexible option)
   562:     // ### PRELIMINARY: Intended as a "dynamic sizing" complement to MakeGradientEvolved() and DrawTextEvolved(), see above! ###
   563:     DLL_EXPORT int GetMetricsEvolved(LPSTR styleElement, int metricsToInclude);
   564:     // ###########################################################################################################
   565: 
   566:     DLL_EXPORT void MakeGradientSuper(HDC hdc, RECT rect, int type, COLORREF color1, COLORREF color2, COLORREF color3, COLORREF color4, COLORREF color5, COLORREF color6, COLORREF color7, COLORREF color8, bool bInterlaced, int bevelStyle, int bevelPosition, int bevelWidth, COLORREF borderColour, int borderWidth);
   567:     DLL_EXPORT void MakeGradientEx(HDC hdc, RECT rect, int gradientType, COLORREF colourFrom, COLORREF colourTo, COLORREF splitFrom, COLORREF splitTo, bool interlaced, int bevelStyle, int bevelPosition, int bevelWidth, COLORREF borderColour, int borderWidth);
   568:     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);
   569: 
   570:     DLL_EXPORT void MakeStyleGradient(HDC hdc, RECT* rect, StyleItem* item, bool withBorder);
   571:     DLL_EXPORT HFONT CreateStyleFont(StyleItem *item);
   572: 
   573:     DLL_EXPORT void CreateBorder(HDC hdc, RECT* rect, int borderColour, int borderWidth);
   574:     DLL_EXPORT void CreateBorderSuper(HDC hdc, RECT rect, int type, COLORREF color1, COLORREF color2, COLORREF color3, COLORREF color4, COLORREF color5, COLORREF color6, COLORREF color7, COLORREF color8, int borderWidth);
   575: 
   576:     // ##########################################################################################################
   577:     // ### PRELIMINARY: New internal functions related to per element images, introduced in xoblite bb5 RC6!  ###
   578:     void CreateElementImage(StyleItem* styleItem);
   579:     void DrawImageIntoRect(HDC hdc, RECT r, StyleItem* styleItem, bool useAlpha, bool drawBorder);
   580:     // ##########################################################################################################
   581: 
   582:     void DrawTextWithEffectsEx(HDC hdc, RECT r, LPWSTR textUnicode, LPSTR textANSI, unsigned int format, COLORREF textColor, bool outline, COLORREF outlineColor, bool shadow, COLORREF shadowColor, int shadowX, int shadowY);
   583:     DLL_EXPORT void DrawTextWithEffects(HDC hdc, RECT r, LPSTR text, unsigned int format, COLORREF textColor, bool outline, COLORREF outlineColor, bool shadow, COLORREF shadowColor, int shadowX, int shadowY);
   584:     void DrawTextWithEffectsUnicode(HDC hdc, RECT r, LPWSTR text, unsigned int format, COLORREF textColor, bool outline, COLORREF outlineColor, bool shadow, COLORREF shadowColor, int shadowX, int shadowY);
   585:     DLL_EXPORT void DrawSatHueIcon(HDC hdc, RECT r, HICON icon, int size, int saturation, int hue);
   586: 
   587:     // ##########################################################################################################
   588:     // ### PRELIMINARY: DPI-adaptive common glyphs drawing function, introduced in xoblite bb5 RC6!  ###
   589:     DLL_EXPORT void DrawGlyph(HDC hdc, RECT r, int glyph, COLORREF glyphColor);
   590:     // ##########################################################################################################
   591: 
   592:     //====================
   593: 
   594:     // ##########################################################################################################
   595:     // ### PRELIMINARY: New functions related to per pixel alpha transparency, introduced in xoblite bb4/bb5! ###
   596:     DLL_EXPORT void AlphaRect(HDC hdc, RECT rect, unsigned char alpha);
   597:     DLL_EXPORT void AlphaBorder(HDC hdc, RECT rect, unsigned char alpha, int borderWidth);
   598:     DLL_EXPORT void AlphaCorner(HDC hdc, RECT rect, int corner, int bevelStyle, int bevelPosition, int bevelWidth, int borderWidth, unsigned char minAlpha, unsigned char maxAlpha);
   599:     DLL_EXPORT void AlphaFromRGB(HDC hdc, RECT rect, unsigned char minAlpha, unsigned char maxAlpha, bool recolor, COLORREF color);
   600:     void AlphaMask(HDC destHdc, RECT destRect, HDC srcHdc, RECT srcRect, bool useSrcRGBAsAlpha); // Work in progress... (may also be scrapped)
   601:     DLL_EXPORT void AlphaApply(HDC hdc, RECT rect);
   602:     DLL_EXPORT void PrepareCorner(HDC hdc, RECT rect, int corner, int bevelStyle, int bevelPosition, int bevelWidth, int borderWidth);
   603:     DLL_EXPORT int PrepareCornerEvolved(HDC hdc, RECT rect, int corner, LPSTR styleElement);
   604:     // ##########################################################################################################
   605: 
   606:     //====================
   607: 
   608:     DLL_EXPORT Menu *MakeMenu(LPCSTR HeaderText);
   609:     DLL_EXPORT void DelMenu(Menu *PluginMenu);
   610:     DLL_EXPORT Menu *MakeNamedMenu(LPCSTR HeaderText, LPCSTR MenuId, bool popup);
   611: 
   612:     DLL_EXPORT MenuItem *MakeSubmenu(Menu *ParentMenu, Menu *ChildMenu, LPCSTR Title);
   613: 
   614:     DLL_EXPORT MenuItem *MakeMenuItem(Menu *PluginMenu, LPCSTR Title, LPCSTR Cmd, bool ShowIndicator);
   615:     DLL_EXPORT MenuItem* MakeMenuItemBool(Menu* PluginMenu, LPCSTR Title, LPCSTR Cmd, bool state, int selectionGroup);
   616:     DLL_EXPORT MenuItem *MakeMenuItemInt(Menu *PluginMenu, LPCSTR Title, LPCSTR Cmd, int val, int minval, int maxval);
   617:     DLL_EXPORT MenuItem *MakeMenuItemString(Menu *PluginMenu, LPCSTR Title, LPCSTR Cmd, LPCSTR init_string);
   618:     DLL_EXPORT MenuItem* MakeMenuNOP(Menu* PluginMenu, LPCSTR Title);
   619: 
   620:     DLL_EXPORT void ShowMenu(Menu *PluginMenu);
   621: 
   622:     //====================
   623: 
   624:     DLL_EXPORT bool IsAppWindow(HWND hwnd);
   625:     DLL_EXPORT bool SetTransparency(HWND hwnd, BYTE alpha);
   626:     DLL_EXPORT bool SetTransparencyEx(HWND hwnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags);
   627:     DLL_EXPORT void SnapWindowToEdge(WINDOWPOS* windowPosition, int snapDistance, bool useScreenSize);
   628: 
   629:     //====================
   630: 
   631:     DLL_EXPORT void MakeSticky(HWND window);
   632:     DLL_EXPORT void RemoveSticky(HWND window);
   633:     DLL_EXPORT bool CheckSticky(HWND window);
   634:     DLL_EXPORT void ToggleSticky(HWND window);
   635:     void ClearSticky();
   636: 
   637:     //====================
   638: 
   639:     typedef struct string_node
   640:     {
   641:         struct string_node *next;
   642:         char str[1];
   643:     } string_node;
   644: 
   645:     class DesktopInfo
   646:     {
   647:         public:
   648:             char name[32];  // Name of the workspace
   649:             bool isCurrent; // Is this the current workspace?
   650:             int number;     // Workspace number
   651:             int ScreensX;   // Total number of workspaces (for bbLean compatibility only)
   652:             string_node *deskNames; // List of all workspace names (for bbLean compatibility only)
   653:     };
   654: 
   655:     DLL_EXPORT void GetDesktopInfo(DesktopInfo *deskInfo);
   656: 
   657:     //====================
   658: 
   659:     // Support for external system trays (e.g. BBTray)
   660:     // ### Note: Deprecated in xoblite bb5 with the removal of the tray subsystem (note: now always running on top of Explorer!),
   661:     // kept for basic API compatibility with legacy plugins but "returns nothing". ###
   662: 
   663:     typedef struct
   664:     {
   665:         HWND    hWnd;
   666:         UINT    uID;
   667:         UINT    uCallbackMessage;
   668:         HICON   hIcon;
   669:         char    szTip[256];
   670:         int     x,y;
   671:         RECT    iconRect;
   672:         // For balloon tooltips (for [legacy?] xoblite internal use only, not aligned with bb4win/bbLean!)
   673:         char    szInfoTitle[64];
   674:         char    szInfo[256];
   675:         DWORD   dwInfoFlags;
   676:         UINT    uTimeout;
   677:         UINT    uVersion; // Temporary, we should definitely try to sync our tray icon structs among the devs... Perhaps general stuff + NOTIFYICONDATAV6?
   678:         GUID guidItem; // Temporary, used by later versions of Windows
   679:     } trayIconItem;
   680: 
   681:     // ### Note: xoblite bb5 onwards is always running alongside Explorer as an "extended shell" (i.e. rather than being an "alternative" == replacement shell like in the old days).
   682:     // The following functions have therefore been kept for basic API compatibility only; the systray itself was removed in xoblite bb5 and hence these functions will "return nothing". ###
   683:     DLL_EXPORT int GetTraySize();
   684:     DLL_EXPORT trayIconItem* GetTrayIcon(int pointer);
   685:     DLL_EXPORT bool GetUnderExplorer();
   686: 
   687:     //====================
   688: 
   689:     // Support for external taskbars (NOTE: Not all bb4win functions are supported!)
   690: 
   691:     DLL_EXPORT int GetTaskListSize();
   692:     DLL_EXPORT void SetTaskWorkspace(HWND hwnd, int workspace);
   693:     DLL_EXPORT int GetTaskWorkspace(HWND hwnd);
   694:     DLL_EXPORT HWND GetTask(int pointer);
   695:     DLL_EXPORT int GetActiveTask();
   696: /*
   697:     DLL_EXPORT struct tasklist* GetTaskListPtr(void);
   698: 
   699:     struct tasklist // Note: This was the legacy bb4win definition at least -> Possibly/likely revised by others later on (?)
   700:     {
   701:         struct tasklist *next;
   702:         HWND  hwnd;
   703:         HICON icon;
   704:         int   wkspc;
   705:         //bool hidden;
   706:         char  caption[256];
   707:     };
   708: */
   709:     bool IsOnTaskbar(HWND hwnd);
   710:     DLL_EXPORT HWND IsAppRunning(LPSTR path); // STILL EXPERIMENTAL (SUBJECT TO CHANGE)
   711: 
   712:     //====================
   713: 
   714:     // Note: The following stuff was included purely for basic compatibility with the
   715:     // bb(C)Lean(Mod)(Zero) modified BBApi, to be able to load e.g. the bbinterfaceMod_iTunes plugin...
   716: 
   717:     #define BBWS_TOGGLESTICKY     12 /* lParam: hwnd or NULL for foregroundwindow */ 
   718:     #define BBWS_MAKESTICKY       14 /* lParam: hwnd or NULL for foregroundwindow */ 
   719:     #define BBWS_CLEARSTICKY      15 /* lParam: hwnd or NULL for foregroundwindow */ 
   720:     #define BBWS_TOGGLEONTOP      17 /* lParam: hwnd or NULL for foregroundwindow */ 
   721: 
   722:     DLL_EXPORT HMONITOR GetMonitorRect(void* from, RECT* r, int Flags);
   723: };
   724: 
   725: //===========================================================================
   726: 
   727: #endif /* __BBAPI_H_ */ 
   728: