GtkTreeView+vscroll in hbox

2007-08-10 Thread Prasanna Kumar K
Hi,
 
 I want to place one gtktreeview(treeview) and one vertical scrollbar(vscroll) 
in one horizontal box(hbox).And at last want to pack this single horizontal box 
into a vertical box(vbox).
 
I have done this coding..
 
 gtk_box_pack_start (GTK_BOX(hbox), treeview, TRUE, TRUE, 0);
 gtk_box_pack_start (GTK_BOX(hbox), vscroll, TRUE, TRUE, 0);
 gtk_box_pack_start (GTK_BOX(vbox), hbox, TRUE, TRUE, 1);
 
the problem is, in hbox the width of hbox is equally divided for both treeview 
and vscroll.
So a huge gap is coming between treeview and vscroll.
I want treeview to occupy the whole hbox and only a little space should be left 
to fit vscroll.
How to do that using horizontal/vertical boxes.
 
Is there any other container or widgets to get the work done.
 
 
Regards,
Prasanna.


This message (including any attachment) is confidential and may be legally 
privileged.  Access to this message by anyone other than the intended 
recipient(s) listed above is unauthorized.  If you are not the intended 
recipient you are hereby notified that any disclosure, copying, or distribution 
of the message, or any action taken or omission of action by you in reliance 
upon it, is prohibited and may be unlawful.  Please immediately notify the 
sender by reply e-mail and permanently delete all copies of the message if you 
have received this message in error.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


How to make GtkTreeview columns invisible

2007-08-10 Thread Prasanna Kumar K
I don't want any columns of GtkTreeView visible in my application. I want only 
rows to be shown.
is it possible?
 
Regards,
Prasanna.

This message (including any attachment) is confidential and may be legally 
privileged.  Access to this message by anyone other than the intended 
recipient(s) listed above is unauthorized.  If you are not the intended 
recipient you are hereby notified that any disclosure, copying, or distribution 
of the message, or any action taken or omission of action by you in reliance 
upon it, is prohibited and may be unlawful.  Please immediately notify the 
sender by reply e-mail and permanently delete all copies of the message if you 
have received this message in error.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


GtkSyles and Themes

2007-08-08 Thread Prasanna Kumar K
Hi,
 
I want a vertical scrollbar with different colors for bar, two boxes and 
the up and down arrows on those boxes.
By using gtk apis I can assign only one color to all of them.
 
How to get different color. Someone told me better to use themes.
any sites where I can get info/tutorial about themes.
 
Regards,
Prasanna.

This message (including any attachment) is confidential and may be legally 
privileged.  Access to this message by anyone other than the intended 
recipient(s) listed above is unauthorized.  If you are not the intended 
recipient you are hereby notified that any disclosure, copying, or distribution 
of the message, or any action taken or omission of action by you in reliance 
upon it, is prohibited and may be unlawful.  Please immediately notify the 
sender by reply e-mail and permanently delete all copies of the message if you 
have received this message in error.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


GtkStyles and Themes

2007-08-08 Thread Prasanna Kumar K
Hi,

I want a vertical scrollbar with different colors for bar, two boxes and 
the up and down arrows on those boxes.
By using gtk apis I can assign only one color to all of them.

How to get different color. Someone told me better to use themes.
any sites where I can get info/tutorial about themes.

Regards,
Prasanna.

This message (including any attachment) is confidential and may be legally 
privileged.  Access to this message by anyone other than the intended 
recipient(s) listed above is unauthorized.  If you are not the intended 
recipient you are hereby notified that any disclosure, copying, or distribution 
of the message, or any action taken or omission of action by you in reliance 
upon it, is prohibited and may be unlawful.  Please immediately notify the 
sender by reply e-mail and permanently delete all copies of the message if you 
have received this message in error.
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


color of vscrollbar

2007-08-07 Thread Prasanna Kumar K
Hi,
 
I wanted to add some colors to my current vscrollbar application.
 
the arrow labels should be in white color.
the bar should be in blue color.
rest everything the boxes and the vertical box in which the bar slides should 
be in black color.
 
the code I have written just makes the color of the arrow labels white. it 
makes the bar the box in which both arrows are situtated black. the vetical box 
in which the bar slides is still showing default gray color.
 
How can I meet my requirements.
 
 
#include gtk/gtk.h
int main (int argc, char *argv[])
{
GtkWidget *bar;
GtkWidget *window;
GtkStyle *style;
GdkColor fgcolor, bgcolor;
gtk_init (argc, argv);
gdk_color_parse (white, fgcolor);
gdk_color_parse (black, bgcolor);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_size_request (window, 200, 200);
bar = gtk_vscrollbar_new (NULL);
style = gtk_widget_get_style (bar);
style-fg[GTK_STATE_NORMAL]=fgcolor;
style-bg[GTK_STATE_NORMAL]=bgcolor;
gtk_widget_set_style(bar, style);
gtk_container_add (GTK_CONTAINER(window), bar);
gtk_widget_show_all (window);
gtk_main ();
return 0;
}


This message (including any attachment) is confidential and may be legally 
privileged.  Access to this message by anyone other than the intended 
recipient(s) listed above is unauthorized.  If you are not the intended 
recipient you are hereby notified that any disclosure, copying, or distribution 
of the message, or any action taken or omission of action by you in reliance 
upon it, is prohibited and may be unlawful.  Please immediately notify the 
sender by reply e-mail and permanently delete all copies of the message if you 
have received this message in error.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Concept behind GtkTreeView

2007-08-07 Thread Prasanna Kumar K
Hi,

Can anyone please explain what is the relation between GtkTreeView - 
GtkTreeStore - GtkTreeModel.

and why GtkTree, GtkCTree, GtkList, GtkCList are deprecated..

I want to add  labels(each row has 2 labels, and there are many rows) in my 
GtkTreeView with a vertical scrollbar.
as all the rows can't be fit in the view area so I have to scroll it down to 
view labels of other rows...
Any idea how to proceed. some one told me that, I have to add labels to my 
list/tree then add this list/tree to the GtkTreeView and add a vertical 
scrollbar to the GtkTreeView... Am I right?


Regards,
Prasanna.

This message (including any attachment) is confidential and may be legally 
privileged.  Access to this message by anyone other than the intended 
recipient(s) listed above is unauthorized.  If you are not the intended 
recipient you are hereby notified that any disclosure, copying, or distribution 
of the message, or any action taken or omission of action by you in reliance 
upon it, is prohibited and may be unlawful.  Please immediately notify the 
sender by reply e-mail and permanently delete all copies of the message if you 
have received this message in error.
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


RE: Concept behind GtkTreeView

2007-08-07 Thread Prasanna Kumar K
is it necessary that I should have column headers/name in my tree.
I want only set of labels and a vertical scroll bar attached to my tree.



From: [EMAIL PROTECTED] on behalf of Emmanuele Bassi
Sent: Tue 8/7/2007 3:34 PM
To: [EMAIL PROTECTED]
Subject: Re: Concept behind GtkTreeView



On Tue, 2007-08-07 at 15:22 +0530, Prasanna Kumar K wrote:
 Hi,

 Can anyone please explain what is the relation between GtkTreeView -
 GtkTreeStore - GtkTreeModel.

you should read the GtkTreeView tutorial at:

  http://scentric.net/tutorial


you should also move to gtk-list or gtk-app-devel-list, as
gtk-devel-list is the mailing list dedicated to the developer *of* gtk+,
not *with* gtk+.

ciao,
 Emmanuele.

--
Emmanuele Bassi,
W: http://www.emmanuelebassi.net http://www.emmanuelebassi.net/
B: http://log.emmanuelebassi.net http://log.emmanuelebassi.net/

___
gtk-devel-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-devel-list



This message (including any attachment) is confidential and may be legally 
privileged.  Access to this message by anyone other than the intended 
recipient(s) listed above is unauthorized.  If you are not the intended 
recipient you are hereby notified that any disclosure, copying, or distribution 
of the message, or any action taken or omission of action by you in reliance 
upon it, is prohibited and may be unlawful.  Please immediately notify the 
sender by reply e-mail and permanently delete all copies of the message if you 
have received this message in error.
winmail.dat___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


color of vscrollbar

2007-08-07 Thread Prasanna Kumar K
Hi,

I wanted to add some colors to my current vscrollbar application.

the arrow labels should be in white color.
the bar should be in blue color.
rest everything the boxes and the vertical box in which the bar slides should 
be in black color.

the code I have written just makes the color of the arrow labels white. it 
makes the bar and the box in which both arrows are situtated black. the vetical 
box in which the bar slides is still showing default gray color.

How can I meet my requirements.


#include gtk/gtk.h
int main (int argc, char *argv[])
{
GtkWidget *bar;
GtkWidget *window;
GtkStyle *style;
GdkColor fgcolor, bgcolor;
gtk_init (argc, argv);
gdk_color_parse (white, fgcolor);
gdk_color_parse (black, bgcolor);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_size_request (window, 200, 200);
bar = gtk_vscrollbar_new (NULL);
style = gtk_widget_get_style (bar);
style-fg[GTK_STATE_NORMAL]=fgcolor;
style-bg[GTK_STATE_NORMAL]=bgcolor;
gtk_widget_set_style(bar, style);
gtk_container_add (GTK_CONTAINER(window), bar);
gtk_widget_show_all (window);
gtk_main ();
return 0;
}


This message (including any attachment) is confidential and may be legally 
privileged.  Access to this message by anyone other than the intended 
recipient(s) listed above is unauthorized.  If you are not the intended 
recipient you are hereby notified that any disclosure, copying, or distribution 
of the message, or any action taken or omission of action by you in reliance 
upon it, is prohibited and may be unlawful.  Please immediately notify the 
sender by reply e-mail and permanently delete all copies of the message if you 
have received this message in error.
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


RE: color of gtk widget

2007-08-05 Thread Prasanna Kumar K
will this change the text color of gtkbutton

  style = gtk_widget_get_style (button);
  style-text[0]=red color; // is there any API to do this.
  gtk_widget_set_style(button, style);


Regards,
Prasanna.



From: Benjamin Berg [mailto:[EMAIL PROTECTED]
Sent: Sat 8/4/2007 6:07 AM
To: [EMAIL PROTECTED]
Cc: Prasanna Kumar K; gtk-devel-list@gnome.org
Subject: Re: color of gtk widget



On Fri, 2007-03-08 at 16:17 +0100, [EMAIL PROTECTED] wrote:
 On 8/3/07, Prasanna Kumar K [EMAIL PROTECTED] wrote:
   I have a GtkWidget Button. I want the color of the button should be 
  complete red.

 You can do it with a gtkrc. For example, set this resource file:

 widget *red_widget style red_style

If you already use a style, you can also use

widget *red_widget* style red_style

instead. And then you just need to set the name on the button and none
of its children. As the label will also be affected with the above line
(because of the trailing *).

 Now in your code do:

 void
 set_name( GtkWidget *widget, const char *name )
 {
 gtk_widget_set_name( widget, name );
 if( GTK_IS_CONTAINER( widget ) )
 gtk_container_foreach( GTK_CONTAINER( widget ),
(GtkCallback) set_name, (char *) name );
 }

 set_name( button, red_widget );

Then a simple gtk_widget_set_name is enough.

The only other choice is to call gtk_widget_modify_fg recursively on all
the widgets.

Benjamin



This message (including any attachment) is confidential and may be legally 
privileged.  Access to this message by anyone other than the intended 
recipient(s) listed above is unauthorized.  If you are not the intended 
recipient you are hereby notified that any disclosure, copying, or distribution 
of the message, or any action taken or omission of action by you in reliance 
upon it, is prohibited and may be unlawful.  Please immediately notify the 
sender by reply e-mail and permanently delete all copies of the message if you 
have received this message in error.
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


color of gtk widget

2007-08-03 Thread Prasanna Kumar K
Hi,

 I have a GtkWidget Button. I want the color of the button should be complete 
red.

I have used this

GdkColor color;
gdk_color_parse (red, color);
gtk_widget_modify_fg (Button, GTK_STATE_NORMAL, color);

But this doesn't make the whole button red. it just paints the border of the 
button with red color.

What to do the complete make the button, red.
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Button size

2007-08-02 Thread Prasanna Kumar K
Hi,

 Is there any API that changes the default size of Button widget before or 
after its creation.

___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


How to reduce the size of Gtk lib.

2007-03-06 Thread Prasanna Kumar K
Hi All,

I want to run an application written in Java(PP 1.0).
PP 1.0 can be built over GTK, but in my case because of Hardware memory
constraint I have to
reduce the size of GTK-lib's.

What is the size of GTK-lib (I guess it is above 50MB..)
I want it to come down to atleast 10MB..

Any Idea about the size reduction..

what I was thinking is by removing most of .c files from the folders we can
get a small GTK lib, which may not support all the features. Right now I'm
not concerned about the features, I just want to build GTK of less size...


Please correct me if I'm wrong about the size of GTK lib or if I'm posted
anything that is not at all logical

Regards,
Prasanna.


___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Different outputs over X and over DirectFB

2006-12-20 Thread Prasanna Kumar K
/*Hi .. I have modified scribble-simple.c from gtk/examples to check the 
behaviour of foregrond/background color of this application over X and then 
over DFB. in expose_event() I have set the new foreground color, it is working 
fine over X but over DirectFB it doesn't has any effect... any 
reason/explanation..*/


#include stdlib.h
#include gtk/gtk.h

/* Backing pixmap for drawing area */
static GdkPixmap *pixmap = NULL;

/* Create a new backing pixmap of the appropriate size */
static gboolean configure_event( GtkWidget *widget,
 GdkEventConfigure *event )
{
  GdkColor color;

  if (pixmap)
g_object_unref (pixmap);
  
  color.red = 0x;
  color.green = 0x;
  color.blue = 0x0;
  gdk_gc_set_rgb_fg_color (widget-style-white_gc, color);

  pixmap = gdk_pixmap_new (widget-window,
   widget-allocation.width,
   widget-allocation.height,
   -1);
  gdk_draw_rectangle (pixmap,
  widget-style-white_gc,
  TRUE,
  0, 0,
  widget-allocation.width,
  widget-allocation.height);

  return TRUE;
}

/* Redraw the screen from the backing pixmap */
static gboolean expose_event( GtkWidget  *widget,
  GdkEventExpose *event )
{
 GdkColor color;

 color.red = 0x;

  gdk_gc_set_rgb_fg_color (widget-style-fg_gc[GTK_WIDGET_STATE(widget)], 
color);

  gdk_draw_drawable (widget-window,
 widget-style-fg_gc[GTK_WIDGET_STATE (widget)],
 pixmap,
 event-area.x, event-area.y,
 event-area.x, event-area.y,
 event-area.width, event-area.height);

  return FALSE;
}

/* Draw a rectangle on the screen */
static void draw_brush( GtkWidget *widget,
gdoublex,
gdoubley)
{ 
  GdkRectangle update_rect;

  update_rect.x = x - 5;
  update_rect.y = y - 5;
  update_rect.width = 10;
  update_rect.height = 10;

  gdk_draw_rectangle (pixmap,
  widget-style-black_gc,
  TRUE,
  update_rect.x, update_rect.y,
  update_rect.width, update_rect.height);
  gtk_widget_queue_draw_area (widget, 
  update_rect.x, update_rect.y,
  update_rect.width, update_rect.height);
}

static gboolean button_press_event( GtkWidget  *widget,
GdkEventButton *event )
{
  if (event-button == 1  pixmap != NULL)
draw_brush (widget, event-x, event-y);

  return TRUE;
}

static gboolean motion_notify_event( GtkWidget *widget,
 GdkEventMotion *event )
{
  int x, y;
  GdkModifierType state;

  if (event-is_hint)
gdk_window_get_pointer (event-window, x, y, state);
  else
{
  x = event-x;
  y = event-y;
  state = event-state;
}

  if (state  GDK_BUTTON1_MASK  pixmap != NULL)
draw_brush (widget, x, y);
  
  return TRUE;
}

void quit ()
{
  exit (0);
}

int main( int   argc, 
  char *argv[] )
{
  GtkWidget *window;
  GtkWidget *drawing_area;
  GtkWidget *vbox;

  GtkWidget *button;

  gtk_init (argc, argv);

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_widget_set_name (window, Test Input);

  vbox = gtk_vbox_new (FALSE, 0);
  gtk_container_add (GTK_CONTAINER (window), vbox);
  gtk_widget_show (vbox);

  g_signal_connect (G_OBJECT (window), destroy,
G_CALLBACK (quit), NULL);

  /* Create the drawing area */

  drawing_area = gtk_drawing_area_new ();
  gtk_widget_set_size_request (GTK_WIDGET (drawing_area), 200, 200);
  gtk_box_pack_start (GTK_BOX (vbox), drawing_area, TRUE, TRUE, 0);

  gtk_widget_show (drawing_area);

  /* Signals used to handle backing pixmap */

  g_signal_connect (G_OBJECT (drawing_area), expose_event,
G_CALLBACK (expose_event), NULL);
  g_signal_connect (G_OBJECT (drawing_area),configure_event,
G_CALLBACK (configure_event), NULL);

  /* Event signals */

  g_signal_connect (G_OBJECT (drawing_area), motion_notify_event,
G_CALLBACK (motion_notify_event), NULL);
  g_signal_connect (G_OBJECT (drawing_area), button_press_event,
G_CALLBACK (button_press_event), NULL);

  gtk_widget_set_events (drawing_area, GDK_EXPOSURE_MASK
 | GDK_LEAVE_NOTIFY_MASK
 | GDK_BUTTON_PRESS_MASK
 | GDK_POINTER_MOTION_MASK
 | GDK_POINTER_MOTION_HINT_MASK);

  /* .. And a quit button */
  button = gtk_button_new_with_label (Quit);
  gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);

  g_signal_connect_swapped (G_OBJECT (button), clicked,
  

How to create a GdkImage from a file.

2006-12-20 Thread Prasanna Kumar K
I want to genetate a GdkImage from a file .. (so that this GdkImage can be 
passed to gdk_draw_image())
I used following calls..

GtkImage *gtk_image = NULL;
GdkImage *gdk_image = NULL;
GdkBitmap *gdk_bitmap = NULL;

gtk_image_set_from_file (gtk_image, 1.jpg);
gtk_image_set_from_image (gtk_image, gdk_image, gdk_bitmap);
gdk_draw_image (pixmap,  widget-style-white_gc,  gdk_image,
  0, 0,  60, 60, 100, 100);


but while running the appliction I'm getting following error..
 Gtk-CRITICAL **: gtk_image_set_from_file: assertion `GTK_IS_IMAGE (image)' 
failed

can anyone tell what is the problem.
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Image application in GTK

2006-12-05 Thread Prasanna Kumar K
Hi,

Does anyone has a code for drawing an image in a window.
I need a small GTK application to test the image drawing funcionality in GTK.


Thanks,
Prasanna.



___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


gdk_gc_set_foreground(): not working over DirectFB

2006-11-13 Thread Prasanna Kumar K
Hi All,


I have added few lines in scribble-simple.c 
(gtk+-2.10.1/examples/scribble-simple) for the foreground color. Kindly find 
the attached patch file for this.

I'm not able to set the foreground color for gtk_drawable 
application(scribble-simple) over DirectFB (but over X it is working fine).In 
the function expose_event whatever color I am setting for brush, DirectFB is 
taking  Black color only irrespective of any new foreground color set using 
gdk_gc_set_foreground().



--- /opt/gtk_dfb/gtk+-2.10.1/examples/scribble-simple/scribble-simple.c 
2005-01-04 00:56:34.0 +0530
+++ scribble-simple.c   2006-11-13 14:27:07.509601600 +0530
@@ -49,6 +49,10 @@ static gboolean configure_event( GtkWidg
 static gboolean expose_event( GtkWidget  *widget,
   GdkEventExpose *event )
 {
+  GdkColor color;
+
+  color.pixel = 0x;
+ gdk_gc_set_foreground (widget-style-fg_gc[GTK_WIDGET_STATE (widget)], 
color);
   gdk_draw_drawable (widget-window,
 widget-style-fg_gc[GTK_WIDGET_STATE (widget)],
 pixmap,


Regards,
Prasanna
--- /opt/gtk_dfb/gtk+-2.10.1/examples/scribble-simple/scribble-simple.c	2005-01-04 00:56:34.0 +0530
+++ scribble-simple.c	2006-11-13 14:27:07.509601600 +0530
@@ -49,6 +49,10 @@ static gboolean configure_event( GtkWidg
 static gboolean expose_event( GtkWidget  *widget,
   GdkEventExpose *event )
 {
+  GdkColor color;
+
+  color.pixel = 0x;
+ gdk_gc_set_foreground (widget-style-fg_gc[GTK_WIDGET_STATE (widget)], color);
   gdk_draw_drawable (widget-window,
 		 widget-style-fg_gc[GTK_WIDGET_STATE (widget)],
 		 pixmap,
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Color problem on GTK-DFB applications

2006-11-13 Thread Prasanna Kumar K
Hi,

I'm attaching one simple gtk application 
scribble-simple.c[gtk/examples/scribble-simple.c] with some modifications in 
the brush color.I have run it once over DirectFB and once over X. The outputs 
are different (brush color is not at all modified in DirectFB, it's still takes 
the default brush color[black])..

any idea.

the patch is...,

--- /opt/gtk_dfb/gtk+-2.10.1/examples/scribble-simple/scribble-simple.c 
2005-01-04 00:56:34.0 +0530
+++ ./scribble-simple.c 2006-11-14 10:56:02.513885024 +0530
@@ -28,7 +28,8 @@ static GdkPixmap *pixmap = NULL;
 static gboolean configure_event( GtkWidget *widget,
  GdkEventConfigure *event )
 {
-  if (pixmap)
+
+   if (pixmap)
 g_object_unref (pixmap);

 
   pixmap = gdk_pixmap_new (widget-window,
@@ -65,13 +66,19 @@ static void draw_brush( GtkWidget *widge
 gdoubley)
 {
   GdkRectangle update_rect;
+  GdkColor color;
+  GdkGC *gc;
+  color.pixel=0x;

 
   update_rect.x = x - 5;
   update_rect.y = y - 5;
   update_rect.width = 10;
   update_rect.height = 10;
+
+  gc = gdk_gc_new (pixmap);
+  gdk_gc_set_foreground (gc, color);
   gdk_draw_rectangle (pixmap,
- widget-style-black_gc,
+ /*widget-style-black_gc*/gc,
  TRUE,
  update_rect.x, update_rect.y,
  update_rect.width, update_rect.height);


Regards,
Prasanna.

/* GTK - The GIMP Toolkit
 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#include stdlib.h
#include gtk/gtk.h

/* Backing pixmap for drawing area */
static GdkPixmap *pixmap = NULL;

/* Create a new backing pixmap of the appropriate size */
static gboolean configure_event( GtkWidget *widget,
 GdkEventConfigure *event )
{

   if (pixmap)
g_object_unref (pixmap);

  pixmap = gdk_pixmap_new (widget-window,
			   widget-allocation.width,
			   widget-allocation.height,
			   -1);
  gdk_draw_rectangle (pixmap,
		  widget-style-white_gc,
		  TRUE,
		  0, 0,
		  widget-allocation.width,
		  widget-allocation.height);

  return TRUE;
}

/* Redraw the screen from the backing pixmap */
static gboolean expose_event( GtkWidget  *widget,
  GdkEventExpose *event )
{
  gdk_draw_drawable (widget-window,
		 widget-style-fg_gc[GTK_WIDGET_STATE (widget)],
		 pixmap,
		 event-area.x, event-area.y,
		 event-area.x, event-area.y,
		 event-area.width, event-area.height);

  return FALSE;
}

/* Draw a rectangle on the screen */
static void draw_brush( GtkWidget *widget,
gdoublex,
gdoubley)
{
  GdkRectangle update_rect;
  GdkColor color;
  GdkGC *gc;
  color.pixel=0x;

  update_rect.x = x - 5;
  update_rect.y = y - 5;
  update_rect.width = 10;
  update_rect.height = 10;
  
  gc = gdk_gc_new (pixmap);
  gdk_gc_set_foreground (gc, color);
  gdk_draw_rectangle (pixmap,
		  /*widget-style-black_gc*/gc,
		  TRUE,
		  update_rect.x, update_rect.y,
		  update_rect.width, update_rect.height);
  gtk_widget_queue_draw_area (widget, 
		  update_rect.x, update_rect.y,
		  update_rect.width, update_rect.height);
}

static gboolean button_press_event( GtkWidget  *widget,
GdkEventButton *event )
{
  if (event-button == 1  pixmap != NULL)
draw_brush (widget, event-x, event-y);

  return TRUE;
}

static gboolean motion_notify_event( GtkWidget *widget,
 GdkEventMotion *event )
{
  int x, y;
  GdkModifierType state;

  if (event-is_hint)
gdk_window_get_pointer (event-window, x, y, state);
  else
{
  x = event-x;
  y = event-y;
  state = event-state;
}

  if (state  GDK_BUTTON1_MASK  pixmap != NULL)
draw_brush (widget, x, y);
  
  return TRUE;
}

void quit ()
{
  exit (0);
}

int 

Gtk Application over GTK-DFB

2006-08-11 Thread Prasanna Kumar K
Hi,

I was trying to run simple GTK application over GTK-DirectFB
and GTK-X.

in GTK-DirectFB the top level window(title-bar, border) is not
visible only the GTK application(buttons, bars etc..) which
are added to the top level window are visible.

but the same application over GTK-X is showing both the top
level window and the the widgets(buttons, bars, etc..)

Is it that the Alpha value in GTK-DirectFB is 0 so it is not
visilbe.. if this is  the case how to make the Alpha value of
top level window to 1.

or I'm missing some thing else.

Regards,
Prasanna.
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Gtk application(hello.c) over GTK-DirectFB

2006-08-11 Thread Prasanna Kumar K
Hi All,

I'm not getting the top level window when trying to run some
GTK-applications over GTK-DirectFB..
I'm getting the internal contents of the GTK-application, like
buttons, bars etc... but not the top level window over which
these widgets (buttons etc..) are placed..

But over GTK-X the GTK-application as well as the top-level
window both are coming...

here is one GTK application hello.c
---
#include gtk/gtk.h

/* This is a callback function. The data arguments are ignored
 * in this example. More on callbacks below. */
static void hello( GtkWidget *widget,
   gpointer   data )
{
g_print (Hello World\n);
}

static gboolean delete_event( GtkWidget *widget,
  GdkEvent  *event,
  gpointer   data )
{
/* If you return FALSE in the delete_event signal handler,
 * GTK will emit the destroy signal. Returning TRUE means
 * you don't want the window to be destroyed.
 * This is useful for popping up 'are you sure you want to
quit?'
 * type dialogs. */

g_print (delete event occurred\n);

/* Change TRUE to FALSE and the main window will be
destroyed with
 * a delete_event. */

return TRUE;
}

/* Another callback */
static void destroy( GtkWidget *widget,
 gpointer   data )
{
gtk_main_quit ();
}

int main( int   argc,
  char *argv[] )
{
/* GtkWidget is the storage type for widgets */
GtkWidget *window;
GtkWidget *button;

/* This is called in all GTK applications. Arguments are
parsed
 * from the command line and are returned to the
application. */
gtk_init (argc, argv);

/* create a new window */
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

/* When the window is given the delete_event signal
(this is given
 * by the window manager, usually by the close option,
or on the
 * titlebar), we ask it to call the delete_event () function
 * as defined above. The data passed to the callback
 * function is NULL and is ignored in the callback
function. */
g_signal_connect (G_OBJECT (window), delete_event,
  G_CALLBACK (delete_event), NULL);

/* Here we connect the destroy event to a signal handler.  
 * This event occurs when we call gtk_widget_destroy() on
the window,
 * or if we return FALSE in the delete_event callback. */
g_signal_connect (G_OBJECT (window), destroy,
  G_CALLBACK (destroy), NULL);

/* Sets the border width of the window. */
gtk_container_set_border_width (GTK_CONTAINER (window), 10);

/* Creates a new button with the label Hello World. */
button = gtk_button_new_with_label (Hello World);

/* When the button receives the clicked signal, it will
call the
 * function hello() passing it NULL as its argument.  The
hello()
 * function is defined above. */
g_signal_connect (G_OBJECT (button), clicked,
  G_CALLBACK (hello), NULL);

/* This will cause the window to be destroyed by calling
 * gtk_widget_destroy(window) when clicked.  Again, the
destroy
 * signal could come from here, or the window manager. */
g_signal_connect_swapped (G_OBJECT (button), clicked,
  G_CALLBACK (gtk_widget_destroy),
  G_OBJECT (window));

/* This packs the button into the window (a gtk container). */
gtk_container_add (GTK_CONTAINER (window), button);

/* The final step is to display this newly created widget. */
gtk_widget_show (button);

/* and the window */
gtk_widget_show (window);

/* All GTK applications must have a gtk_main(). Control
ends here
 * and waits for an event to occur (like a key press or
 * mouse event). */
gtk_main ();

return 0;
}
---

what i think is the alpha value of top-level window in
GTK-DirectFB is set to 0.. can any one tell how to set it to 1
, so that it can be visible..

Regards,
Prasanna
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list