• Hello MLAers! We've re-enabled auto-approval for accounts. If you are still waiting on account approval, please check this thread for more information.

Clapkit: A C++ Wrapper for Macintosh Toolbox functions

flexo

6502
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:

C++:
// 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!
 
Last edited:
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?
 
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.
 
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.
 
Back
Top