/* appicon.h- application icon
 *
 *  Window Maker window manager
 *
 *  Copyright (c) 1997-2003 Alfredo K. Kojima
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License along
 *  with this program; if not, write to the Free Software Foundation, Inc.,
 *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */


#ifndef WMAPPICON_H_
#define WMAPPICON_H_

#include <wraster.h>

#include "window.h"
#include "icon.h"
#include "application.h"

typedef struct WAppIcon WAppIcon;

/******** Accessors/mutators ********/
short wAppIconGetXIndex(WAppIcon *aicon);
void wAppIconSetXIndex(WAppIcon *aicon, short x_index);

short wAppIconGetYIndex(WAppIcon *aicon);
void wAppIconSetYIndex(WAppIcon *aicon, short y_index);

struct WAppIcon *wAppIconGetNext(WAppIcon *aicon);

struct WAppIcon *wAppIconGetPrev(WAppIcon *aicon);

int wAppIconGetXPos(WAppIcon *aicon);
void wAppIconSetXPos(WAppIcon *aicon, int x_pos);

int wAppIconGetYPos(WAppIcon *aicon);
void wAppIconSetYPos(WAppIcon *aicon, int y_pos);

WIcon *wAppIconGetIcon(WAppIcon *aicon);

char *wAppIconGetCommand(WAppIcon *aicon);
void wAppIconSetCommand(WAppIcon *aicon, char *command);

#ifdef USE_DOCK_XDND
char *wAppIconGetDnDCommand(WAppIcon *aicon);
void wAppIconSetDnDCommand(WAppIcon *aicon, char *command);
#endif  // USE_DOCK_XDND

char *wAppIconGetPasteCommand(WAppIcon *aicon);
void wAppIconSetPasteCommand(WAppIcon *aicon, char *command);

char *wAppIconGetWmClass(WAppIcon *aicon);

char *wAppIconGetWmInstance(WAppIcon *aicon);

pid_t wAppIconGetPid(WAppIcon *aicon);
void wAppIconSetPid(WAppIcon *aicon, pid_t pid);

Window wAppIconGetMainWindow(WAppIcon *aicon);
void wAppIconSetMainWindow(WAppIcon *aicon, Window main_window);

struct WDock *wAppIconGetDock(WAppIcon *aicon);
void wAppIconSetDock(WAppIcon *aicon, struct WDock *dock);

struct _AppSettingsPanel *wAppIconGetPanel(WAppIcon *aicon);
void wAppIconSetPanel(WAppIcon *aicon, struct _AppSettingsPanel *panel);

int wAppIconIsDocked(WAppIcon *aicon);
void wAppIconSetDocked(WAppIcon *aicon, int docked);

int wAppIconIsOmnipresent(WAppIcon *aicon);
void wAppIconSetOmnipresent(WAppIcon *aicon, int omnipresent);

int wAppIconIsAttracted(WAppIcon *aicon);
void wAppIconSetAttracted(WAppIcon *aicon, int attracted);

int wAppIconIsLaunching(WAppIcon *aicon);
void wAppIconSetLaunching(WAppIcon *aicon, int launching);

int wAppIconIsRunning(WAppIcon *aicon);
void wAppIconSetRunning(WAppIcon *aicon, int running);

int wAppIconIsRelaunching(WAppIcon *aicon);
void wAppIconSetRelaunching(WAppIcon *aicon, int relaunching);

int wAppIconIsForceDocked(WAppIcon *aicon);
void wAppIconSetForceDocked(WAppIcon *aicon, int forced_dock);

int wAppIconIsAutoLaunch(WAppIcon *aicon);
void wAppIconSetAutoLaunch(WAppIcon *aicon, int auto_launch);

int wAppIconIsEditing(WAppIcon *aicon);
void wAppIconSetEditing(WAppIcon *aicon, int editing);

int wAppIconIsDropLaunch(WAppIcon *aicon);
void wAppIconSetDropLaunch(WAppIcon *aicon, int drop_launch);

int wAppIconIsPasteLaunch(WAppIcon *aicon);
void wAppIconSetPasteLaunch(WAppIcon *aicon, int paste_launch);

int wAppIconIsBuggyApp(WAppIcon *aicon);
void wAppIconSetBuggyApp(WAppIcon *aicon, int buggy_app);

int wAppIconIsLocked(WAppIcon *aicon);
void wAppIconSetLocked(WAppIcon *aicon, int locked);

/******** Lifecycle/resource management ********/
WAppIcon *wAppIconCreateForDock(WScreen *scr, const char *command, const char *wm_instance,
				const char *wm_class, int tile);
Bool wHandleAppIconMove(WAppIcon *aicon, XEvent *event);

void wAppIconDestroy(WAppIcon *aicon);
void wAppIconPaint(WAppIcon *aicon);
void wAppIconMove(WAppIcon *aicon, int x, int y);
void create_appicon_for_application(WApplication *wapp, WWindow *wwin);
void removeAppIconFor(WApplication * wapp);
void save_appicon(WAppIcon *aicon);
void paint_app_icon(WApplication *wapp);
void unpaint_app_icon(WApplication *wapp);
void wApplicationExtractDirPackIcon(const char *path, const char *wm_instance,
				    const char *wm_class);
WAppIcon *wAppIconFor(Window window);

void appIconMouseDown(WObjDescriptor * desc, XEvent * event);

#endif
