68kMLA Classic Interface

This is a version of the 68kMLA forums for viewing on your favorite old mac. Visitors on modern platforms may prefer the main site.

Click here to select a new forum.
Clapkit: A C++ Wrapper for Macintosh Toolbox functions
Posted by: flexo on 2025-06-01 15:52:43
This is something I've working on for a while and since I am running out of steam, I thought posting it here might help to at least give me a boost if there is interest.

Clapkit ("CLassic APplication KIT") is a C++ wrapper for Macintosh Toolbox functions, allowing development using Retro68 using modern syntax. It (tries to) handle most of the "skeleton" functionality so you can focus on writing your app. Creating and showing a window is as simple as:

// Create a window, set title.
CKWindow* window = app->CKNewWindow(CKWindowInitParams(CKSize(300, 10)));
window->SetTitle("Hello!");

// Create a label, 10px away from edges.
int padding = 10;
CKLabel* label = CKNew CKLabel(CKSize(300 - (padding * 2), 20));
label->rect->origin->x = padding;
label->rect->origin->y = padding;
label->SetText("Hello world!");

// Why not make it red?
label->color = CKColor({255, 0, 0});

// Add it to the window.
window->AddControl(label);

// Show the window.
window->Show();

You don't have to initialize the toolbox, track controls, call DragWindow, SysClick, TrackGoAway, etc.

It's in VERY EARLY development and EXTREMELY limited right now, but it can still be used to create simple apps. Goal is to add support for Networking (MacTCP, at least), IPC, etc. before adding Carbon and hopefully, Cocoa support eventually, so you can compile an app for System 6 all the way to macOS 15.

Clapkit-Test-App.png
If you are interested, check it out at https://github.com/macinlink/clapkit and let me know what you think!
Posted by: greystash on 2025-06-02 15:46:34
Very cool! Thanks for sharing I'll have to try this out
Posted by: mndeaves on 2025-06-03 03:53:17
+1 that looks like a great idea, will try it out in my project as soon as I can
Posted by: Frobozz on 2025-06-05 19:15:05
Very interesting and ambitious project, love it! I never did C++ with THINK C, but was thinking of doing a project with it.

Any sense for how code efficient the resulting code is?
Posted by: flexo on 2025-06-05 20:11:09
Thank you all!

Any sense for how code efficient the resulting code is?
Even though writing code should be way faster for you, right now I'm just trying to get everything up and running so it's actually extremely inefficient runtime-wise, sometimes recreating/redrawing stuff multiple times even. (e.g. radioboxes with groups) - once most things are in place (working on MacTCP support now!) then I'll actually start optimization and start playing around with dead code stripping, etc.
Posted by: uridium on 2025-06-05 23:47:52
I wouldn't mind playing with this maybe this weekend and see if I can get it to work on Symantec C++ which is where I've been a lot.

MacTCP support is great but it'd be good if we could do an abstraction for OT on 7.1. I've seen a fair few people playing in this space.

Nice one.
1