Discussing the article: "MQL5 Trading Tools (Part 30): Class-Based Tool Palette Sidebar"

 

Check out the new article: MQL5 Trading Tools (Part 30): Class-Based Tool Palette Sidebar.

We refactor the Tools Palette from a flat, function-based panel into a modular, class-driven sidebar in MQL5. The design introduces supersampled canvas rendering for anti-aliased shapes, theme control, a category registry, snap alignment, and selective corner rounding. The result is a reusable, scalable sidebar foundation that you can extend with tool selection, dragging, and fly-out menus in future steps.

The redesign replaces the flat structure with a vertical sidebar built on a layered class hierarchy. Each class has a single responsibility. For example: primitives handle anti-aliased drawing, the theme manager controls color sets, the registry stores categories, the canvas layer manages resizing, the layout class computes geometry, and the renderer composes the final sidebar. Adding a new tool category becomes a matter of registering a definition rather than reworking the entire rendering loop.

On the chart, this compact vertical sidebar gives you quick access to drawing categories during live sessions without obstructing price action. Snap alignment pins it flush to a chart edge, and theme toggling instantly matches the palette to your chart background. As you add custom tool groups for your own analysis, the sidebar grows cleanly without layout conflicts. We will define icon mappings and enumerations, declare input parameters, and construct the class hierarchy. The top-level sidebar shell will initialize, render, and forward events. In a nutshell, here is a visualization of what we will be creating.

SNAP TOOLS PALETTE ARCHITECTURE


Author: Allan Munene Mutiiria