[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
re: re: How do I use the fullscreen in a Gtkmm app?
- From: "Garth's KidStuff" <garthskidstuff gmail com>
- To: gtk-app-devel-list gnome org
- Subject: re: re: How do I use the fullscreen in a Gtkmm app?
- Date: Thu, 12 Jun 2008 08:52:58 -0700
Thanks so much, Carlos. This was exactly what I needed.
In Gtkmm:
Gtk::Window has the methods fullscreen and unfullscreen. Perfect.
Rather than using a bool of my own to track the state, I did what the docs
on fullscreen() suggested and set a function to be signaled when the windows
state changed.
LXMainWindow::LXMainWindow()
{
<snip>
m_bFullScreen = false;
signal_window_state_event().connect(sigc::mem_fun(*this,
&LXMainWindow::OnWindowStateEvent));
}
void LXMainWindow::ToggleFullScreen()
{ // Toggle fullscreen mode off and on.
if (m_bFullScreen))
unfullscreen();
else
fullscreen();
}
bool LXMainWindow::OnWindowStateEvent(
GdkEventWindowState* pEvent) // [in] from system -- has flags of current
state
{
m_bFullScreen = (pEvent->new_window_state &
GDK_WINDOW_STATE_FULLSCREEN);
return true; // we want to keep getting this signal
}
Thanks again. Happy coding!
>Garth's KidStuff wrote:
>> Hi All,
>>
>> I notice that quite a few apps (firefox, gimp, terminal, etc. -- but
not
>> gedit, huh?) have the option to toggle fullscreen mode in their view
menu
> > using the F11 key. How would I implement this in my Gtkmm app?
> >
> Connect the key_press_event to your top window, ot to a drawing area,
> and then prepare a callback along these lines (sorry, C code):
>
> #include <gdk/gdkkeysyms.h>
>
> void function_handle_key_press (GtkWidget *widget,
> GdkEventKey *event, void *data)
> {
> GtkWidget *window = (GtkWindow *) data; /* this is just a simple example
*/
> static int fullscreen = FALSE;
>
>switch (event->keyval)
> {
> case GDK_F11:
> if (fullscreen == FALSE)
> {
> gdk_window_raise (window->window);
> hide decorations;
> gtk_window_fullscreen (GTK_WINDOW (window));
> fullscreen = TRUE;
> }
> else
> {
> show decorations;
> gtk_window_unfullscreen (GTK_WINDOW (window));
> fullscreen = FALSE;
> }
> break;
> }
--
Garth Upshaw
Garth's KidStuff
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]