mirror of https://github.com/Gnucash/gnucash
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@448 57a11ea4-9604-0410-9ed3-97b8803252fdzzzoldfeatures/multiline
parent
76674673f2
commit
9d2db7c955
@ -0,0 +1,64 @@
|
||||
|
||||
#include "actioncell.h"
|
||||
|
||||
static void realizeAction (struct _BasicCell *bcell, void *w);
|
||||
static void destroyAction (struct _BasicCell *bcell);
|
||||
|
||||
/* =============================================== */
|
||||
|
||||
ActionCell *xaccMallocActionCell (void)
|
||||
{
|
||||
ActionCell * cell;
|
||||
cell = (ActionCell *) malloc (sizeof (ActionCell));
|
||||
xaccInitActionCell (cell);
|
||||
return cell;
|
||||
}
|
||||
|
||||
void xaccInitActionCell (ActionCell *cell)
|
||||
{
|
||||
xaccInitComboCell ( &(cell->cell));
|
||||
cell->chain_realize = cell->cell.cell.realize;
|
||||
cell->cell.cell.realize = realizeAction;
|
||||
}
|
||||
|
||||
/* =============================================== */
|
||||
|
||||
static
|
||||
void realizeAction (struct _BasicCell *bcell, void *w)
|
||||
{
|
||||
ActionCell *cell = (ActionCell *) bcell;
|
||||
|
||||
/* first, call the combobox realize */
|
||||
cell->cell.cell.realize = cell->chain_realize;
|
||||
if (cell->chain_realize) {
|
||||
(cell->chain_realize) (bcell, w);
|
||||
}
|
||||
|
||||
/* now, install our destroy */
|
||||
cell->chain_destroy = cell->cell.cell.destroy;
|
||||
cell->cell.cell.destroy = destroyAction;
|
||||
|
||||
/* finally, add menu items */
|
||||
xaccAddComboCellMenuItem ( &(cell->cell), "yo dude");
|
||||
xaccAddComboCellMenuItem ( &(cell->cell), "he haw");
|
||||
}
|
||||
|
||||
/* =============================================== */
|
||||
|
||||
static
|
||||
void destroyAction (struct _BasicCell *bcell)
|
||||
{
|
||||
ActionCell *cell = (ActionCell *) bcell;
|
||||
|
||||
/* first, call the combobox destroy */
|
||||
cell->cell.cell.destroy = cell->chain_destroy;
|
||||
if (cell->chain_destroy) {
|
||||
(cell->chain_destroy) (bcell);
|
||||
}
|
||||
|
||||
/* now, install our realize */
|
||||
cell->chain_realize = cell->cell.cell.realize;
|
||||
cell->cell.cell.realize = realizeAction;
|
||||
}
|
||||
|
||||
/* =============== end of file =================== */
|
||||
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* FILE:
|
||||
* actioncell.h
|
||||
*
|
||||
* FUNCTION:
|
||||
* Implements a actionbox cell
|
||||
*
|
||||
* HISTORY:
|
||||
* Created Jan 1998 Linas Vepstas
|
||||
* Copyright (c) 1998 Linas Vepstas
|
||||
*/
|
||||
|
||||
#ifndef __XACC_ACTION_CELL_C__
|
||||
#define __XACC_ACTION_CELL_C__
|
||||
|
||||
#include "combocell.h"
|
||||
|
||||
typedef struct _ActionCell {
|
||||
ComboCell cell;
|
||||
void (* chain_realize) (struct _BasicCell *, void *gui_handle);
|
||||
void (* chain_destroy) (struct _BasicCell *);
|
||||
} ActionCell;
|
||||
|
||||
ActionCell * xaccMallocActionCell (void);
|
||||
void xaccInitActionCell (ActionCell *);
|
||||
|
||||
#endif /* __XACC_ACTION_CELL_C__ */
|
||||
|
||||
/* --------------- end of file ---------------------- */
|
||||
Loading…
Reference in new issue