ui/ui/icons.h

Tue, 02 Jun 2026 20:12:57 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Tue, 02 Jun 2026 20:12:57 +0200
changeset 1160
881dfcf46cd6
parent 1081
1126fb7d174e
permissions
-rw-r--r--

add ui_icon_name

/*
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 *
 * Copyright 2024 Olaf Wintermann. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 *   1. Redistributions of source code must retain the above copyright
 *      notice, this list of conditions and the following disclaimer.
 *
 *   2. Redistributions in binary form must reproduce the above copyright
 *      notice, this list of conditions and the following disclaimer in the
 *      documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef UI_ICONS_H
#define UI_ICONS_H

#include "toolkit.h"

#ifdef __cplusplus
extern "C" {
#endif

#ifdef UI_GTK
    
#define UI_ICON_HOME "go-home"
#define UI_ICON_NEW_WINDOW "list-add"
#define UI_ICON_REFRESH "view-refresh"
#define UI_ICON_NEW_FOLDER "folder-new"
#define UI_ICON_ADD "document-new"
#define UI_ICON_UPLOAD "document-open"
#define UI_ICON_SAVE_LOCAL "document-save-as"
#define UI_ICON_DELETE "edit-delete"
#define UI_ICON_DOCK_LEFT ""
#define UI_ICON_DOCK_RIGHT ""
#define UI_ICON_GO_BACK "go-previous"
#define UI_ICON_GO_FORWARD "go-next"
#define UI_ICON_GO_UP "go-up"
#define UI_ICON_GO_DOWN "go-down"
    
#endif /* UI_GTK */
    
#ifdef UI_QT
    
#define UI_ICON_HOME "go-home"
#define UI_ICON_NEW_WINDOW "list-add"
#define UI_ICON_REFRESH "view-refresh"
#define UI_ICON_NEW_FOLDER "folder-new"
#define UI_ICON_ADD "document-new"
#define UI_ICON_UPLOAD "document-open"
#define UI_ICON_SAVE_LOCAL "document-save-as"
#define UI_ICON_DELETE "edit-delete"
#define UI_ICON_DOCK_LEFT ""
#define UI_ICON_DOCK_RIGHT ""
#define UI_ICON_GO_BACK "go-previous"
#define UI_ICON_GO_FORWARD "go-next"
#define UI_ICON_GO_UP "go-up"
#define UI_ICON_GO_DOWN "go-down"
    
#endif /* UI_QT */

#ifdef UI_WINUI
    
#define UI_ICON_HOME "Home"
#define UI_ICON_NEW_WINDOW "NewWindow"
#define UI_ICON_REFRESH "Refresh"
#define UI_ICON_NEW_FOLDER "NewFolder"
#define UI_ICON_ADD "Add"
#define UI_ICON_UPLOAD "Upload"
#define UI_ICON_SAVE_LOCAL "SaveLocal"
#define UI_ICON_DELETE "Delete"
#define UI_ICON_DOCK_LEFT "DockLeft"
#define UI_ICON_DOCK_RIGHT "DockRight"
#define UI_ICON_GO_BACK "Back"
#define UI_ICON_GO_FORWARD "Forward"
#define UI_ICON_GO_UP "Up"
#define UI_ICON_GO_DOWN "" // TODO: implement workaround for missing down symbol
    
#endif /* UI_WINUI */

#ifdef UI_COCOA

#define UI_ICON_HOME "NSImageNameHomeTemplate"
#define UI_ICON_NEW_WINDOW ""
#define UI_ICON_REFRESH "NSImageNameRefreshTemplate"
#define UI_ICON_NEW_FOLDER ""
#define UI_ICON_ADD "NSImageNameAddTemplate"
#define UI_ICON_UPLOAD ""
#define UI_ICON_SAVE_LOCAL ""
#define UI_ICON_DELETE ""
#define UI_ICON_DOCK_LEFT ""
#define UI_ICON_DOCK_RIGHT ""
#define UI_ICON_GO_BACK "NSImageNameGoLeftTemplate"
#define UI_ICON_GO_FORWARD "NSImageNameGoRightTemplate"
#define UI_ICON_GO_UP ""
#define UI_ICON_GO_DOWN ""

#endif /* UI_COCOA */
    
#ifdef UI_MOTIF
    
#define UI_ICON_HOME ""
#define UI_ICON_NEW_WINDOW ""
#define UI_ICON_REFRESH ""
#define UI_ICON_NEW_FOLDER ""
#define UI_ICON_ADD ""
#define UI_ICON_UPLOAD ""
#define UI_ICON_SAVE_LOCAL ""
#define UI_ICON_DELETE ""
#define UI_ICON_DOCK_LEFT ""
#define UI_ICON_DOCK_RIGHT ""
#define UI_ICON_GO_BACK ""
#define UI_ICON_GO_FORWARD ""
#define UI_ICON_GO_UP ""
#define UI_ICON_GO_DOWN "" 
    
#endif /* UI_MOTIF */
    
#ifdef UI_WIN32
    
#define UI_ICON_HOME ""
#define UI_ICON_NEW_WINDOW ""
#define UI_ICON_REFRESH ""
#define UI_ICON_NEW_FOLDER ""
#define UI_ICON_ADD ""
#define UI_ICON_UPLOAD ""
#define UI_ICON_SAVE_LOCAL ""
#define UI_ICON_DELETE ""
#define UI_ICON_DOCK_LEFT ""
#define UI_ICON_DOCK_RIGHT ""
#define UI_ICON_GO_BACK ""
#define UI_ICON_GO_FORWARD ""
#define UI_ICON_GO_UP ""
#define UI_ICON_GO_DOWN "" 
    
#endif /* UI_MOTIF */
    
    
enum UiIconId {
    UI_ICON_ID_HOME = 0,
    UI_ICON_ID_NEW_WINDOW,
    UI_ICON_ID_REFRESH,
    UI_ICON_ID_NEW_FOLDER,
    UI_ICON_ID_ADD,
    UI_ICON_ID_UPLOAD,
    UI_ICON_ID_SAVE_LOCAL,
    UI_ICON_ID_DELETE,
    UI_ICON_ID_DOCK_LEFT,
    UI_ICON_ID_DOCK_RIGHT,
    UI_ICON_ID_GO_BACK,
    UI_ICON_ID_GO_FORWARD,
    UI_ICON_ID_GO_UP,
    UI_ICON_ID_GO_DOWN
};
    
UIEXPORT UiIcon* ui_icon(const char* name, size_t size);
UIEXPORT UiIcon* ui_icon_unscaled(const char *name, int size);
UIEXPORT UiIcon* ui_imageicon(const char* file);
UIEXPORT void ui_icon_free(UiIcon* icon);

UIEXPORT UiIcon* ui_foldericon(size_t size);
UIEXPORT UiIcon* ui_fileicon(size_t size);


UIEXPORT const char* ui_icon_name(enum UiIconId icon_id);

#ifdef __cplusplus
}
#endif

#endif /* UI_ICONS_H */

mercurial