FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

progress update: Button and FlowLayout

 
Post new topic   Reply to topic     Forum Index -> MinWin
View previous topic :: View next topic  
Author Message
BenHinkle



Joined: 27 Mar 2004
Posts: 76

PostPosted: Sun Dec 19, 2004 1:23 pm    Post subject: progress update: Button and FlowLayout Reply with quote

This weekend I got some layout management going and defined a basic push button. It still isn't much to look at but for those curious I've posted the library at
http://home.comcast.net/~benhinkle/minwin/minwin.zip

The class hierarchy implemented so far:
Component
AbstractWindow
Window
WindowChild
AbstractButton
Button
Layout (interface)
FlowLayout : Layout
Application

Here's the sample updated to include a couple of buttons:
/* Sample MinWin application
*
* To build first build minwin.lib in the top level directory. Then run
* dmd sample.d sample.def -I..\.. ..\minwin.lib gdi32.lib phobos.lib ..\app.obj
* note the ..\app.obj is required to make sure the WinMain is included
* in the final exe.
*
* To build using Motif on Linux build minwin and then
* dmd sample.d -I../.. ../libminwin_motif.a -L-L/usr/X11R6/lib -L-lXm -L-lXt
* -L-lX11 -version=Motif
*
* Written by Ben Hinkle and released to the public domain, as
* explained at http://creativecommons.org/licenses/publicdomain
* Email comments and bug reports to ben.hinkle@gmail.com
*/
module minwin.sample;

import minwin.all;
import std.random;
import std.string;

extern (C)
int MinWinMain(Application app) {
Window f = new Window("Testing");
char[] text = "D Does Windows and Motif";
f.quitOnDestroy = true;
f.paintDelegate ~= delegate void(Component source, PaintContext* pc) {
FontData fd;
fd.size = 12;
fd.weight = FontWeight.Bold;
auto Font font = new Font(&fd);
Font oldfont = pc.setFont(font);
pc.drawText(100,100,text);
pc.setFont(oldfont);
};
Button b = new Button(f,"Press me");
Button b2 = new Button(f,"no press me");
f.layoutMgr = new FlowLayout;
b.actionDelegate ~= delegate void(Component source) {
// informationDialog(f, "Hello, world!", "Greeting");
text = toString(rand());
f.repaint();
};
f.pack(); // doesn't do anything yet
f.visible = true;
return app.enterEventLoop();
}
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> MinWin All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group