Menu

#165 TTooltip overhaul

8
open
API (105)
1
2022-12-29
2020-06-18
No

While TTooltip has been improved over the years, it is still awkward to use.

I propose we change that and thoroughly overhaul it for usability and safety.

  • Functions like TToolInfo::GetRect should return the result in the function return value, not take output parameters. Also, where applicable, we should use exceptions instead of error return value.

  • TTooltip should minimise the use of the complex TToolInfo parameter package, and instead use explicit overloads with the parameters needed. TToolInfo should ideally be used only for returning packaged information about a tool. For simple enquires, such as GetText, a simple string should be returned instead. TToolInfo, with its internal text buffer, should be made safe to copy, and slicing issues should be prevented, i.e. operations that leaves the base structure separated from the buffer.

  • Iterating over the registered tools and accessing individual tools should be made simpler. I propose TTooltip::GetTools, returning a range that can be iterated over in the standard ways (e.g. with a range-based for-loop). And GetTool (int toolIndex), to complement GetToolCount.

  • All functions, that need to identify the tool operated on, should support all ways of identifying a tool, i.e. by index, by tool window and ID (for rectangle tools) and by tool parent window and child window (for control tools). Due to the confusing multitude of options here, the documentation must be clear. E.g. a "tool window" is a window containing tools (rectangles or controls), not a control tool (even if a control is a tool and a window). Perhaps a clearer term would be "tool container".

  • Missing functions (relative to the Windows API) should be added, e.g. TTooltip::SetTitle encapsulating TTM_SETTITLE.

  • Awkward and brittle functions should be relegated to OWL5_COMPAT mode or removed, e.g. TToolInfo::GetToolWindow (misleading).

  • Documentation should be improved, with links into the Windows API documentation where applicable.

Related

Commit: [r6342]
Commit: [r6870]
Commit: [r6918]
Wiki: OWLNext_Roadmap_and_Prereleases

Discussion

  • Vidar Hasfjord

    Vidar Hasfjord - 2020-06-18

    I've started working on this in [r5168].

     

    Related

    Commit: [r5168]

  • Vidar Hasfjord

    Vidar Hasfjord - 2020-06-25

    All the remaining requested features and changes have now been implemented in [r5201]. The changes have been merged into Owlet [r5170] [r5324].

     

    Related

    Commit: [r5170]
    Commit: [r5201]
    Commit: [r5324]


    Last edit: Vidar Hasfjord 2022-07-23

Anonymous
Anonymous

Add attachments
Cancel