PIKApp/libpika/pikaprogress.h

145 lines
4.8 KiB
C

/* LIBPIKA - The PIKA Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
*
* pikaprogress.h
*
* This library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <https://www.gnu.org/licenses/>.
*/
#if !defined (__PIKA_H_INSIDE__) && !defined (PIKA_COMPILATION)
#error "Only <libpika/pika.h> can be included directly."
#endif
#ifndef __PIKA_PROGRESS_H__
#define __PIKA_PROGRESS_H__
G_BEGIN_DECLS
/**
* PikaProgressVtableStartFunc:
* @message: The message to show
* @cancelable: Whether the procedure is cancelable
* @user_data: (closure): User data
*
* Starts the progress
*/
typedef void (* PikaProgressVtableStartFunc) (const gchar *message,
gboolean cancelable,
gpointer user_data);
/**
* PikaProgressVtableEndFunc:
* @user_data: (closure): User data
*
* Ends the progress
*/
typedef void (* PikaProgressVtableEndFunc) (gpointer user_data);
/**
* PikaProgressVtableSetTextFunc:
* @message: The new text
* @user_data: (closure): User data
*
* Sets a new text on the progress.
*/
typedef void (* PikaProgressVtableSetTextFunc) (const gchar *message,
gpointer user_data);
/**
* PikaProgressVtableSetValueFunc:
* @percentage: The progress in percent
* @user_data: (closure): User data
*
* Sets a new percentage on the progress.
*/
typedef void (* PikaProgressVtableSetValueFunc) (gdouble percentage,
gpointer user_data);
/**
* PikaProgressVtablePulseFunc:
* @user_data: (closure): User data
*
* Makes the progress pulse
*/
typedef void (* PikaProgressVtablePulseFunc) (gpointer user_data);
/**
* PikaProgressVtableGetWindowFunc:
* @user_data: (closure): User data
*
* Returns: the ID of the window where the progress is displayed.
*/
typedef guint64 (* PikaProgressVtableGetWindowFunc) (gpointer user_data);
typedef struct _PikaProgressVtable PikaProgressVtable;
/**
* PikaProgressVtable:
* @start: starts the progress.
* @end: ends the progress.
* @set_text: sets a new text on the progress.
* @set_value: sets a new percentage on the progress.
* @pulse: makes the progress pulse.
* @get_window: returns the ID of the window where the progress is displayed.
* @_pika_reserved1: reserved pointer for future expansion.
* @_pika_reserved2: reserved pointer for future expansion.
* @_pika_reserved3: reserved pointer for future expansion.
* @_pika_reserved4: reserved pointer for future expansion.
* @_pika_reserved5: reserved pointer for future expansion.
* @_pika_reserved6: reserved pointer for future expansion.
* @_pika_reserved7: reserved pointer for future expansion.
* @_pika_reserved8: reserved pointer for future expansion.
**/
struct _PikaProgressVtable
{
PikaProgressVtableStartFunc start;
PikaProgressVtableEndFunc end;
PikaProgressVtableSetTextFunc set_text;
PikaProgressVtableSetValueFunc set_value;
PikaProgressVtablePulseFunc pulse;
PikaProgressVtableGetWindowFunc get_window;
/* Padding for future expansion. Must be initialized with NULL! */
void (* _pika_reserved1) (void);
void (* _pika_reserved2) (void);
void (* _pika_reserved3) (void);
void (* _pika_reserved4) (void);
void (* _pika_reserved5) (void);
void (* _pika_reserved6) (void);
void (* _pika_reserved7) (void);
void (* _pika_reserved8) (void);
};
const gchar * pika_progress_install_vtable (const PikaProgressVtable *vtable,
gpointer user_data,
GDestroyNotify user_data_destroy);
void pika_progress_uninstall (const gchar *progress_callback);
gboolean pika_progress_init (const gchar *message);
gboolean pika_progress_init_printf (const gchar *format,
...) G_GNUC_PRINTF (1, 2);
gboolean pika_progress_set_text_printf (const gchar *format,
...) G_GNUC_PRINTF (1, 2);
gboolean pika_progress_update (gdouble percentage);
G_END_DECLS
#endif /* __PIKA_PROGRESS_H__ */