A variety of useful Include Files for PureBasic projects
Most of these come from my own projects, others were written for the PB forums, and some were never used at all. Feel free to borrow, modify, and share. No credit required.
All files are "EnableExplicit safe" and "Multiple-include safe"
This provides an interface to the basic archive functions of 7-Zip - creation, examination, and extraction - with password support.
- Windows only
- ASCII/Unicode safe
- Demo included
- 7-Zip commandline version (7za.exe) is required
A set of encoder/decoder/helper functions to improve upon (or replace) PB's Base64 functions. Various conversions to/from strings, files, and memory buffers.
- Windows/Linux/Mac
- ASCII/Unicode safe
- Demo included
Helper functions to handle CanvasGadget events and simplify mouse dragging, selection, panning, etc.
- WindowFromGadget.pbi is also required
A few helper functions for dealing with Cocoa objects.
- Mac only (compiles but has no effect on other OS)
- ASCII/Unicode safe
Basic improvements to the ColorRequester. On all OS, this saves your last picked color between calls, and even between program runs if the UseFile
flag is specified. On Windows, it also lets you open a "full" size color chooser, and lets you specify and save the 16 "custom color" boxes.
- Windows/Linux/Mac
- ASCII/Unicode safe
- Demo included
Lots of handy constants, macros, and procedures for common tasks related to: data types, time and date, dialogs, gadgets, file I/O, file paths, drawing, images, strings, etc.
- Windows/Linux/Mac
- ASCII/Unicode safe
- os.pbi is also required
Functions and macros to handle complex numbers (32-bit float precision per each component) and the usual, basic operations on them. Long-name procedures are provided (such as Complex_Imaginary()
), as well as short-name macros (such as cImag()
).
- Windows/Linux/Mac
- ASCII/Unicode safe
- Demo included
Helper functions which greatly simplify the (eight) combinations of compressing/decompressing to/from memory/files. You can use the ZIP, LZMA, and BriefLZ packer plugins (default is ZIP).
- Windows/Linux/Mac
- ASCII/Unicode safe
- Demo included
- PB 5.10+ is required
Helper functions for dealing with multiple screens, parent and child windows, window states.
- Windows/Linux/Mac
- ASCII/Unicode safe
- Demo included
Custom canvas-based button which provides one clickable main action, plus a popup menu for secondary actions. Simulates a widget seen in some Microsoft programs.
- Windows/Linux/Mac
- ASCII/Unicode safe
- Demo included
This lets you Examine() and step through a list of environment paths. On Windows, this refers to the PATH
environment variable. On other OS, nothing is implemented yet.
- Windows only (compiles but has no effect on other OS)
- ASCII/Unicode safe
- Demo included
Provides timestamp-to-string formatting with the same options and syntax as PHP's date()
function.
- Windows/Linux/Mac
- ASCII/Unicode safe
- Demo included
A few functions to assist you in uploading/downloading/changing the directory in an FTP connection, by full path, instead of manually "walking" the server's directory structure.
- Windows/Linux/Mac
- ASCII/Unicode safe
- Demo included
Helper functions for handling the selected items, checked items, and item data of ListIconGadgets, ListViewGadgets, and TreeGadgets.
- Windows/Linux/Mac
- ASCII/Unicode safe
- Demo included
Reads EXIF metadata from image files (typically JPEG). Currently, it only reads the EXIF rotation (how the image should be rotated when displayed to the user).
- Windows/Linux/Mac
- ASCII/Unicode safe
- Demo included
- RotateImage.pbi is also required if you use
LoadImageEXIFRotated()
This is a Module for interacting with Mercurial (Hg
) SCM. Functionality includes creating and committing repos, examining changed files, generating a diff, examining the commit log.
- Windows only (not tested on Linux/Mac)
- ASCII/Unicode safe
- Demo included
- Mercurial (Hg) must be installed on you/the user's system
- PB 5.20+ is required
Various small improvements to native PB gadgets
- Windows only (compiles but has no effect on other OS)
- ASCII/Unicode safe
- Demo included
- StringGadget, ComboBoxGadget: adds Ctrl+Backspace word deletion
- ContainerGadget: reduces resize flickering by disabling some redraw events
- WebGadget: Disables annoying "Script Error" popups
Functions for reading/writing INI files. A replacement for PB's Preferences library, with added functionality, formatting options for the file and values, and helper functions. The similarities and differences are summarized in the comments near the top of the file.
- Windows/Linux/Mac
- ASCII/Unicode safe
- Demo included
Implements a simple Stack (Push
+ Pop
, with Peek
) of a fixed type (PB integer).
- Windows/Linux/Mac
- ASCII/Unicode safe
- Demo included
Basic JSON support (read/write/parse/modify) before PureBasic added its own JSON library in 5.30
- Windows/Linux/Mac
- ASCII/Unicode safe
- Demo included
- PB 5.30+: Use OJSON.pbi instead
- PB 5.20+: Compiles as a Module (
UseModule JSON
) - Before 5.20: Compiles as included procedures
Handy procedures, macros, and constants for simplifying JSON code, using PB's JSON library added in 5.30.
- Windows/Linux/Mac
- ASCII/Unicode safe
- Demo included
Provides a Requester
-like dialog window, which presents the user with a list of options as a ListView, ListIcon, or Tree gadget. Customizations include multiple-select, icons, and button placement. This is an older include; it should be rewritten with newer PB features and without the need for a user-managed List!
- Windows/Linux/Mac
- ASCII/Unicode safe
- Demo included
Custom canvas-based gadget for displaying and editing memory blocks as hex bytes or ASCII characters.
- Windows/Linux/Mac
- ASCII/Unicode safe
- Demo included
A variation of JSON.pbi, renamed to OJSON ("Ordered JSON") to avoid conflicts with PB 5.30+. Preserves the order of a JSON Object's members, unlike PB's JSON library. Not a Module.
- Windows/Linux/Mac
- ASCII/Unicode safe
- Demo included
Low-overhead code (constants and macros, no procedures) to simplify cross-platform programming
Convenient for handling different OS, filesystems, subsystems, ASCII vs. Unicode, x86 vs. x64
- Windows/Linux/Mac
- ASCII/Unicode safe
Helper functions to determine system colors for drawing. Also detect and react to OS theme changes (light or dark mode, accent colors, etc.) by callback, event, or polling.
- Windows/Mac (Linux not yet implemented)
- ASCII/Unicode safe
- Demo included
Two functions, to retreive the (string) name of the user's OS and OS version. (Example: "Windows" and "Windows 7")
- Windows/Linux/Mac
- ASCII/Unicode safe
Functions for parsing PureBasic's own .pbp
format project files. You can iterate through a project's targets, read basic information about them, and generate a string of appropriate pbcompiler
parameters.
- Windows/Linux/Mac
- ASCII/Unicode safe
- Demo included
A very simple file which tells you a #PB_Shortcut_*
constant's name string from its numeric value, or vice versa. You can also Debug all shortcut values with one Procedure call, or use the demo program to quickly map keypresses to #PB_Shortcut_*
constants.
- Windows/Linux/Mac
- ASCII/Unicode safe
- Demo included
Procedures for generating podcast feeds (RSS/XML files) from channel and episode data.
- Windows/Linux/Mac
- ASCII/Unicode safe
- Demo included
An implementation of a PropertyGadget, a custom scrollable gadget containing many types of child gadgets, which can be read/written by numeric index or string ID. Named headers divide them into groups, which can be collapsed or expanded.
- Windows only (not tested on Linux/Mac)
- ASCII/Unicode safe
- Demo included
Constants and function bindings for an incomplete (but growing) subset of the SDL2 API. Subsystems include Window, Texture, Renderer, Keyboard, Mouse, Joystick, GameController, Haptic. The library can be statically or dynamically linked by setting a compile switch constant.
- Windows only (not tested on Linux/Mac)
- ASCII/Unicode safe
Custom canvas-based gadget which allows the user to select a rating on a horizontal image bar. The default range is 5 stars (images included in DataSection). The images and range are changeable.
- Windows/Linux/Mac
- ASCII/Unicode safe
- Demo included
Simple helper functions for replacing, removing, matching, and extracting strings via RegEx patterns.
- Windows/Linux/Mac
- ASCII/Unicode safe
- Demo included
Many improvements to the Open/Save/Path Requesters. All parameters are made optional, file extensions are automatically recognized and appended, multiple-file selection is greatly simplified, missing default folders are detected, Mac quirks are corrected.
- Windows/Linux/Mac
- ASCII/Unicode safe
- Demo included
Rotate images 90/180/270 degrees, pixel-perfect, using API when possible. One versatile procedure lets you rotate an image in-place, rotate to another image ID, or rotate to a new #PB_Any
image.
- Windows/Linux/Mac
- ASCII/Unicode safe
- Demo included
This simplifies resizing images and image files to a single function call. Options include: stretch, fit, fill, tile, center, border color, alignment, raw/smooth interpolation.
- Windows/Linux/Mac
- ASCII/Unicode safe
- Demo included
This simplifies scanning folder contents to a single function call. Options include: recursive search, include folders, exclude hidden items, filter by extension, RegEx matching, absolute or relative results.
- Windows/Linux/Mac
- ASCII/Unicode safe
- Demo included
This include is very convenient when working with the ScintillaGadget
:
Automatically handles string conversion to and from UTF-8
Provides hundreds of named macros, so you don't need to pass #SCI_
constants and remember parameter order
Has extra procedures (names end in _
) for additional functionality
- Windows/Linux/Mac
- ASCII/Unicode safe
A small Windows include which provides PressKey(VK)
, ReleaseKey(VK)
, and TapKey(VK, msDelay)
functions for simulating keypresses to the active window. You can select between 3 types of keypress methods at compile time.
- Windows only
- ASCII/Unicode safe
- Demo included
A variety of useful procedures, macros, and constants for dealing with different string encodings, ASCII-to-Unicode updates, writing and parsing in memory, text file I/O.
Support for ASCII, Unicode (UTF-16), UTF-8, UTF-32
- Windows/Linux/Mac
- ASCII/Unicode safe
- Demo included
Gives you basic access and control of Winamp's playback status
Note: This is for controlling Winamp from an external program, not for writing Winamp plugin DLLs
- Windows only
- ASCII/Unicode safe
Provides helpful functions for custom gadget modules: GetWindowFromID()
, GetWindowFromGadget()
, GetBuildWindow()
- Fully implemented on Windows, partially on other OS
- Demo included
Handy procedures, macros, and constants for simplifying XML code, using PB's XML library.
- Windows/Linux/Mac
- ASCII/Unicode safe