• entries
    743
  • comments
    1924
  • views
    579187

Ox - Window Framework

Sign in to follow this  
Aardvajk

909 views

[source lang="cpp"]

#include <windows.h>

#include "OxApplication.h"
#include "OxWidget.h"
#include "OxMainWindow.h"
#include "OxPushButton.h"

class Window : public Ox::MainWindow
{
public:
Window();

private:
void changeTitle(Object *sender){ setWindowTitle("Clicked!"); }

Ox::PushButton *button;
};

Window::Window()
{
button = new Ox::PushButton("Button", centralWidget());

connect(button->clicked, &Window::changeTitle);

resize(Ox::Size(300, 300));
setWindowTitle("Ox::Widget Test");
}

int WINAPI WinMain(HINSTANCE hIn, HINSTANCE, LPSTR cmdLine, int show)
{
Ox::Application app;

Window mainWindow;
app.connect(mainWindow.destroyed, &Ox::Application::exit);

mainWindow.show();

return app.exec();
}
[/source]

So my latest random for-fun project is the most infeasible yet - a Qt-inspired Win32 wrapper. It'll never work. It's stupid.

Most interesting part really is the reimplementation from scratch of the old type-safe signals/slots mechanism with templates. Quite happy with the syntax for connecting. Ox::Object under the hood maintains a list of Slot objects so that disconnection is automatic when the owing object goes out of scope.

The only annoyance is that I have to have Ox::Signal, Ox::Signal1, Ox::Signal2 etc. Be really nice if there was some way of just having Ox::Signal etc but I gather that isn't possible.

Not really a template metaprogrammer so quite pleased to have got it working anyway. Current stupid plan is to develop this to the point where its sort of vaguely working, then use it to re-write Opus, the 3D modeller, from scratch as I'm bored with the current version and want all the goodness I get from Qt at work without all the hassle of, y'know, actually having to use Qt.

Stupid plan, stupid project, stupid idea.
Sign in to follow this  


2 Comments


Recommended Comments

Qt is awesome, clean, neat, and powerful. The only probably with writing code in Qt is that it makes [i]your/my[/i] code anything [i]but[/i] clean, neat, and powerful. [img]http://public.gamedev.net//public/style_emoticons/default/laugh.png[/img]

Somehow, as neat and well-thoughtout the Qt libraries are, it always makes the parts of my code that use it feel cludgy and messy. Maybe I have trouble embracing Qt paradynes or something.

Your library is looking good!

Share this comment


Link to comment
Yeah, I kinda agree, although at work where cross-platform is an actual requirement rather than a buzzword as its used on the forums here, its pretty invaluable to be able to so easily stay within the Qt arena for pretty much everything.

My project is purely for fun. I don't ever expect it to be more than 1% Qt-feature complete but I'm hoping to start developing a project with it when the basics are working, then add to it as I go.

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now