1. je n'arrive pas à obtenir la taile *réelle* de la fenêtre principale de mon application. J'utilise actuellement get_allocation mais la valeur renvoyée ne me semble pas réaliste. J'ai l'impression que c'est la taille minimale requise par les widgets, et pas la taille actuelle de la fenêtre...
Voilà ce que j'utilise pour sauvegarder et restorer la taille et la position de la fenêtre de mon application en ruby/gtk[1] :
Restoration :
if $config['pos-x'] && $config['pos-y']
$main_window.move($config['pos-x'].to_i, $config['pos-y'].to_i)
else
$main_window.window_position = Gtk::Window::POS_CENTER
end
$main_window.set_default_size(($config['width'] || 600).to_i, ($config['height'] || 400).to_i)
Sauvegarde :
$main_window.signal_connect('configure-event') {
x, y = $main_window.window.root_origin
width, height = $main_window.window.size
$config['pos-x'] = x
$config['pos-y'] = y
$config['width'] = width
$config['height'] = height
false
}
Je suggèrerais donc plutôt configure-event à size-allocate suggéré précédemment.
# meuh
Posté par gc . En réponse au message GTK+: Connaitre la taille effective d'une fenêtre. Évalué à 2.
Voilà ce que j'utilise pour sauvegarder et restorer la taille et la position de la fenêtre de mon application en ruby/gtk[1] :
Restoration :
if $config['pos-x'] && $config['pos-y']
$main_window.move($config['pos-x'].to_i, $config['pos-y'].to_i)
else
$main_window.window_position = Gtk::Window::POS_CENTER
end
$main_window.set_default_size(($config['width'] || 600).to_i, ($config['height'] || 400).to_i)
Sauvegarde :
$main_window.signal_connect('configure-event') {
x, y = $main_window.window.root_origin
width, height = $main_window.window.size
$config['pos-x'] = x
$config['pos-y'] = y
$config['width'] = width
$config['height'] = height
false
}
Je suggèrerais donc plutôt configure-event à size-allocate suggéré précédemment.
[1] http://www.booh.org/