pixmap
{ $Id: pixmap.pp,v 1.3 2005/02/14 17:13:20 peter Exp $ This file extracted from the GTK tutorial. pixmap.c Converted from C to Pascal by Frank Loemker <floemker@techfak.uni-bielefeld.de> } program pixmap; uses glib,gdk,gtk; { XPM data of Open-File icon } const xpm_data:array[0..19] of pchar = ('16 16 3 1', ' c None', '. c #000000000000', 'X c #FFFFFFFFFFFF', ' ', ' ...... ', ' .XXX.X. ', ' .XXX.XX. ', ' .XXX.XXX. ', ' .XXX..... ', ' .XXXXXXX. ', ' .XXXXXXX. ', ' .XXXXXXX. ', ' .XXXXXXX. ', ' .XXXXXXX. ', ' .XXXXXXX. ', ' .XXXXXXX. ', ' ......... ', ' ', ' '); { when invoked (via signal delete_event), terminates the application. } procedure close_application(widget : pGtkWidget ; event: pGdkEvent ; data: pgpointer); cdecl; begin gtk_main_quit(); end; { is invoked when the button is clicked. It just prints a message. } procedure button_clicked(widget : pGtkWidget ; data: pgpointer); cdecl; begin writeln ('button clicked'); end; { GtkWidget is the storage type for widgets } var window, pixmapwid, button : pGtkWidget; thepixmap : pGdkPixmap; mask : pGdkBitmap; style : pGtkStyle; begin { create the main window, and attach delete_event signal to terminating the application } gtk_init( @argc, @argv ); gtk_rc_init; window := gtk_window_new( GTK_WINDOW_TOPLEVEL ); gtk_signal_connect (pGTKOBJECT (window), 'delete_event', GTK_SIGNAL_FUNC (@close_application), NIL ); gtk_container_set_border_width( pGTKCONTAINER (window), 10 ); gtk_widget_show( window ); { now for the pixmap from gdk } style := gtk_widget_get_style( window ); thepixmap := gdk_pixmap_create_from_xpm_d( window^.window, @mask, @style^.bg[GTK_STATE_NORMAL], ppgchar (xpm_data )); { a pixmap widget to contain the pixmap } pixmapwid := gtk_pixmap_new( thepixmap, mask ); gtk_widget_show( pixmapwid ); { a button to contain the pixmap widget } button := gtk_button_new(); gtk_container_add( pGTKCONTAINER(button), pixmapwid ); gtk_container_add( pGTKCONTAINER(window), button ); gtk_widget_show( button ); gtk_signal_connect (pGTKOBJECT(button), 'clicked', GTK_SIGNAL_FUNC(@button_clicked), NIL ); { show the window } gtk_main (); end. { $Log: pixmap.pp,v $ Revision 1.3 2005/02/14 17:13:20 peter * truncate log }
Antes de comentar: Gran parte de los ejercicios propuestos no tienen librerías debido a que Wordpress las eliminó al verlas como etiquetas HTML. Si sabes/tienes/conoces las librerías que hacen falta, déjalo en los comentarios. Y lo mas importante: Todos los ejemplos fueron realizados por personas con únicamente conocimiento básico del lenguaje, no de programación.
Otro punto importante: Si vas a sugerir un segmento de código en algún lenguaje debes hacerlo así:
- Si es lenguaje C [c]Código en C[/c]
- Si es lenguaje Pascal [pascal]Aquí dentro el código de Pascal[/pascal].
De esta manera el código coloreas el código.
Otro punto importante para muchos que sienten que se les ignora: Todos los comentarios los reviso y en su debido momento los apruebo, pero ojo con el con lo siguiente:Me reservo el derecho de alterar, publicar o no los comentarios as´ como cambiar mis condiciones en el momento que así lo requiera.
¿estas de acuerdo? entonces adelante que ya te he quitado bastante tiempo leyendo esta basura de advertencias :)