Iup4D

August 9, 2017 · View on GitHub

Iup4D is a D binding library for IUP with OOP style. Its API is similar to WinForms.

Copyright © 2016-2017 BitWorld. All Rights Reserved.

License

This software is licensed under the Boost Software License, Version 1.0.

For more details, see the full text of the license in the file Boost.txt.

Requirements

ToolsVersion
DMD2.075
DUB1.4.0
Visual D0.45.0
IUP3.22
DerelictGL32.0

Build status

PlatformBuildingRuning
Windows x86(mscoff)succeededsucceeded
Windows x64succeededIupTest crashed
LinuxTodoTodo

Example

module main;

import std.stdio;
import core.stdc.stdlib; 

import iup;
import toolkit;

version(Windows) { 
    pragma(lib, "iup.lib");
    pragma(lib, "iupimglib.lib"); // required only if function IupImageLibOpen() is called
    pragma(lib, "iupim.lib");
    pragma(lib, "im.lib");
    pragma(lib, "iupcontrols.lib");
    pragma(lib, "iupgl.lib");
    pragma(lib, "opengl32.lib");
    pragma(lib, "iupglcontrols.lib");

    pragma(lib, "iupcd.lib");
    pragma(lib, "cd.lib");
    pragma(lib, "cdgl.lib");
    pragma(lib, "cdpdf.lib"); 
}

int main(string[] argv)
{
    Application.open();
    Application.useImageLib();

    MainForm mainForm = new MainForm();
    Application.run(mainForm);

	return EXIT_SUCCESS;
}


class MainForm : IupDialog
{
    this()  { super(); }

    protected override void initializeComponent()
    {
        IupLinkLabel linkButton = new IupLinkLabel("http://www.tecgraf.puc-rio.br/iup", "IUP Toolkit");
        linkButton.linkClicked += &linkLabel_linkClicked;

        IupVbox vbox = new IupVbox(linkButton);
        vbox.alignment = HorizontalAlignment.Center;

        this.child = vbox;
        this.margin = Size(10, 10);
        this.title = "Iup Demo";
        this.rasterSize = Size(300, 200);

        this.loaded += &dialog_loaded;
        this.closing += &dialog_closing;
    }

    private void dialog_loaded(Object sender, CallbackEventArgs args)
    {
        // do something after the dialog is loaded
    }

    private void dialog_closing(Object sender, CallbackEventArgs e)
    {
        e.result = IupElementAction.Close;
    }

    private void linkLabel_linkClicked(Object sender, CallbackEventArgs e, string url)
    {
        writefln("url (%s)", url);
    }
}

Directories

NameDescription
Iup4DThe core library
DerelictOrgOpenGL binding library
IupTestThe test program for Iup4D
ExamplesSome simple demos for Iup4D
ThirdpartiesThe import librares from IUP

Build

Preparation

  • Windows
  1. IUP libraries

Download the IUP develop libraries and extract all .lib files to the Thirdparties directory. See also, Readme.md.

  1. Resource compiler

It can be found in C:\Program Files (x86)\Windows Kits\10\bin\x86 on Windows 10. Make sure that it can be searched in environment variable PATH.

Visual D

You can use Visual D to build Iup4D on Windows.

DUB

  1. build core lib
dub build --arch=x86_mscoff --build=release --compiler=dmd
  1. build examples
dub build :simple-demo --arch=x86_mscoff --build=release --compiler=dmd
dub build :windows-demo --arch=x86_mscoff --build=release --compiler=dmd
dub build :simple-paint --arch=x86_mscoff --build=release --compiler=dmd
dub build :iup-test --arch=x86_mscoff --build=release --compiler=dmd

Screenshots

Paint Button

Todo

  • Bind more APIs for more controls
  • Port more test examples
  • Check and fix memory leak bugs
  • Stable API for wrapper librarys

Acknowledgement

NameURL
Tecgrafhttp://webserver2.tecgraf.puc-rio.br/iup/
DMDhttps://dlang.org/
Visual Dhttps://github.com/dlang/visuald
mogud/iupdhttps://github.com/mogud/iupd
carblue/iuphttps://github.com/carblue/iup
DerelictOrghttps://github.com/DerelictOrg
DGuihttps://bitbucket.org/dgui/dgui