Re: [gtkmm] Window questions



>I have a few question I hope if someone can answer any of them
>
>1. How can I make a window below other windows ?

Gtk::Window win;

win.show ();
...
win.get_window()->lower ();

>2. How can I make a window top of other windows ?

win.get_window()->raise ();

>3. How can I diable including a window in taskbar ?

window manager specific. can't be answered generically. its up to the
user to configure this.

>4. How can I diable including a window in pager ?

same answer as 3.

>5. Is there any website that give me some GTK tips ? (like 
>http://www.phpbuilder.com/ & http://www.zend.com/tips/tips.php

www.gtk.org is the reference site.

>6. I want to make the user able to move a window by the mouse, how can I 
>do that ? (For example, when the user pres the left button in the middle 
>of the window and move the mouse the window will move with it)

set the window to handle button press, button release and motion
events. when a button press event occurs, set a flag to indicate you
are dragging. in the motion event handler, if the flag is set, 
move the win with win->get_window().move (x, y). when the button
release event occurs, unset the flag. its very simple. here is some
sample code that is related to this:

gint
TearOff::window_motion (GdkEventMotion* ev)
{
	gint x;
	gint y;
	gint mx, my;
	double x_delta;
	double y_delta;
	Gdk_Window win (own_window->get_window());
	
	own_window->get_pointer (mx, my);

	if (!dragging) {
		return TRUE;
	}

	x_delta = ev->x_root - drag_x;
	y_delta = ev->y_root - drag_y;

	win.get_root_origin (x, y);
	win.move ((gint) floor (x + x_delta), (gint) floor (y + y_delta));
	
	drag_x = ev->x_root;
	drag_y = ev->y_root;
	
	return TRUE;
}

>7. How can I remove the "title bar" from a window ?

this seems to be about the minimum you can get away with in most
window managers.

win.get_window().set_decorations 
    (GdkWMDecoration (GDK_DECOR_BORDER|GDK_DECOR_RESIZEH));



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]