ProgressWindow::ProgressWindow(ContainerWindow &parent) { set(parent, InfoBoxLayout::landscape ? (LPCTSTR)IDD_PROGRESS_LANDSCAPE : (LPCTSTR)IDD_PROGRESS); TCHAR Temp[1024]; _stprintf(Temp, _T("%s %s"), gettext(_T("Version")), XCSoar_Version); set_item_text(IDC_VERSION, Temp); #ifdef WINDOWSPC RECT rc = parent.get_client_rect(); RECT rcp = get_client_rect(); move(rc.left, rc.top, rcp.right - rcp.left, rcp.bottom - rcp.top); #else #ifndef GNAV SHFullScreen(hWnd, SHFS_HIDETASKBAR|SHFS_HIDESIPBUTTON|SHFS_HIDESTARTICON); #endif #endif insert_after(HWND_TOP, true); set_range(0, 100); set_step(5); #ifndef ENABLE_SDL ::SetForegroundWindow(hWnd); #endif /* !ENABLE_SDL */ update(); }
bool ItemListPlugin::_set(const StringName& p_name, const Variant& p_value) { String name = p_name; int idx = name.get_slice("/",0).to_int(); String what=name.get_slice("/",1); if (what=="text") set_item_text(idx,p_value); else if (what=="icon") set_item_icon(idx,p_value); else if (what=="checkable") set_item_checkable(idx,p_value); else if (what=="checked") set_item_checked(idx,p_value); else if (what=="id") set_item_id(idx,p_value); else if (what=="enabled") set_item_enabled(idx,p_value); else if (what=="separator") set_item_separator(idx,p_value); else return false; return true; }
bool ItemListPlugin::_set(const StringName &p_name, const Variant &p_value) { String name = p_name; int idx = name.get_slice("/", 0).to_int(); String what = name.get_slice("/", 1); if (what == "text") set_item_text(idx, p_value); else if (what == "icon") set_item_icon(idx, p_value); else if (what == "checkable") { // This keeps compatibility to/from versions where this property was a boolean, before radio buttons switch ((int)p_value) { case 0: case 1: set_item_checkable(idx, p_value); break; case 2: set_item_radio_checkable(idx, true); break; } } else if (what == "checked") set_item_checked(idx, p_value); else if (what == "id") set_item_id(idx, p_value); else if (what == "enabled") set_item_enabled(idx, p_value); else if (what == "separator") set_item_separator(idx, p_value); else return false; return true; }
static void refill_submenu_workspace (WnckActionMenu *menu) { GtkWidget *submenu; GList *children; GList *l; int num_workspaces, window_space, i; WnckWorkspace *workspace; submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (menu->priv->workspace_item)); /* Remove existing items */ children = gtk_container_get_children (GTK_CONTAINER (submenu)); for (l = children; l; l = l->next) gtk_container_remove (GTK_CONTAINER (submenu), l->data); g_list_free (children); workspace = wnck_window_get_workspace (menu->priv->window); num_workspaces = wnck_screen_get_workspace_count (wnck_window_get_screen (menu->priv->window)); if (workspace) window_space = wnck_workspace_get_number (workspace); else window_space = -1; for (i = 0; i < num_workspaces; i++) { char *name; GtkWidget *item; name = get_workspace_name_with_accel (menu->priv->window, i); item = make_menu_item (MOVE_TO_WORKSPACE); g_object_set_data (G_OBJECT (item), "workspace", GINT_TO_POINTER (i)); if (i == window_space) gtk_widget_set_sensitive (item, FALSE); gtk_menu_shell_append (GTK_MENU_SHELL (submenu), item); set_item_text (item, name); set_item_stock (item, NULL); g_free (name); } gtk_menu_reposition (GTK_MENU (submenu)); }
static void refill_submenu_viewport (WnckActionMenu *menu) { GtkWidget *submenu; GList *children; GList *l; WnckScreen *screen; WnckWorkspace *workspace; int window_x, window_y; int viewport_x, viewport_y; int viewport_width, viewport_height; int screen_width, screen_height; int x, y; int number; submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (menu->priv->workspace_item)); /* Remove existing items */ children = gtk_container_get_children (GTK_CONTAINER (submenu)); for (l = children; l; l = l->next) gtk_container_remove (GTK_CONTAINER (submenu), l->data); g_list_free (children); screen = wnck_window_get_screen (menu->priv->window); workspace = wnck_screen_get_workspace (screen, 0); wnck_window_get_geometry (menu->priv->window, &window_x, &window_y, NULL, NULL); viewport_x = wnck_workspace_get_viewport_x (workspace); viewport_y = wnck_workspace_get_viewport_y (workspace); window_x += viewport_x; window_y += viewport_y; viewport_width = wnck_workspace_get_width (workspace); viewport_height = wnck_workspace_get_height (workspace); screen_width = wnck_screen_get_width (screen); screen_height = wnck_screen_get_height (screen); number = 1; for (y = 0; y < viewport_height; y += screen_height) { char *label; GtkWidget *item; for (x = 0; x < viewport_width; x += screen_width) { /* Keep this in sync with what is in get_workspace_name_with_accel() */ if (number == 10) label = g_strdup_printf (_("Workspace 1_0")); else label = g_strdup_printf (_("Workspace %s%d"), number < 10 ? "_" : "", number); number++; item = make_menu_item (MOVE_TO_WORKSPACE); g_object_set_data (G_OBJECT (item), "viewport_x", GINT_TO_POINTER (x)); g_object_set_data (G_OBJECT (item), "viewport_y", GINT_TO_POINTER (y)); if (window_x >= x && window_x < x + screen_width && window_y >= y && window_y < y + screen_height) gtk_widget_set_sensitive (item, FALSE); gtk_menu_shell_append (GTK_MENU_SHELL (submenu), item); set_item_text (item, label); set_item_stock (item, NULL); g_free (label); } } gtk_menu_reposition (GTK_MENU (submenu)); }
static gboolean update_menu_state (WnckActionMenu *menu) { WnckActionMenuPrivate *priv; WnckWindowActions actions; WnckScreen *screen; WnckWorkspace *workspace; gboolean viewport_mode; gboolean move_workspace_sensitive; priv = menu->priv; priv->idle_handler = 0; actions = wnck_window_get_actions (priv->window); screen = wnck_window_get_screen (priv->window); viewport_mode = wnck_screen_get_workspace_count (screen) == 1 && wnck_workspace_is_virtual (wnck_screen_get_workspace (screen, 0)); move_workspace_sensitive = viewport_mode || (actions & WNCK_WINDOW_ACTION_CHANGE_WORKSPACE) != 0; if (wnck_window_is_minimized (priv->window)) { set_item_text (priv->minimize_item, _("Unmi_nimize")); set_item_stock (priv->minimize_item, NULL); gtk_widget_set_sensitive (priv->minimize_item, (actions & WNCK_WINDOW_ACTION_UNMINIMIZE) != 0); } else { set_item_text (priv->minimize_item, _("Mi_nimize")); set_item_stock (priv->minimize_item, WNCK_STOCK_MINIMIZE); gtk_widget_set_sensitive (priv->minimize_item, (actions & WNCK_WINDOW_ACTION_MINIMIZE) != 0); } if (wnck_window_is_maximized (priv->window)) { set_item_text (priv->maximize_item, _("Unma_ximize")); set_item_stock (priv->maximize_item, NULL); gtk_widget_set_sensitive (priv->maximize_item, (actions & WNCK_WINDOW_ACTION_UNMAXIMIZE) != 0); } else { set_item_text (priv->maximize_item, _("Ma_ximize")); set_item_stock (priv->maximize_item, WNCK_STOCK_MAXIMIZE); gtk_widget_set_sensitive (priv->maximize_item, (actions & WNCK_WINDOW_ACTION_MAXIMIZE) != 0); } g_signal_handlers_block_by_func (G_OBJECT (priv->above_item), item_activated_callback, GINT_TO_POINTER (ABOVE)); gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (priv->above_item), wnck_window_is_above (priv->window)); g_signal_handlers_unblock_by_func (G_OBJECT (priv->above_item), item_activated_callback, GINT_TO_POINTER (ABOVE)); gtk_widget_set_sensitive (priv->above_item, (actions & WNCK_WINDOW_ACTION_ABOVE) != 0); g_signal_handlers_block_by_func (G_OBJECT (priv->pin_item), item_activated_callback, GINT_TO_POINTER (PIN)); g_signal_handlers_block_by_func (G_OBJECT (priv->unpin_item), item_activated_callback, GINT_TO_POINTER (UNPIN)); if ((viewport_mode && wnck_window_is_sticky (priv->window)) || (!viewport_mode && wnck_window_is_pinned (priv->window))) gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (priv->pin_item), TRUE); else gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (priv->unpin_item), TRUE); g_signal_handlers_unblock_by_func (G_OBJECT (priv->pin_item), item_activated_callback, GINT_TO_POINTER (PIN)); g_signal_handlers_unblock_by_func (G_OBJECT (priv->unpin_item), item_activated_callback, GINT_TO_POINTER (UNPIN)); gtk_widget_set_sensitive (priv->pin_item, move_workspace_sensitive); gtk_widget_set_sensitive (priv->unpin_item, move_workspace_sensitive); gtk_widget_set_sensitive (priv->close_item, (actions & WNCK_WINDOW_ACTION_CLOSE) != 0); gtk_widget_set_sensitive (priv->move_item, (actions & WNCK_WINDOW_ACTION_MOVE) != 0); gtk_widget_set_sensitive (priv->resize_item, (actions & WNCK_WINDOW_ACTION_RESIZE) != 0); gtk_widget_set_sensitive (priv->workspace_item, move_workspace_sensitive); gtk_widget_set_sensitive (priv->left_item, move_workspace_sensitive); gtk_widget_set_sensitive (priv->right_item, move_workspace_sensitive); gtk_widget_set_sensitive (priv->up_item, move_workspace_sensitive); gtk_widget_set_sensitive (priv->down_item, move_workspace_sensitive); workspace = wnck_window_get_workspace (priv->window); if (viewport_mode && !wnck_window_is_sticky (priv->window)) { int window_x, window_y; int viewport_x, viewport_y; int viewport_width, viewport_height; int screen_width, screen_height; if (!workspace) workspace = wnck_screen_get_workspace (screen, 0); wnck_window_get_geometry (priv->window, &window_x, &window_y, NULL, NULL); viewport_x = wnck_workspace_get_viewport_x (workspace); viewport_y = wnck_workspace_get_viewport_y (workspace); window_x += viewport_x; window_y += viewport_y; viewport_width = wnck_workspace_get_width (workspace); viewport_height = wnck_workspace_get_height (workspace); screen_width = wnck_screen_get_width (screen); screen_height = wnck_screen_get_height (screen); if (window_x >= screen_width) gtk_widget_show (priv->left_item); else gtk_widget_hide (priv->left_item); if (window_x < viewport_width - screen_width) gtk_widget_show (priv->right_item); else gtk_widget_hide (priv->right_item); if (window_y >= screen_height) gtk_widget_show (priv->up_item); else gtk_widget_hide (priv->up_item); if (window_y < viewport_height - screen_height) gtk_widget_show (priv->down_item); else gtk_widget_hide (priv->down_item); } else if (!viewport_mode && workspace && !wnck_window_is_pinned (priv->window)) { if (wnck_workspace_get_neighbor (workspace, WNCK_MOTION_LEFT)) gtk_widget_show (priv->left_item); else gtk_widget_hide (priv->left_item); if (wnck_workspace_get_neighbor (workspace, WNCK_MOTION_RIGHT)) gtk_widget_show (priv->right_item); else gtk_widget_hide (priv->right_item); if (wnck_workspace_get_neighbor (workspace, WNCK_MOTION_UP)) gtk_widget_show (priv->up_item); else gtk_widget_hide (priv->up_item); if (wnck_workspace_get_neighbor (workspace, WNCK_MOTION_DOWN)) gtk_widget_show (priv->down_item); else gtk_widget_hide (priv->down_item); } else { gtk_widget_hide (priv->left_item); gtk_widget_hide (priv->right_item); gtk_widget_hide (priv->up_item); gtk_widget_hide (priv->down_item); } if (viewport_mode) { int viewport_width, viewport_height; int screen_width, screen_height; viewport_width = wnck_workspace_get_width (workspace); viewport_height = wnck_workspace_get_height (workspace); screen_width = wnck_screen_get_width (screen); screen_height = wnck_screen_get_height (screen); gtk_widget_show (priv->workspace_separator); gtk_widget_show (priv->pin_item); gtk_widget_show (priv->unpin_item); if (viewport_width >= 2 * screen_width || viewport_height >= 2 * screen_height) { gtk_widget_show (priv->workspace_item); refill_submenu_viewport (menu); } else { gtk_widget_hide (priv->workspace_item); gtk_menu_popdown (GTK_MENU (gtk_menu_item_get_submenu (GTK_MENU_ITEM (priv->workspace_item)))); } } else if (wnck_screen_get_workspace_count (screen) > 1) { gtk_widget_show (priv->workspace_separator); gtk_widget_show (priv->pin_item); gtk_widget_show (priv->unpin_item); gtk_widget_show (priv->workspace_item); refill_submenu_workspace (menu); } else { gtk_widget_hide (priv->workspace_separator); gtk_widget_hide (priv->pin_item); gtk_widget_hide (priv->unpin_item); gtk_widget_hide (priv->workspace_item); gtk_menu_popdown (GTK_MENU (gtk_menu_item_get_submenu (GTK_MENU_ITEM (priv->workspace_item)))); } gtk_menu_reposition (GTK_MENU (menu)); return FALSE; }
static GObject * wnck_action_menu_constructor (GType type, guint n_construct_properties, GObjectConstructParam *construct_properties) { GObject *obj; WnckActionMenu *menu; WnckActionMenuPrivate *priv; GtkWidget *submenu; GtkWidget *separator; GSList *pin_group; WnckScreen *screen; obj = G_OBJECT_CLASS (wnck_action_menu_parent_class)->constructor (type, n_construct_properties, construct_properties); menu = WNCK_ACTION_MENU (obj); priv = menu->priv; if (priv->window == NULL) { g_warning ("No window specified during creation of the action menu"); return obj; } g_object_weak_ref (G_OBJECT (priv->window), window_weak_notify, menu); g_object_weak_ref (G_OBJECT (menu), object_weak_notify, priv->window); priv->minimize_item = make_menu_item (MINIMIZE); gtk_menu_shell_append (GTK_MENU_SHELL (menu), priv->minimize_item); priv->maximize_item = make_menu_item (MAXIMIZE); gtk_menu_shell_append (GTK_MENU_SHELL (menu), priv->maximize_item); priv->move_item = make_menu_item (MOVE); gtk_menu_shell_append (GTK_MENU_SHELL (menu), priv->move_item); set_item_text (priv->move_item, _("_Move")); set_item_stock (priv->move_item, NULL); priv->resize_item = make_menu_item (RESIZE); gtk_menu_shell_append (GTK_MENU_SHELL (menu), priv->resize_item); set_item_text (priv->resize_item, _("_Resize")); set_item_stock (priv->move_item, NULL); priv->workspace_separator = separator = gtk_separator_menu_item_new (); gtk_widget_show (separator); gtk_menu_shell_append (GTK_MENU_SHELL (menu), separator); priv->above_item = make_check_menu_item (ABOVE, _("Always On _Top")); gtk_menu_shell_append (GTK_MENU_SHELL (menu), priv->above_item); pin_group = NULL; priv->pin_item = make_radio_menu_item (PIN, &pin_group, _("_Always on Visible Workspace")); gtk_menu_shell_append (GTK_MENU_SHELL (menu), priv->pin_item); priv->unpin_item = make_radio_menu_item (UNPIN, &pin_group, _("_Only on This Workspace")); gtk_menu_shell_append (GTK_MENU_SHELL (menu), priv->unpin_item); priv->left_item = make_menu_item (LEFT); gtk_menu_shell_append (GTK_MENU_SHELL (menu), priv->left_item); set_item_text (priv->left_item, _("Move to Workspace _Left")); set_item_stock (priv->left_item, NULL); priv->right_item = make_menu_item (RIGHT); gtk_menu_shell_append (GTK_MENU_SHELL (menu), priv->right_item); set_item_text (priv->right_item, _("Move to Workspace R_ight")); set_item_stock (priv->right_item, NULL); priv->up_item = make_menu_item (UP); gtk_menu_shell_append (GTK_MENU_SHELL (menu), priv->up_item); set_item_text (priv->up_item, _("Move to Workspace _Up")); set_item_stock (priv->up_item, NULL); priv->down_item = make_menu_item (DOWN); gtk_menu_shell_append (GTK_MENU_SHELL (menu), priv->down_item); set_item_text (priv->down_item, _("Move to Workspace _Down")); set_item_stock (priv->down_item, NULL); priv->workspace_item = gtk_menu_item_new_with_mnemonic (_("Move to Another _Workspace")); gtk_widget_show (priv->workspace_item); submenu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (priv->workspace_item), submenu); gtk_menu_shell_append (GTK_MENU_SHELL (menu), priv->workspace_item); separator = gtk_separator_menu_item_new (); gtk_widget_show (separator); gtk_menu_shell_append (GTK_MENU_SHELL (menu), separator); priv->close_item = make_menu_item (CLOSE); gtk_menu_shell_append (GTK_MENU_SHELL (menu), priv->close_item); set_item_text (priv->close_item, _("_Close")); set_item_stock (priv->close_item, WNCK_STOCK_DELETE); g_signal_connect_object (G_OBJECT (priv->window), "state_changed", G_CALLBACK (state_changed_callback), G_OBJECT (menu), 0); g_signal_connect_object (G_OBJECT (priv->window), "actions_changed", G_CALLBACK (actions_changed_callback), G_OBJECT (menu), 0); g_signal_connect_object (G_OBJECT (priv->window), "workspace_changed", G_CALLBACK (workspace_changed_callback), G_OBJECT (menu), 0); screen = wnck_window_get_screen (priv->window); g_signal_connect_object (G_OBJECT (screen), "workspace_created", G_CALLBACK (screen_workspace_callback), G_OBJECT (menu), 0); g_signal_connect_object (G_OBJECT (screen), "workspace_destroyed", G_CALLBACK (screen_workspace_callback), G_OBJECT (menu), 0); g_signal_connect_object (G_OBJECT (screen), "viewports_changed", G_CALLBACK (viewports_changed_callback), G_OBJECT (menu), 0); update_menu_state (menu); return obj; }
//---------------------------------------------------------------------------------------------------------------------- // SET TEXT //---------------------------------------------------------------------------------------------------------------------- void cDlgFigPredefinedHotkeys :: set_text () { set_item_text ( ID_LINK, L"DlgFigPredefinedHotkeys.Link", L"http://mojoware.org/help/predefined_hotkeys.html" ); }
//---------------------------------------------------------------------------------------------------------------------- // SET TEXT //---------------------------------------------------------------------------------------------------------------------- void cDlgSetTrigger :: set_text () { set_item_text ( ID_LINK, L"DlgSetTrigger.Link", L"http://mojoware.org/help/triggers.html" ); }
void ProgressWindow::set_message(const TCHAR *text) { set_item_text(IDC_MESSAGE, text); update(); }