SimpleLauncherIcon::SimpleLauncherIcon(IconType type)
  : LauncherIcon(type)
  , icon_name("", sigc::mem_fun(this, &SimpleLauncherIcon::SetIconName))
{
  auto* theme = gtk_icon_theme_get_default();
  theme_changed_signal_.Connect(theme, "changed", [this] (GtkIconTheme *) {
    _current_theme_is_mono = -1;
    ReloadIcon();
  });
}
bool SimpleLauncherIcon::SetIconName(std::string& target, std::string const& value)
{
  if (target == value)
    return false;

  target = value;
  ReloadIcon();

  return true;
}
Exemplo n.º 3
0
/*
 * This is the window proc for an individual MDI child window containing
 * a displayable icon.
 */
LONG _EXPORT FAR PASCAL MdiIconProc( HWND hwnd, UINT msg,
                                    WPARAM wparam, LPARAM lparam )
{
    an_MDI_icon     *icon;
    HDC             hdc;
    PAINTSTRUCT     ps;
    RECT            rect;

    icon = (an_MDI_icon *) GetWindowLong( hwnd, 0 );
    switch( msg ) {
    case WM_CREATE:
        icon = UtilMalloc( sizeof( an_MDI_icon ) );
        icon->XOR_bitmap = 0;   /* use as flag so we don't paint */
        SetWindowLong( hwnd, 0, (LONG) (LPVOID) icon );
        break;

    case WM_COMMAND:
        if( LOWORD( wparam ) == IDM_SWITCHICON ) {
            if( SwitchIcon( icon ) ) {
                ReloadIcon( hwnd, icon );
                InvalidateRect( hwnd, NULL, TRUE );
                UpdateWindow( hwnd );
            }
        }
        break;

    case WM_PAINT:
        if( icon->XOR_bitmap ) {
            hdc = BeginPaint( hwnd, &ps );
            /* draw the bitmap in the client area of the MDI window */
            GetClientRect( hwnd, &rect );
            DrawMdiIcon( hdc, icon, &rect );
            EndPaint( hwnd, &ps );
        }
        break;

    case WM_DESTROY:
        /* destroy the BITMAP and the ICON */
        DeleteObject( icon->XOR_bitmap );
        DeleteObject( icon->AND_bitmap );
        UtilFree( icon->file_name );
        UtilFree( icon );
        break;
    default:
        return( DefMDIChildProc( hwnd, msg, wparam, lparam ) );
    }
    return( 0 );
} /* MdiIconProc */