gokernel
(usa Linux Mint)
Enviado em 23/08/2010 - 07:42h
Olá.
Para trabalhar com uma API que use janelas, você pode usar uma dessas:
FLTK:
http://www.fltk.org/
###################################################
____________________________________________________
// Exemplo de um programa usando FLTK:
#include <stdlib.h>
#include <stdio.h>
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_Return_Button.H>
#include <FL/Fl_Repeat_Button.H>
#include <FL/Fl_Check_Button.H>
#include <FL/Fl_Light_Button.H>
#include <FL/Fl_Round_Button.H>
#include <FL/Fl_Tooltip.H>
int main(int argc, char ** argv) {
Fl_Window *window = new Fl_Window(320,130);
(new Fl_Button(10, 10, 130, 30, "Fl_Button"))->tooltip("This is a Tooltip.");
new Fl_Return_Button(150, 10, 160, 30, "Fl_Return_Button");
new Fl_Repeat_Button(10,50,130,30,"Fl_Repeat_Button");
new Fl_Light_Button(10,90,130,30,"Fl_Light_Button");
new Fl_Round_Button(150,50,160,30,"Fl_Round_Button");
new Fl_Check_Button(150,90,160,30,"Fl_Check_Button");
window->end();
window->show(argc,argv);
return Fl::run();
}
____________________________________________________
GTK:
http://www.gtk.org/
###################################################
____________________________________________________
// Exemplo de um programa usando GTK:
#include <gtk/gtk.h>
int main (int argc, char *argv[]) {
GtkWidget *window;
GtkWidget *label;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_container_border_width (GTK_CONTAINER (window), 10);
label = gtk_label_new ("Hello World");
gtk_container_add (GTK_CONTAINER (window), label);
gtk_widget_show (label);
gtk_widget_show (window);
gtk_main ();
return 0;
}
____________________________________________________
QT:
http://qt.nokia.com/
###################################################
____________________________________________________
// Exemplo de um programa usando QT:
#include <QApplication>
#include <QPushButton>
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
QPushButton hello("Hello world!");
hello.resize(100, 30);
hello.show();
return app.exec();
}
____________________________________________________
Minha biblioteca libAS, que usa ALLEGRO/SDL
http://sourceforge.net/projects/libas/files/
###################################################
____________________________________________________
// Exemplo de um programa usando libAS:
#include "as.h"
AS_win *win;
int call_button_hello (AS_obj *O) {
AS_data_button *data = (AS_data_button*)O->data;
if(data)
AS_win_show_message ("The 'data->text' this object is: %c%s%c", '"',(char*)data->text,'"');
return 0;
}
int call_button_exit (AS_obj *O) {
//AS_quit = AS_QUIT_QUIT; // Exit direct no asking.
AS_quit = AS_QUIT_ASK; // Exit of program asking.
return AS_O_CLOSE;
}
int main (int argc, char *argv[]) {
AS_app_init (argc, argv);
win = AS_win_new (AS_W_VISIBLE|AS_W_MOVEABLE|AS_W_MAXIMIZABLE, 250,180,320,240, "A basic program using libAS",-1);
AS_new_button (15,100,130,25, 'h', AS_O_EXIT, -1, win,
gui_fg_color,0, 0, "Hello World(H)", NULL, call_button_hello);
AS_new_button (175,100,130,25, AS_KEY_F1, AS_O_EXIT, -1, win,
gui_fg_color,0, 0, "EXIT(F1)", NULL, call_button_exit);
//----------------------------------------------------
// Main loop.
// If KeyPressed F12 out of WINDOW... Exit of program.
//----------------------------------------------------
AS_app_run ();
return 0;
}
#ifdef ALLEGRO_H
END_OF_MAIN();
#endif
____________________________________________________
####################################################
Cada uma dessas APIs tem o seu próprio criador de "forms(janelas/botoes,etc)".
OBS: Para criar janelas usando a libAS, você pode usar o programa AS-IDE(cria OBJETOS só clicando).
ESCOLHA UMA DESSAS E BONS ESTUDOS.
Abraços.
gokernel
gokernel@hotmail.com