Exemple #1
0
void ResourceManager::handleTopLevelWindowMessages(HWND hWnd, UINT message, WPARAM & wParam, LPARAM & lParam)
{
	switch( message ) {
		case WM_KEYDOWN:
		case WM_KEYUP:
		case WM_CHAR:
			TRACE_M("handleTopLevelWindowMessages -> child handle = " << hWnd << 
                    " message = " << windowsMessageToString(message));
		    if( auto windowImpl = getTopLevelWindow(hWnd) ) {
                TRACE_M("handleTopLevelWindowMessages -> PARENT WINDOW! hWnd = " << windowImpl->hWnd << 
                        " message = " << windowsMessageToString(message));
                windowImpl->processMessage(message,wParam,lParam);
		    }
        break;
	}
}
void AP_UnixFrameImpl::_createWindow()
{
	_createTopLevelWindow();
	
	gtk_widget_show(getTopLevelWindow());

	if(getFrame()->getFrameMode() == XAP_NormalFrame)
	{
		// needs to be shown so that the following functions work
		// TODO: get rid of cursed flicker caused by initially
		// TODO: showing these and then hiding them (esp.
		// TODO: noticable in the gnome build with a toolbar disabled)
		_showOrHideToolbars();
		_showOrHideStatusbar();
	}
	if(getFrame()->isMenuScrollHidden())
	{
	    _hideMenuScroll(true);
	}
}
void AP_UnixFrameImpl::_setWindowIcon()
{
	// attach program icon to window
	GtkWidget * window = getTopLevelWindow();

	GtkIconTheme * theme = gtk_icon_theme_get_default();
	GdkPixbuf * icon = gtk_icon_theme_load_icon(theme, "abiword_48", 48, GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
	if (icon)
	{
		gtk_window_set_icon (GTK_WINDOW (window), icon);
		g_object_unref (G_OBJECT(icon));
		return;
	}

	// Hmm, we can't load the icon from the theme. This happens when we are
	// are installed in a custom prefix, so let's try to load the icon manually.

	GError* error = NULL;
	std::string icon_path = std::string(DATADIR) + G_DIR_SEPARATOR_S + "icons" + G_DIR_SEPARATOR_S + "abiword_48.png";
	icon = gdk_pixbuf_new_from_file(icon_path.c_str(), &error);
	if (icon)
	{
		gtk_window_set_icon (GTK_WINDOW (window), icon);
		g_object_unref (G_OBJECT(icon));	
	}
	else
	{
		if (error)
		{
			g_warning("Unable to load AbiWord icon: %s\n", error ? error->message : "(null)");
			g_error_free(error);
		}
		else
			g_warning("Unable to load AbiWord icon %s\n", icon_path.c_str());
	}
}