本文整理汇总了C++中GTK_IS_WINDOW函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_IS_WINDOW函数的具体用法?C++ GTK_IS_WINDOW怎么用?C++ GTK_IS_WINDOW使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GTK_IS_WINDOW函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: button_clicked_entry_browse_directory
inline void button_clicked_entry_browse_directory (GtkWidget* widget, GtkEntry* entry)
{
gtkutil::FileChooser dirChooser(gtk_widget_get_toplevel(widget), _("Choose Directory"), true, true);
std::string curEntry = gtk_entry_get_text(entry);
if (g_path_is_absolute(curEntry.c_str()))
curEntry.clear();
dirChooser.setCurrentPath(curEntry);
std::string filename = dirChooser.display();
if (GTK_IS_WINDOW(gtk_widget_get_toplevel(widget))) {
gtk_window_present(GTK_WINDOW(gtk_widget_get_toplevel(widget)));
}
if (!filename.empty()) {
gtk_entry_set_text(entry, filename.c_str());
}
}
示例2: gdict_show_pref_dialog
void
gdict_show_pref_dialog (GtkWidget *parent,
const gchar *title,
GdictSourceLoader *loader)
{
GtkWidget *dialog;
g_return_if_fail (GTK_IS_WIDGET (parent));
g_return_if_fail (GDICT_IS_SOURCE_LOADER (loader));
if (parent != NULL)
dialog = g_object_get_data (G_OBJECT (parent), "gdict-pref-dialog");
else
dialog = global_dialog;
if (dialog == NULL)
{
dialog = g_object_new (GDICT_TYPE_PREF_DIALOG,
"source-loader", loader,
"title", title,
NULL);
g_object_ref_sink (dialog);
g_signal_connect (dialog, "delete-event",
G_CALLBACK (gtk_widget_hide_on_delete),
NULL);
if (parent != NULL && GTK_IS_WINDOW (parent))
{
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (parent));
gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
g_object_set_data_full (G_OBJECT (parent), "gdict-pref-dialog",
dialog,
g_object_unref);
}
else
global_dialog = dialog;
}
gtk_window_set_screen (GTK_WINDOW (dialog), gtk_widget_get_screen (parent));
gtk_window_present (GTK_WINDOW (dialog));
}
示例3: ag_app_peek_first_window
GtkWindow *
ag_app_peek_first_window(AgApp *app)
{
GList *l;
for (
l = gtk_application_get_windows(GTK_APPLICATION(app));
l;
l = g_list_next(l)
) {
if (GTK_IS_WINDOW(l->data)) {
return GTK_WINDOW(l->data);
}
}
ag_app_new_window(app);
return ag_app_peek_first_window(app);
}
示例4: gtk_font_button_clicked
static void
gtk_font_button_clicked (GtkButton *button)
{
GtkFontSelectionDialog *font_dialog;
GtkFontButton *font_button = GTK_FONT_BUTTON (button);
if (!font_button->priv->font_dialog)
{
GtkWidget *parent;
parent = gtk_widget_get_toplevel (GTK_WIDGET (font_button));
font_button->priv->font_dialog = gtk_font_selection_dialog_new (font_button->priv->title);
font_dialog = GTK_FONT_SELECTION_DIALOG (font_button->priv->font_dialog);
if (GTK_WIDGET_TOPLEVEL (parent) && GTK_IS_WINDOW (parent))
{
if (GTK_WINDOW (parent) != gtk_window_get_transient_for (GTK_WINDOW (font_dialog)))
gtk_window_set_transient_for (GTK_WINDOW (font_dialog), GTK_WINDOW (parent));
gtk_window_set_modal (GTK_WINDOW (font_dialog),
gtk_window_get_modal (GTK_WINDOW (parent)));
}
g_signal_connect (font_dialog->ok_button, "clicked",
G_CALLBACK (dialog_ok_clicked), font_button);
g_signal_connect (font_dialog->cancel_button, "clicked",
G_CALLBACK (dialog_cancel_clicked), font_button);
g_signal_connect (font_dialog, "destroy",
G_CALLBACK (dialog_destroy), font_button);
}
if (!GTK_WIDGET_VISIBLE (font_button->priv->font_dialog))
{
font_dialog = GTK_FONT_SELECTION_DIALOG (font_button->priv->font_dialog);
gtk_font_selection_dialog_set_font_name (font_dialog, font_button->priv->fontname);
}
gtk_window_present (GTK_WINDOW (font_button->priv->font_dialog));
}
示例5: ag_app_buttoned_dialog
GtkResponseType
ag_app_buttoned_dialog(GtkWindow *window,
GtkMessageType message_type,
const gchar *message,
const gchar *first_button_text,
...)
{
va_list ap;
const gchar *button_text;
gint response_id;
GtkWidget *dialog;
g_return_val_if_fail(GTK_IS_WINDOW(window), GTK_RESPONSE_NONE);
dialog = gtk_message_dialog_new(
window,
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
message_type,
GTK_BUTTONS_NONE,
"%s",
message
);
if (first_button_text) {
button_text = first_button_text;
va_start(ap, first_button_text);
response_id = va_arg(ap, gint);
gtk_dialog_add_button(GTK_DIALOG(dialog), button_text, response_id);
while ((button_text = va_arg(ap, gchar *)) != NULL) {
response_id = va_arg(ap, gint);
gtk_dialog_add_button(GTK_DIALOG(dialog), button_text, response_id);
}
va_end(ap);
}
response_id = gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog);
return response_id;
}
示例6: state_event_watcher
static gboolean
state_event_watcher (GSignalInvocationHint *hint,
guint n_param_values,
const GValue *param_values,
gpointer data)
{
GObject *object;
GtkWidget *widget;
AtkObject *atk_obj;
AtkObject *parent;
GdkEventWindowState *event;
gchar *signal_name;
object = g_value_get_object (param_values + 0);
if (!GTK_IS_WINDOW (object))
return FALSE;
event = g_value_get_boxed (param_values + 1);
if (event->type == GDK_WINDOW_STATE)
return FALSE;
widget = GTK_WIDGET (object);
if (event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED)
signal_name = "maximize";
else if (event->new_window_state & GDK_WINDOW_STATE_ICONIFIED)
signal_name = "minimize";
else if (event->new_window_state == 0)
signal_name = "restore";
else
return TRUE;
atk_obj = gtk_widget_get_accessible (widget);
if (GTK_IS_WINDOW_ACCESSIBLE (atk_obj))
{
parent = atk_object_get_parent (atk_obj);
if (parent == atk_get_root ())
g_signal_emit_by_name (atk_obj, signal_name);
return TRUE;
}
return FALSE;
}
示例7: rbgtk_initialize_gtkobject
void
rbgtk_initialize_gtkobject(VALUE obj, GtkObject *gtkobj)
{
gtkobj = g_object_ref(gtkobj);
gtk_object_sink(gtkobj);
G_INITIALIZE(obj, gtkobj);
if (GTK_IS_WINDOW(gtkobj) || GTK_IS_MENU_SHELL(gtkobj)) {
VALUE klass;
klass = rb_obj_class(obj);
if (rb_ivar_defined(klass, id__windows__) == Qfalse) {
rb_ivar_set(klass, id__windows__, rb_hash_new());
}
rb_hash_aset(rb_ivar_get(klass, id__windows__), obj, Qnil);
g_signal_connect_after(gtkobj, "destroy",
G_CALLBACK(remove_from_windows),
(gpointer)obj);
}
}
示例8: find_topmost_widget_coords_from_event
/* Ignores (x, y) on input, translates event coordinates to
* allocation relative (x, y) of the returned widget.
*/
static GtkWidget *
find_topmost_widget_coords_from_event (GdkEvent *event,
gint *x,
gint *y)
{
GtkAllocation allocation;
gint tx, ty;
gdouble dx, dy;
GtkWidget *tmp;
gdk_event_get_coords (event, &dx, &dy);
/* Returns coordinates relative to tmp's allocation. */
tmp = _gtk_widget_find_at_coords (event->any.window, dx, dy, &tx, &ty);
if (!tmp)
return NULL;
/* Make sure the pointer can actually be on the widget returned. */
gtk_widget_get_allocation (tmp, &allocation);
allocation.x = 0;
allocation.y = 0;
if (GTK_IS_WINDOW (tmp))
{
GtkBorder border;
_gtk_window_get_shadow_width (GTK_WINDOW (tmp), &border);
allocation.x = border.left;
allocation.y = border.top;
allocation.width -= border.left + border.right;
allocation.height -= border.top + border.bottom;
}
if (tx < allocation.x || tx >= allocation.width ||
ty < allocation.y || ty >= allocation.height)
return NULL;
if (x)
*x = tx;
if (y)
*y = ty;
return tmp;
}
示例9: games_settings_bind_window_state
/**
* games_settings_bind_window_state:
* @path: a valid #GSettings path
* @window: a #GtkWindow
*
* Restore the window configuration, and persist changes to the window configuration:
* window width and height, and maximised and fullscreen state.
* @window must not be realised yet.
*
* To make sure the state is saved at exit, g_settings_sync() must be called.
*/
void
games_settings_bind_window_state (const char *path,
GtkWindow *window)
{
WindowState *state;
int width, height;
gboolean maximised, fullscreen;
g_return_if_fail (GTK_IS_WINDOW (window));
g_return_if_fail (!gtk_widget_get_realized (GTK_WIDGET (window)));
state = g_slice_new0 (WindowState);
state->window = window;
state->settings = g_settings_new_with_path (SCHEMA_NAME, path);
/* We delay storing the state until exit */
g_settings_delay (state->settings);
g_object_set_data_full (G_OBJECT (window), "GamesSettings::WindowState",
state, (GDestroyNotify) free_window_state);
g_signal_connect (window, "configure-event",
G_CALLBACK (window_configure_event_cb), state);
g_signal_connect (window, "window-state-event",
G_CALLBACK (window_state_event_cb), state);
maximised = g_settings_get_boolean (state->settings, STATE_KEY_MAXIMIZED);
fullscreen = g_settings_get_boolean (state->settings, STATE_KEY_FULLSCREEN);
width = g_settings_get_int (state->settings, STATE_KEY_WIDTH);
height = g_settings_get_int (state->settings, STATE_KEY_HEIGHT);
if (width > 0 && height > 0) {
gtk_window_set_default_size (GTK_WINDOW (window), width, height);
}
if (maximised) {
gtk_window_maximize (GTK_WINDOW (window));
}
if (fullscreen) {
gtk_window_fullscreen (GTK_WINDOW (window));
}
}
示例10: n_param
/**
* @fn void *startROS (void *user)
* @brief ROS thread.
*
* The main program wait until "ros_param_read" in order to allow the <br>
* ROS params to be also the Gtk Window and Widgets params.
* Then the ROS thread wait to the widgets creation before subcribing<br>
* to any topics, avoid to call public widget function for a widget not<br>
* yet created.
*/
void *startROS (void *user)
{
if (user != NULL)
{
struct arg *p_arg = (arg *) user;
ros::init (p_arg->argc, p_arg->argv, "gpsd_viewer");
ros::NodeHandle n;
std::string local_path;
std::string package_path = ros::package::getPath (ROS_PACKAGE_NAME);
ros::NodeHandle n_param ("~");
XmlRpc::XmlRpcValue xml_marker_center;
ROS_INFO ("Starting GPSD Viewer");
// -----------------------------------------------------------------
// **** allow widget creation
data->ros_param_read = true;
// **** wait to widget creation
while (!data->widget_created)
{
ROS_DEBUG ("Waiting widgets creation");
}
// -----------------------------------------------------------------
// **** topics subscribing
ros::Subscriber fix_sub;
fix_sub = n.subscribe ("/fix", 1, &gpsFixCallback);
pub_cmd= n.advertise<gpsd_viewer::cmd>("cmd",5);
ROS_INFO ("Spinning");
ros::spin ();
}
// **** stop the gtk main loop
if (GTK_IS_WINDOW (data->window))
{
gtk_main_quit ();
}
pthread_exit (NULL);
}
示例11: sp_window_settings__window_realize
static void
sp_window_settings__window_realize (GtkWindow *window)
{
GtkApplication *app;
GdkRectangle geom = { 0 };
gboolean maximized = FALSE;
GList *list;
guint count = 0;
g_assert (GTK_IS_WINDOW (window));
g_assert (G_IS_SETTINGS (settings));
g_settings_get (settings, "window-position", "(ii)", &geom.x, &geom.y);
g_settings_get (settings, "window-size", "(ii)", &geom.width, &geom.height);
g_settings_get (settings, "window-maximized", "b", &maximized);
geom.width = MAX (geom.width, WINDOW_MIN_WIDTH);
geom.height = MAX (geom.height, WINDOW_MIN_HEIGHT);
gtk_window_set_default_size (window, geom.width, geom.height);
/*
* If there are other windows currently visible other than this one,
* then ignore positioning and let the window manager decide.
*/
count = 0;
app = GTK_APPLICATION (g_application_get_default ());
list = gtk_application_get_windows (app);
for (; list != NULL; list = list->next)
{
GtkWindow *ele = list->data;
if (SP_IS_WINDOW (ele) && (ele != window) &&
gtk_widget_get_visible (GTK_WIDGET (window)))
count++;
}
if (count == 0)
gtk_window_move (window, geom.x, geom.y);
if (maximized)
gtk_window_maximize (window);
}
示例12: eel_gtk_window_set_initial_geometry_from_string
/**
* eel_gtk_window_set_initial_geometry_from_string:
*
* Sets the position and size of a GtkWindow before the
* GtkWindow is shown. The geometry is passed in as a string.
* It is an error to call this on a window that
* is already on-screen. Takes into account screen size, and does
* some sanity-checking on the passed-in values.
*
* @window: A non-visible GtkWindow
* @geometry_string: A string suitable for use with eel_gdk_parse_geometry
* @minimum_width: If the width from the string is smaller than this,
* use this for the width.
* @minimum_height: If the height from the string is smaller than this,
* use this for the height.
* @ignore_position: If true position data from string will be ignored.
*/
void
eel_gtk_window_set_initial_geometry_from_string (GtkWindow *window,
const char *geometry_string,
guint minimum_width,
guint minimum_height,
gboolean ignore_position)
{
int left, top;
guint width, height;
EelGdkGeometryFlags geometry_flags;
g_return_if_fail (GTK_IS_WINDOW (window));
g_return_if_fail (geometry_string != NULL);
/* Setting the default size doesn't work when the window is already showing.
* Someday we could make this move an already-showing window, but we don't
* need that functionality yet.
*/
g_return_if_fail (!gtk_widget_get_visible (GTK_WIDGET (window)));
geometry_flags = eel_gdk_parse_geometry (geometry_string, &left, &top, &width, &height);
/* Make sure the window isn't smaller than makes sense for this window.
* Other sanity checks are performed in set_initial_geometry.
*/
if (geometry_flags & EEL_GDK_WIDTH_VALUE)
{
width = MAX (width, minimum_width);
}
if (geometry_flags & EEL_GDK_HEIGHT_VALUE)
{
height = MAX (height, minimum_height);
}
/* Ignore saved window position if requested. */
if (ignore_position)
{
geometry_flags &= ~(EEL_GDK_X_VALUE | EEL_GDK_Y_VALUE);
}
eel_gtk_window_set_initial_geometry (window, geometry_flags, left, top, width, height);
}
示例13: button_clicked_entry_browse_file
inline void button_clicked_entry_browse_file (GtkWidget* widget, GtkEntry* entry)
{
std::string filename = gtk_entry_get_text(entry);
gtkutil::FileChooser fileChooser(gtk_widget_get_toplevel(widget), _("Choose File"), true, false);
if (!filename.empty()) {
fileChooser.setCurrentPath(os::stripFilename(filename));
fileChooser.setCurrentFile(filename);
}
std::string file = fileChooser.display();
if (GTK_IS_WINDOW(gtk_widget_get_toplevel(widget))) {
gtk_window_present(GTK_WINDOW(gtk_widget_get_toplevel(widget)));
}
if (!file.empty()) {
gtk_entry_set_text(entry, file.c_str());
}
}
示例14: dh_preferences_show_dialog
void
dh_preferences_show_dialog (GtkWindow *parent)
{
g_return_if_fail (GTK_IS_WINDOW (parent));
if (prefs_dialog == NULL) {
prefs_dialog = GTK_WIDGET (g_object_new (DH_TYPE_PREFERENCES, NULL));
g_signal_connect (prefs_dialog,
"destroy",
G_CALLBACK (gtk_widget_destroyed),
&prefs_dialog);
}
if (parent != gtk_window_get_transient_for (GTK_WINDOW (prefs_dialog))) {
gtk_window_set_transient_for (GTK_WINDOW (prefs_dialog),
parent);
}
gtk_window_present (GTK_WINDOW (prefs_dialog));
}
示例15: gwy_app_wait_start
/**
* gwy_app_wait_start:
* @window: A window.
* @message: A message to show in the wait dialog.
*
* Starts waiting for a window @window, creating a dialog with a progress bar.
*
* Waiting is global, there can be only one at a time.
**/
void
gwy_app_wait_start(GtkWidget *window,
const gchar *message)
{
if (window && !GTK_IS_WINDOW(window))
g_warning("Widget is not a window");
if (wait_widget || silent_waiting) {
g_warning("Already waiting on a widget, switching to the new one");
gwy_app_wait_switch_widget(window, message);
return;
}
canceled = FALSE;
if (!window)
silent_waiting = TRUE;
else
gwy_app_wait_create_dialog(window, message);
wait_widget = window;
}