mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Glibmm: Add the final important engine objects as glibmm wrappers.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@21300 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
e2fbc55ad8
commit
bdd46d7c38
@ -7,6 +7,8 @@ libgncmod_gtkmm_la_SOURCES = \
|
||||
gncmm/Book.cpp \
|
||||
gncmm/Commodity.cpp \
|
||||
gncmm/Numeric.cpp \
|
||||
gncmm/Split.cpp \
|
||||
gncmm/Transaction.cpp \
|
||||
gncmm/wrap_init.cpp \
|
||||
gnc-plugin-gtkmm.cpp \
|
||||
gncmod-gtkmm.cpp
|
||||
@ -16,10 +18,14 @@ noinst_HEADERS = \
|
||||
gncmm/Book.hpp \
|
||||
gncmm/Commodity.hpp \
|
||||
gncmm/GncInstance.hpp \
|
||||
gncmm/Numeric.hpp \
|
||||
gncmm/Split.hpp \
|
||||
gncmm/Transaction.hpp \
|
||||
gncmm/private/Account_p.hpp \
|
||||
gncmm/private/Book_p.hpp \
|
||||
gncmm/private/Commodity_p.hpp \
|
||||
gncmm/Numeric.hpp \
|
||||
gncmm/private/Split_p.hpp \
|
||||
gncmm/private/Transaction_p.hpp \
|
||||
gncmm/wrap_init.hpp \
|
||||
gnc-plugin-gtkmm.hpp
|
||||
|
||||
|
@ -32,10 +32,13 @@ extern "C"
|
||||
}
|
||||
|
||||
#include <glibmm/object.h>
|
||||
//#include "GncInstance.hpp"
|
||||
|
||||
namespace gnc
|
||||
{
|
||||
class Book_Class;
|
||||
class Book;
|
||||
class GncInstance;
|
||||
} // END namespace gnc
|
||||
|
||||
namespace gnc
|
||||
@ -45,7 +48,7 @@ class Account;
|
||||
/** Wrapper around a gnucash ::QofBook pointer with C++ methods for
|
||||
* easier setter and getter access.
|
||||
*/
|
||||
class Book : public Glib::Object
|
||||
class Book : public Glib::Object //, public GncInstance
|
||||
{
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
typedef Book CppObjectType;
|
||||
|
@ -33,6 +33,7 @@ extern "C"
|
||||
|
||||
#include <glibmm/object.h>
|
||||
#include <glibmm/ustring.h>
|
||||
#include "GncInstance.hpp"
|
||||
|
||||
namespace gnc
|
||||
{
|
||||
@ -43,7 +44,7 @@ namespace gnc
|
||||
{
|
||||
|
||||
/** Wrapper around a gnucash \ref gnc_commodity object */
|
||||
class Commodity : public Glib::Object
|
||||
class Commodity : public Glib::Object, public GncInstance
|
||||
{
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
typedef Commodity CppObjectType;
|
||||
|
@ -30,6 +30,14 @@ extern "C"
|
||||
#include "qof.h"
|
||||
}
|
||||
|
||||
#include <glibmm/object.h>
|
||||
|
||||
namespace gnc
|
||||
{
|
||||
class Book;
|
||||
class GncInstance;
|
||||
} // END namespace gnc
|
||||
|
||||
#include "Book.hpp"
|
||||
|
||||
namespace gnc
|
||||
@ -51,37 +59,37 @@ public:
|
||||
|
||||
Glib::RefPtr<Book> getBook() const
|
||||
{
|
||||
return Glib::wrap(qof_instance_get_book (QOF_INSTANCE(get_gobj())));
|
||||
return Glib::wrap(qof_instance_get_book (get_instance()));
|
||||
}
|
||||
const ::GncGUID* getGUID() const
|
||||
{
|
||||
return qof_entity_get_guid(QOF_INSTANCE(get_gobj()));
|
||||
return qof_entity_get_guid(get_instance());
|
||||
}
|
||||
|
||||
bool is_dirty() const
|
||||
{
|
||||
return qof_instance_get_dirty(QOF_INSTANCE(get_gobj()));
|
||||
return qof_instance_get_dirty(get_instance());
|
||||
}
|
||||
void set_dirty()
|
||||
{
|
||||
return qof_instance_set_dirty(QOF_INSTANCE(get_gobj()));
|
||||
return qof_instance_set_dirty(get_instance());
|
||||
}
|
||||
void mark_clean()
|
||||
{
|
||||
return qof_instance_mark_clean(QOF_INSTANCE(get_gobj()));
|
||||
return qof_instance_mark_clean(get_instance());
|
||||
}
|
||||
|
||||
//bool check_type(const char* type_id) { return (0 == g_strcmp0(type_id, QOF_INSTANCE(base_class::get())->e_type)); }
|
||||
//Slots getSlots() const { return qof_instance_get_slots(QOF_INSTANCE(get())); }
|
||||
|
||||
private:
|
||||
GObject* get_gobj()
|
||||
::QofInstance* get_instance()
|
||||
{
|
||||
return dynamic_cast<Glib::Object&>(*this).gobj();
|
||||
return QOF_INSTANCE(dynamic_cast<Glib::Object&>(*this).gobj());
|
||||
}
|
||||
const GObject* get_gobj() const
|
||||
/*const*/ ::QofInstance* get_instance() const
|
||||
{
|
||||
return dynamic_cast<const Glib::Object&>(*this).gobj();
|
||||
return QOF_INSTANCE(dynamic_cast<const Glib::Object&>(*this).gobj());
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -65,7 +65,7 @@ inline Glib::ustring gchar_to_ustring(gchar* tmp_string)
|
||||
|
||||
#if GLIB_HAVE_DATETIME
|
||||
// Glib::DateTime is new in glibmm-2.29 but very useful
|
||||
inline Glib::DateTime toQDateTime(const ::Timespec& timespec)
|
||||
inline Glib::DateTime toGDateTime(const ::Timespec& timespec)
|
||||
{
|
||||
Glib::DateTime result = Glib::DateTime::create_now_utc(timespec.tv_sec);
|
||||
result.add_seconds(timespec.tv_nsec * 1e-9);
|
||||
|
204
src/optional/gtkmm/gncmm/Split.cpp
Normal file
204
src/optional/gtkmm/gncmm/Split.cpp
Normal file
@ -0,0 +1,204 @@
|
||||
/*
|
||||
* Split.cpp
|
||||
* Copyright (C) 2010 Christian Stimming
|
||||
*
|
||||
* 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, contact:
|
||||
*
|
||||
* Free Software Foundation Voice: +1-617-542-5942
|
||||
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
|
||||
* Boston, MA 02110-1301, USA gnu@gnu.org
|
||||
*/
|
||||
|
||||
#include "Split.hpp"
|
||||
|
||||
#include "Account.hpp"
|
||||
#include "Book.hpp"
|
||||
#include "Transaction.hpp"
|
||||
#include "private/Split_p.hpp"
|
||||
|
||||
namespace Glib
|
||||
{
|
||||
|
||||
Glib::RefPtr<gnc::Split> wrap(::Split* object, bool take_copy)
|
||||
{
|
||||
return Glib::RefPtr<gnc::Split>( dynamic_cast<gnc::Split*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
|
||||
//We use dynamic_cast<> in case of multiple inheritance.
|
||||
}
|
||||
|
||||
} /* namespace Glib */
|
||||
|
||||
namespace gnc
|
||||
{
|
||||
|
||||
/* The *_Class implementation: */
|
||||
|
||||
const Glib::Class& Split_Class::init()
|
||||
{
|
||||
if (!gtype_) // create the GType if necessary
|
||||
{
|
||||
// Glib::Class has to know the class init function to clone custom types.
|
||||
class_init_func_ = &Split_Class::class_init_function;
|
||||
|
||||
// This is actually just optimized away, apparently with no harm.
|
||||
// Make sure that the parent type has been created.
|
||||
//CppClassParent::CppObjectType::get_type();
|
||||
|
||||
// Create the wrapper type, with the same class/instance size as the base type.
|
||||
register_derived_type(gnc_split_get_type());
|
||||
|
||||
// Add derived versions of interfaces, if the C type implements any interfaces:
|
||||
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
void Split_Class::class_init_function(void* g_class, void* class_data)
|
||||
{
|
||||
BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
|
||||
CppClassParent::class_init_function(klass, class_data);
|
||||
}
|
||||
|
||||
|
||||
Glib::ObjectBase* Split_Class::wrap_new(GObject* object)
|
||||
{
|
||||
return new Split((::Split*)object);
|
||||
}
|
||||
|
||||
|
||||
/* The implementation: */
|
||||
|
||||
::Split* Split::gobj_copy()
|
||||
{
|
||||
reference();
|
||||
return gobj();
|
||||
}
|
||||
|
||||
Split::Split(const Glib::ConstructParams& construct_params)
|
||||
: Glib::Object(construct_params)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Split::Split(::Split* castitem)
|
||||
: Glib::Object((GObject*)(castitem))
|
||||
{}
|
||||
|
||||
|
||||
Split::~Split()
|
||||
{}
|
||||
|
||||
|
||||
Split::CppClassType Split::split_class_; // initialize static member
|
||||
|
||||
GType Split::get_type()
|
||||
{
|
||||
return split_class_.init().get_type();
|
||||
}
|
||||
|
||||
|
||||
GType Split::get_base_type()
|
||||
{
|
||||
return gnc_split_get_type();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Glib::RefPtr<Account> Split::getAccount() const
|
||||
{
|
||||
return Glib::wrap(xaccSplitGetAccount(gobj()));
|
||||
}
|
||||
void Split::setAccount(Glib::RefPtr<Account> acc)
|
||||
{
|
||||
if (acc) xaccSplitSetAccount(gobj(), acc->gobj());
|
||||
}
|
||||
void Split::setAccount(::Account* acc)
|
||||
{
|
||||
xaccSplitSetAccount(gobj(), acc);
|
||||
}
|
||||
|
||||
|
||||
Glib::RefPtr<Transaction> Split::getParent() const
|
||||
{
|
||||
return Glib::wrap(xaccSplitGetParent(gobj()));
|
||||
}
|
||||
void Split::setParent(Glib::RefPtr<Transaction> trans)
|
||||
{
|
||||
if (trans) xaccSplitSetParent(gobj(), trans->gobj());
|
||||
}
|
||||
void Split::setParent(Transaction& trans)
|
||||
{
|
||||
xaccSplitSetParent(gobj(), trans.gobj());
|
||||
}
|
||||
|
||||
Glib::RefPtr<Split> Split::getOtherSplit() const
|
||||
{
|
||||
return Glib::wrap(xaccSplitGetOtherSplit(gobj()));
|
||||
}
|
||||
|
||||
|
||||
TmpSplit::TmpSplit(const Glib::RefPtr<Split>& s, const TmpTransaction* parent_trans)
|
||||
: m_account(s->getAccount()->gobj())
|
||||
, m_parent(parent_trans)
|
||||
, m_memo(s->getMemo())
|
||||
, m_action(s->getAction())
|
||||
, m_reconcile(s->getReconcile())
|
||||
, m_amount(s->getAmount())
|
||||
, m_value(s->getValue())
|
||||
{}
|
||||
|
||||
TmpSplit::TmpSplit(::Account* account)
|
||||
{
|
||||
clear(account);
|
||||
}
|
||||
|
||||
TmpSplit* TmpSplit::getOtherSplit() const
|
||||
{
|
||||
if (!m_parent)
|
||||
return NULL;
|
||||
const TmpTransaction& p = *m_parent;
|
||||
if (p.countSplits() != 2)
|
||||
return NULL;
|
||||
TmpTransaction::TmpSplitList& splits = const_cast<TmpTransaction&>(p).getSplits();
|
||||
if (splits.front().getAccount() != m_account)
|
||||
return &splits.front();
|
||||
else
|
||||
return &splits.back();
|
||||
}
|
||||
|
||||
void TmpSplit::clear(::Account* account)
|
||||
{
|
||||
m_account = account;
|
||||
m_parent = NULL;
|
||||
m_memo.clear();
|
||||
m_action.clear();
|
||||
m_reconcile = NREC;
|
||||
m_amount = Numeric::zero();
|
||||
m_value = Numeric::zero();
|
||||
}
|
||||
|
||||
void TmpSplit::copyInto(Transaction& t) const
|
||||
{
|
||||
Glib::RefPtr<Split> s(Glib::wrap(xaccMallocSplit(t.getBook()->gobj())));
|
||||
s->setAccount(m_account);
|
||||
s->setParent(t);
|
||||
s->setMemo(m_memo);
|
||||
s->setAction(m_action);
|
||||
s->setReconcile(m_reconcile);
|
||||
s->setAmount(m_amount);
|
||||
s->setValue(m_value);
|
||||
}
|
||||
|
||||
} // END namespace gnc
|
330
src/optional/gtkmm/gncmm/Split.hpp
Normal file
330
src/optional/gtkmm/gncmm/Split.hpp
Normal file
@ -0,0 +1,330 @@
|
||||
/*
|
||||
* Split.hpp
|
||||
* Copyright (C) 2011 Christian Stimming
|
||||
*
|
||||
* 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, contact:
|
||||
*
|
||||
* Free Software Foundation Voice: +1-617-542-5942
|
||||
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
|
||||
* Boston, MA 02110-1301, USA gnu@gnu.org
|
||||
*/
|
||||
|
||||
#ifndef GNC_SPLIT_HPP
|
||||
#define GNC_SPLIT_HPP
|
||||
|
||||
// gnucash includes
|
||||
#include "config.h"
|
||||
extern "C"
|
||||
{
|
||||
#include "qof.h"
|
||||
#include "engine/Split.h"
|
||||
}
|
||||
|
||||
#include <glibmm/object.h>
|
||||
#include <glibmm/date.h>
|
||||
#include <glibmm/ustring.h>
|
||||
#include <vector>
|
||||
|
||||
#include "GncInstance.hpp"
|
||||
#include "Numeric.hpp"
|
||||
|
||||
namespace gnc
|
||||
{
|
||||
class Split_Class;
|
||||
} // END namespace gnc
|
||||
|
||||
namespace gnc
|
||||
{
|
||||
class Book;
|
||||
class Account;
|
||||
class Transaction;
|
||||
class TmpTransaction;
|
||||
|
||||
typedef std::vector< ::Split*> SplitQList;
|
||||
|
||||
/** Wrapper around a gnucash ::Split pointer with C++ methods for
|
||||
* easier setter and getter access.
|
||||
*/
|
||||
class Split : public Glib::Object, public GncInstance
|
||||
{
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
typedef Split CppObjectType;
|
||||
typedef Split_Class CppClassType;
|
||||
typedef ::Split BaseObjectType;
|
||||
typedef ::SplitClass BaseClassType;
|
||||
|
||||
private:
|
||||
friend class Split_Class;
|
||||
static CppClassType split_class_;
|
||||
|
||||
private:
|
||||
// noncopyable
|
||||
Split(const Split&);
|
||||
Split& operator=(const Split&);
|
||||
|
||||
protected:
|
||||
explicit Split(const Glib::ConstructParams& construct_params);
|
||||
explicit Split(::Split* castitem);
|
||||
|
||||
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||
|
||||
public:
|
||||
virtual ~Split();
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
static GType get_type() G_GNUC_CONST;
|
||||
static GType get_base_type() G_GNUC_CONST;
|
||||
#endif
|
||||
|
||||
///Provides access to the underlying C GObject.
|
||||
::Split* gobj()
|
||||
{
|
||||
return reinterpret_cast< ::Split*>(gobject_);
|
||||
}
|
||||
|
||||
///Provides access to the underlying C GObject.
|
||||
const ::Split* gobj() const
|
||||
{
|
||||
return reinterpret_cast< ::Split*>(gobject_);
|
||||
}
|
||||
|
||||
///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
|
||||
::Split* gobj_copy();
|
||||
|
||||
private:
|
||||
public:
|
||||
|
||||
|
||||
Glib::RefPtr<Account> getAccount() const;
|
||||
void setAccount(Glib::RefPtr<Account> acc);
|
||||
void setAccount(::Account* acc);
|
||||
|
||||
Glib::RefPtr<Transaction> getParent() const;
|
||||
void setParent(Glib::RefPtr<Transaction> trans);
|
||||
void setParent(Transaction& trans);
|
||||
|
||||
Glib::ustring getMemo() const
|
||||
{
|
||||
return xaccSplitGetMemo(gobj());
|
||||
}
|
||||
void setMemo(const Glib::ustring& v)
|
||||
{
|
||||
xaccSplitSetMemo(gobj(), v.c_str());
|
||||
}
|
||||
|
||||
Glib::ustring getAction() const
|
||||
{
|
||||
return xaccSplitGetAction(gobj());
|
||||
}
|
||||
void setAction(const Glib::ustring& v)
|
||||
{
|
||||
xaccSplitSetAction(gobj(), v.c_str());
|
||||
}
|
||||
|
||||
char getReconcile() const
|
||||
{
|
||||
return xaccSplitGetReconcile(gobj());
|
||||
}
|
||||
void setReconcile(char v)
|
||||
{
|
||||
xaccSplitSetReconcile(gobj(), v);
|
||||
}
|
||||
|
||||
Glib::RefPtr<Split> getOtherSplit() const;
|
||||
|
||||
Glib::ustring getCorrAccountFullName() const
|
||||
{
|
||||
return gchar_to_ustring(xaccSplitGetCorrAccountFullName(gobj()));
|
||||
}
|
||||
Glib::ustring getCorrAccountName() const
|
||||
{
|
||||
return xaccSplitGetCorrAccountName(gobj());
|
||||
}
|
||||
Glib::ustring getCorrAccountCode() const
|
||||
{
|
||||
return xaccSplitGetCorrAccountCode(gobj());
|
||||
}
|
||||
|
||||
void setAmount(const Numeric& amount)
|
||||
{
|
||||
xaccSplitSetAmount(gobj(), amount);
|
||||
}
|
||||
Numeric getAmount() const
|
||||
{
|
||||
return xaccSplitGetAmount(gobj());
|
||||
}
|
||||
void setValue(const Numeric& value)
|
||||
{
|
||||
xaccSplitSetValue(gobj(), value);
|
||||
}
|
||||
Numeric getValue() const
|
||||
{
|
||||
return xaccSplitGetValue(gobj());
|
||||
}
|
||||
Numeric getSharePrice() const
|
||||
{
|
||||
return xaccSplitGetSharePrice(gobj());
|
||||
}
|
||||
Numeric getBalance() const
|
||||
{
|
||||
return xaccSplitGetBalance(gobj());
|
||||
}
|
||||
Numeric getClearedBalance() const
|
||||
{
|
||||
return xaccSplitGetClearedBalance(gobj());
|
||||
}
|
||||
Numeric getReconciledBalance() const
|
||||
{
|
||||
return xaccSplitGetReconciledBalance(gobj());
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
static SplitQList fromGList(GList* glist)
|
||||
{
|
||||
SplitQList result;
|
||||
GList* list = glist;
|
||||
while (list)
|
||||
{
|
||||
result.append(reinterpret_cast< ::Split*>(list->data));
|
||||
list = g_list_next(list);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
/** This is a temporary split which belongs to a temporary transaction
|
||||
* (class gnc::TmpTransaction). Each of this tmp splits has all data
|
||||
* fields just like a "real" split, but it is not (yet) added to the
|
||||
* respective Account and Book. In other words, it is not stored in
|
||||
* the book yet.
|
||||
*
|
||||
* For this reason this class supports a full copy-by-value, which
|
||||
* will create new independent instances of all data fields. */
|
||||
class TmpSplit
|
||||
{
|
||||
public:
|
||||
/** Creates a new tmp split whose content is copied from the given
|
||||
* real transaction and it should belong to the given
|
||||
* TmpTransaction (but it is not added to the TmpTransaction's
|
||||
* split list here). */
|
||||
TmpSplit(const Glib::RefPtr<Split>& s, const TmpTransaction* parent_trans);
|
||||
|
||||
/** Creates a new empty tmp split, with the Account pointer
|
||||
* initialized with the given value. */
|
||||
TmpSplit(::Account* account = NULL);
|
||||
|
||||
/** Clears all data fields of this split. */
|
||||
void clear(::Account* account = NULL);
|
||||
|
||||
/** Copies the content of this tmp split into the given real
|
||||
* transaction by allocating a new real gnc::Split and adding it
|
||||
* to the given real gnc::Transaction. */
|
||||
void copyInto(Transaction& t) const;
|
||||
|
||||
::Account* getAccount() const
|
||||
{
|
||||
return m_account;
|
||||
}
|
||||
void setAccount(::Account* v)
|
||||
{
|
||||
m_account = v;
|
||||
}
|
||||
|
||||
const TmpTransaction* getParent() const
|
||||
{
|
||||
return m_parent;
|
||||
}
|
||||
void setParent(const TmpTransaction* v)
|
||||
{
|
||||
m_parent = v;
|
||||
}
|
||||
|
||||
/** Returns a pointer to the "Other" split if it exists, or NULL
|
||||
* if none or multiple of them exist. */
|
||||
TmpSplit* getOtherSplit() const;
|
||||
|
||||
Glib::ustring getMemo() const
|
||||
{
|
||||
return m_memo;
|
||||
}
|
||||
void setMemo(const Glib::ustring& v)
|
||||
{
|
||||
m_memo = v;
|
||||
}
|
||||
|
||||
Glib::ustring getAction() const
|
||||
{
|
||||
return m_action;
|
||||
}
|
||||
void setAction(const Glib::ustring& v)
|
||||
{
|
||||
m_action = v;
|
||||
}
|
||||
|
||||
char getReconcile() const
|
||||
{
|
||||
return m_reconcile;
|
||||
}
|
||||
void setReconcile(char v)
|
||||
{
|
||||
m_reconcile = v;
|
||||
}
|
||||
|
||||
Numeric getAmount() const
|
||||
{
|
||||
return m_amount;
|
||||
}
|
||||
void setAmount(const Numeric& v)
|
||||
{
|
||||
m_amount = v;
|
||||
}
|
||||
|
||||
Numeric getValue() const
|
||||
{
|
||||
return m_value;
|
||||
}
|
||||
void setValue(const Numeric& v)
|
||||
{
|
||||
m_value = v;
|
||||
}
|
||||
|
||||
private:
|
||||
::Account* m_account;
|
||||
const TmpTransaction* m_parent;
|
||||
Glib::ustring m_memo;
|
||||
Glib::ustring m_action;
|
||||
char m_reconcile;
|
||||
Numeric m_amount;
|
||||
Numeric m_value;
|
||||
};
|
||||
|
||||
} // END namespace gnc
|
||||
|
||||
namespace Glib
|
||||
{
|
||||
/** A Glib::wrap() method for this object.
|
||||
*
|
||||
* @param object The C instance.
|
||||
* @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
|
||||
* @result A C++ instance that wraps this C instance.
|
||||
*
|
||||
* @relates Gio::FileInfo
|
||||
*/
|
||||
Glib::RefPtr<gnc::Split> wrap(::Split* object, bool take_copy = false);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
226
src/optional/gtkmm/gncmm/Transaction.cpp
Normal file
226
src/optional/gtkmm/gncmm/Transaction.cpp
Normal file
@ -0,0 +1,226 @@
|
||||
/*
|
||||
* Transaction.cpp
|
||||
* Copyright (C) 2011 Christian Stimming
|
||||
*
|
||||
* 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, contact:
|
||||
*
|
||||
* Free Software Foundation Voice: +1-617-542-5942
|
||||
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
|
||||
* Boston, MA 02110-1301, USA gnu@gnu.org
|
||||
*/
|
||||
|
||||
#include "Transaction.hpp"
|
||||
#include "Split.hpp"
|
||||
#include <cassert>
|
||||
#if HAVE_GLIBMM_VECTORUTILS_H
|
||||
// new in glibmm-2.29
|
||||
#include <glibmm/vectorutils.h>
|
||||
#endif
|
||||
#include "private/Transaction_p.hpp"
|
||||
|
||||
namespace Glib
|
||||
{
|
||||
|
||||
Glib::RefPtr<gnc::Transaction> wrap(::Transaction* object, bool take_copy)
|
||||
{
|
||||
return Glib::RefPtr<gnc::Transaction>( dynamic_cast<gnc::Transaction*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
|
||||
//We use dynamic_cast<> in case of multiple inheritance.
|
||||
}
|
||||
|
||||
} /* namespace Glib */
|
||||
|
||||
namespace gnc
|
||||
{
|
||||
|
||||
/* The *_Class implementation: */
|
||||
|
||||
const Glib::Class& Transaction_Class::init()
|
||||
{
|
||||
if (!gtype_) // create the GType if necessary
|
||||
{
|
||||
// Glib::Class has to know the class init function to clone custom types.
|
||||
class_init_func_ = &Transaction_Class::class_init_function;
|
||||
|
||||
// This is actually just optimized away, apparently with no harm.
|
||||
// Make sure that the parent type has been created.
|
||||
//CppClassParent::CppObjectType::get_type();
|
||||
|
||||
// Create the wrapper type, with the same class/instance size as the base type.
|
||||
register_derived_type(gnc_transaction_get_type());
|
||||
|
||||
// Add derived versions of interfaces, if the C type implements any interfaces:
|
||||
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
void Transaction_Class::class_init_function(void* g_class, void* class_data)
|
||||
{
|
||||
BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
|
||||
CppClassParent::class_init_function(klass, class_data);
|
||||
}
|
||||
|
||||
|
||||
Glib::ObjectBase* Transaction_Class::wrap_new(GObject* object)
|
||||
{
|
||||
return new Transaction((::Transaction*)object);
|
||||
}
|
||||
|
||||
|
||||
/* The implementation: */
|
||||
|
||||
::Transaction* Transaction::gobj_copy()
|
||||
{
|
||||
reference();
|
||||
return gobj();
|
||||
}
|
||||
|
||||
Transaction::Transaction(const Glib::ConstructParams& construct_params)
|
||||
: Glib::Object(construct_params)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Transaction::Transaction(::Transaction* castitem)
|
||||
: Glib::Object((GObject*)(castitem))
|
||||
{}
|
||||
|
||||
|
||||
Transaction::~Transaction()
|
||||
{}
|
||||
|
||||
|
||||
Transaction::CppClassType Transaction::transaction_class_; // initialize static member
|
||||
|
||||
GType Transaction::get_type()
|
||||
{
|
||||
return transaction_class_.init().get_type();
|
||||
}
|
||||
|
||||
|
||||
GType Transaction::get_base_type()
|
||||
{
|
||||
return gnc_transaction_get_type();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Glib::RefPtr<Split> Transaction::findSplitByAccount(const Account& acc) const
|
||||
{
|
||||
return Glib::wrap(xaccTransFindSplitByAccount(gobj(), acc.gobj()));
|
||||
}
|
||||
Glib::RefPtr<Split> Transaction::getSplit(int i) const
|
||||
{
|
||||
return Glib::wrap(xaccTransGetSplit(gobj(), i));
|
||||
}
|
||||
void Transaction::appendSplit(Split& split)
|
||||
{
|
||||
xaccSplitSetParent(split.gobj(), gobj());
|
||||
}
|
||||
int Transaction::getSplitIndex(const Split& split) const
|
||||
{
|
||||
return xaccTransGetSplitIndex(gobj(), split.gobj());
|
||||
}
|
||||
::Transaction* Transaction::newInstance(const ::QofBook* b)
|
||||
{
|
||||
return xaccMallocTransaction (const_cast< ::QofBook*>(b));
|
||||
}
|
||||
|
||||
// ////////////////////////////////////////////////////////////
|
||||
|
||||
TmpTransaction::TmpTransaction()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
TmpTransaction::TmpTransaction(const Transaction& t)
|
||||
: m_num(t.getNum())
|
||||
, m_description(t.getDescription())
|
||||
, m_notes(t.getNotes())
|
||||
, m_commodity(t.getCurrency())
|
||||
, m_datePosted(t.getDatePosted())
|
||||
//, m_dateTimeEntered(t.getDateEntered())
|
||||
{
|
||||
SplitQList slist
|
||||
#if HAVE_GLIBMM_VECTORUTILS_H
|
||||
= Glib::ListHandlier<Glib::RefPtr<Split> >::list_to_vector(t.getSplitList());
|
||||
#else
|
||||
;
|
||||
#endif
|
||||
for (SplitQList::const_iterator iter = slist.begin(); iter != slist.end(); ++iter)
|
||||
{
|
||||
m_splits.push_back(TmpSplit(Glib::wrap(*iter), this));
|
||||
}
|
||||
}
|
||||
|
||||
void TmpTransaction::clear()
|
||||
{
|
||||
m_splits.clear();
|
||||
resetContent();
|
||||
}
|
||||
|
||||
void TmpTransaction::resetContent()
|
||||
{
|
||||
m_num.clear();
|
||||
m_description.clear();
|
||||
m_notes.clear();
|
||||
m_commodity.reset();
|
||||
m_datePosted = Glib::Date();
|
||||
//m_dateTimeEntered = QDateTime();
|
||||
for (int i = 0; i < m_splits.size(); ++i)
|
||||
{
|
||||
TmpSplit& split = m_splits[i];
|
||||
split.clear();
|
||||
split.setParent(this);
|
||||
}
|
||||
}
|
||||
|
||||
void TmpTransaction::copyTo(Glib::RefPtr<Transaction> t) const
|
||||
{
|
||||
assert(t);
|
||||
t->setNum(m_num);
|
||||
t->setDescription(m_description);
|
||||
if (!m_notes.empty())
|
||||
t->setNotes(m_notes);
|
||||
t->setCurrency(m_commodity);
|
||||
t->setDatePosted(m_datePosted);
|
||||
//t->setDateEntered(m_dateTimeEntered);
|
||||
for (int i = 0; i < m_splits.size(); ++i)
|
||||
{
|
||||
//m_splits[i].copyInto(t);
|
||||
}
|
||||
}
|
||||
|
||||
Glib::RefPtr<Transaction> TmpTransaction::createAsReal() const
|
||||
{
|
||||
assert (!m_splits.empty());
|
||||
Glib::RefPtr<Account> acc(Glib::wrap(m_splits.front().getAccount()));
|
||||
assert (acc);
|
||||
Glib::RefPtr<Book> book(acc->getBook());
|
||||
assert (book);
|
||||
Glib::RefPtr<Transaction> trans(Glib::wrap(Transaction::newInstance(book->gobj())));
|
||||
trans->beginEdit();
|
||||
copyTo(trans);
|
||||
trans->commitEdit();
|
||||
return trans;
|
||||
}
|
||||
|
||||
void TmpTransaction::push_back(const TmpSplit& s)
|
||||
{
|
||||
m_splits.push_back(s);
|
||||
m_splits.back().setParent(this);
|
||||
}
|
||||
|
||||
} // END namespace gnc
|
318
src/optional/gtkmm/gncmm/Transaction.hpp
Normal file
318
src/optional/gtkmm/gncmm/Transaction.hpp
Normal file
@ -0,0 +1,318 @@
|
||||
/*
|
||||
* Transaction.hpp
|
||||
* Copyright (C) 2011 Christian Stimming
|
||||
*
|
||||
* 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, contact:
|
||||
*
|
||||
* Free Software Foundation Voice: +1-617-542-5942
|
||||
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
|
||||
* Boston, MA 02110-1301, USA gnu@gnu.org
|
||||
*/
|
||||
|
||||
#ifndef GNC_TRANSACTION_HPP
|
||||
#define GNC_TRANSACTION_HPP
|
||||
|
||||
// gnucash includes
|
||||
#include "config.h"
|
||||
extern "C"
|
||||
{
|
||||
#include "qof.h"
|
||||
#include "engine/Transaction.h"
|
||||
}
|
||||
|
||||
#include "Account.hpp"
|
||||
#include "Book.hpp"
|
||||
#include "Commodity.hpp"
|
||||
#include "Numeric.hpp"
|
||||
#include "GncInstance.hpp"
|
||||
#include "Split.hpp"
|
||||
|
||||
#include <glibmm/object.h>
|
||||
#include <glibmm/date.h>
|
||||
#include <glibmm/ustring.h>
|
||||
#include <vector>
|
||||
|
||||
namespace gnc
|
||||
{
|
||||
class Transaction_Class;
|
||||
} // END namespace gnc
|
||||
|
||||
namespace gnc
|
||||
{
|
||||
class Account;
|
||||
class Split;
|
||||
class TmpSplit;
|
||||
|
||||
/** Wrapper around a gnucash ::Transaction pointer with C++ methods for
|
||||
* easier setter and getter access.
|
||||
*/
|
||||
class Transaction : public Glib::Object, public GncInstance
|
||||
{
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
typedef Transaction CppObjectType;
|
||||
typedef Transaction_Class CppClassType;
|
||||
typedef ::Transaction BaseObjectType;
|
||||
typedef ::TransactionClass BaseClassType;
|
||||
|
||||
private:
|
||||
friend class Transaction_Class;
|
||||
static CppClassType transaction_class_;
|
||||
|
||||
private:
|
||||
// noncopyable
|
||||
Transaction(const Transaction&);
|
||||
Transaction& operator=(const Transaction&);
|
||||
|
||||
protected:
|
||||
explicit Transaction(const Glib::ConstructParams& construct_params);
|
||||
explicit Transaction(::Transaction* castitem);
|
||||
|
||||
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||
|
||||
public:
|
||||
virtual ~Transaction();
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
static GType get_type() G_GNUC_CONST;
|
||||
static GType get_base_type() G_GNUC_CONST;
|
||||
#endif
|
||||
|
||||
///Provides access to the underlying C GObject.
|
||||
::Transaction* gobj()
|
||||
{
|
||||
return reinterpret_cast< ::Transaction*>(gobject_);
|
||||
}
|
||||
|
||||
///Provides access to the underlying C GObject.
|
||||
const ::Transaction* gobj() const
|
||||
{
|
||||
return reinterpret_cast< ::Transaction*>(gobject_);
|
||||
}
|
||||
|
||||
///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
|
||||
::Transaction* gobj_copy();
|
||||
|
||||
private:
|
||||
public:
|
||||
|
||||
void beginEdit()
|
||||
{
|
||||
xaccTransBeginEdit(gobj());
|
||||
}
|
||||
void commitEdit()
|
||||
{
|
||||
xaccTransCommitEdit(gobj());
|
||||
}
|
||||
void rollbackEdit()
|
||||
{
|
||||
xaccTransRollbackEdit(gobj());
|
||||
}
|
||||
bool isOpen() const
|
||||
{
|
||||
return xaccTransIsOpen(gobj());
|
||||
}
|
||||
|
||||
|
||||
Glib::ustring getNum() const
|
||||
{
|
||||
return xaccTransGetNum(gobj());
|
||||
}
|
||||
void setNum(const Glib::ustring& v)
|
||||
{
|
||||
xaccTransSetNum(gobj(), v.c_str());
|
||||
}
|
||||
|
||||
Glib::ustring getDescription() const
|
||||
{
|
||||
return xaccTransGetDescription(gobj());
|
||||
}
|
||||
void setDescription(const Glib::ustring& v)
|
||||
{
|
||||
xaccTransSetDescription(gobj(), v.c_str());
|
||||
}
|
||||
|
||||
Glib::ustring getNotes() const
|
||||
{
|
||||
return xaccTransGetNotes(gobj());
|
||||
}
|
||||
void setNotes(const Glib::ustring& v)
|
||||
{
|
||||
xaccTransSetNotes(gobj(), v.c_str());
|
||||
}
|
||||
|
||||
int countSplits() const
|
||||
{
|
||||
return xaccTransCountSplits(gobj());
|
||||
}
|
||||
Glib::RefPtr<Split> findSplitByAccount(const Account& acc) const;
|
||||
void appendSplit(Split& split);
|
||||
Glib::RefPtr<Split> getSplit(int i) const;
|
||||
int getSplitIndex(const Split& split) const;
|
||||
::SplitList* getSplitList() const
|
||||
{
|
||||
return xaccTransGetSplitList(gobj());
|
||||
}
|
||||
|
||||
Glib::RefPtr<Commodity> getCurrency() const
|
||||
{
|
||||
return Glib::wrap(xaccTransGetCurrency(gobj()));
|
||||
}
|
||||
void setCurrency(const Glib::RefPtr<Commodity>& c)
|
||||
{
|
||||
if (c) xaccTransSetCurrency(gobj(), c->gobj());
|
||||
}
|
||||
|
||||
Numeric getImbalanceValue() const
|
||||
{
|
||||
return xaccTransGetImbalanceValue(gobj());
|
||||
}
|
||||
bool isBalanced() const
|
||||
{
|
||||
return xaccTransIsBalanced(gobj());
|
||||
}
|
||||
Numeric getAccountConvRate(const Account& acc) const
|
||||
{
|
||||
return xaccTransGetAccountConvRate(gobj(), acc.gobj());
|
||||
}
|
||||
|
||||
void setDatePosted(const Glib::Date& d)
|
||||
{
|
||||
xaccTransSetDatePostedGDate(gobj(), *d.gobj());
|
||||
}
|
||||
// void setDateEntered(const Glib::DateTime& t) { xaccTransSetDateEnteredSecs(gobj(), t.toTime_t()); }
|
||||
Glib::Date getDatePosted() const
|
||||
{
|
||||
return Glib::Date(xaccTransGetDatePostedGDate(gobj()));
|
||||
}
|
||||
//Glib::DateTime getDateEntered() const { return toGDateTime(xaccTransRetDateEnteredTS(gobj())); }
|
||||
|
||||
static ::Transaction* newInstance(const ::QofBook* b);
|
||||
};
|
||||
|
||||
|
||||
/** This is a temporary transaction. Each of this tmp transactions has
|
||||
* all data fields just like a "real" transaction, but it is not (yet)
|
||||
* added to the respective Account and Book. In other words, it is not
|
||||
* stored in the book yet.
|
||||
*
|
||||
* For this reason this class supports a full copy-by-value, which
|
||||
* will create new independent instances of all data fields. */
|
||||
class TmpTransaction
|
||||
{
|
||||
public:
|
||||
typedef std::vector<TmpSplit> TmpSplitList;
|
||||
|
||||
/** Creates an empty tmp transaction */
|
||||
TmpTransaction();
|
||||
|
||||
/** Creates a tmp transaction whose content is copied from the
|
||||
* given real transaction */
|
||||
TmpTransaction(const Transaction& t);
|
||||
|
||||
/** Clears all data fields of this transaction, including deletion
|
||||
* of all splits stored here. */
|
||||
void clear();
|
||||
|
||||
/** Clears all data fields, but does not delete the splits and
|
||||
* instead only resets the data fields of all splits */
|
||||
void resetContent();
|
||||
|
||||
/** Copies the content of this tmp transaction into the given real
|
||||
* transaction. */
|
||||
void copyTo(Glib::RefPtr<Transaction> t) const;
|
||||
|
||||
/** Allocates a new real transaction in the Book and Account as
|
||||
* stored in the tmp transaction, copies the content of this tmp
|
||||
* transaction into the newly allocated one, and returns the
|
||||
* pointer to the newly created real transaction. */
|
||||
Glib::RefPtr<Transaction> createAsReal() const;
|
||||
|
||||
Glib::ustring getNum() const
|
||||
{
|
||||
return m_num;
|
||||
}
|
||||
void setNum(const Glib::ustring& v)
|
||||
{
|
||||
m_num = v;
|
||||
}
|
||||
|
||||
Glib::ustring getDescription() const
|
||||
{
|
||||
return m_description;
|
||||
}
|
||||
void setDescription(const Glib::ustring& v)
|
||||
{
|
||||
m_description = v;
|
||||
}
|
||||
|
||||
void push_back(const TmpSplit& s);
|
||||
const TmpSplitList& getSplits() const
|
||||
{
|
||||
return m_splits;
|
||||
}
|
||||
TmpSplitList& getSplits()
|
||||
{
|
||||
return m_splits;
|
||||
}
|
||||
int countSplits() const
|
||||
{
|
||||
return m_splits.size();
|
||||
}
|
||||
|
||||
Glib::RefPtr<Commodity> getCommodity() const
|
||||
{
|
||||
return m_commodity;
|
||||
}
|
||||
void setCommodity(const Glib::RefPtr<Commodity>& v)
|
||||
{
|
||||
m_commodity = v;
|
||||
}
|
||||
|
||||
Glib::Date getDatePosted() const
|
||||
{
|
||||
return m_datePosted;
|
||||
}
|
||||
void setDatePosted(const Glib::Date& v)
|
||||
{
|
||||
m_datePosted = v;
|
||||
}
|
||||
|
||||
//Glib::DateTime getDateEntered() const { return m_dateTimeEntered; }
|
||||
//void setDateEntered(const Glib::DateTime& v) { m_dateTimeEntered = v; }
|
||||
|
||||
private:
|
||||
Glib::ustring m_num;
|
||||
Glib::ustring m_description;
|
||||
Glib::ustring m_notes;
|
||||
TmpSplitList m_splits;
|
||||
Glib::RefPtr<Commodity> m_commodity;
|
||||
Glib::Date m_datePosted;
|
||||
//Glib::DateTime m_dateTimeEntered;
|
||||
};
|
||||
|
||||
} // END namespace gnc
|
||||
|
||||
namespace Glib
|
||||
{
|
||||
/** A Glib::wrap() method for this object.
|
||||
*
|
||||
* @param object The C instance.
|
||||
* @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
|
||||
* @result A C++ instance that wraps this C instance.
|
||||
*
|
||||
* @relates Gio::FileInfo
|
||||
*/
|
||||
Glib::RefPtr<gnc::Transaction> wrap(::Transaction* object, bool take_copy = false);
|
||||
}
|
||||
|
||||
#endif
|
48
src/optional/gtkmm/gncmm/private/Split_p.hpp
Normal file
48
src/optional/gtkmm/gncmm/private/Split_p.hpp
Normal file
@ -0,0 +1,48 @@
|
||||
// -*- c++ -*-
|
||||
// Generated by gtkmmproc -- DO NOT MODIFY!
|
||||
#ifndef _GNCMM_PRIVATE_SPLIT_P_HPP
|
||||
#define _GNCMM_PRIVATE_SPLIT_P_HPP
|
||||
|
||||
|
||||
#include <glibmm/private/object_p.h>
|
||||
|
||||
#include <glibmm/class.h>
|
||||
|
||||
namespace gnc
|
||||
{
|
||||
|
||||
class Split_Class : public Glib::Class
|
||||
{
|
||||
public:
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
typedef Split CppObjectType;
|
||||
typedef ::Split BaseObjectType;
|
||||
typedef ::SplitClass BaseClassType;
|
||||
typedef Glib::Object_Class CppClassParent;
|
||||
typedef GObjectClass BaseClassParent;
|
||||
|
||||
friend class Split;
|
||||
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||
|
||||
const Glib::Class& init();
|
||||
|
||||
|
||||
static void class_init_function(void* g_class, void* class_data);
|
||||
|
||||
static Glib::ObjectBase* wrap_new(GObject*);
|
||||
|
||||
protected:
|
||||
|
||||
//Callbacks (default signal handlers):
|
||||
//These will call the *_impl member methods, which will then call the existing default signal callbacks, if any.
|
||||
//You could prevent the original default signal handlers being called by overriding the *_impl method.
|
||||
|
||||
//Callbacks (virtual functions):
|
||||
};
|
||||
|
||||
|
||||
} // namespace gnc
|
||||
|
||||
|
||||
#endif /* _GNCMM_PRIVATE_SPLIT_P_HPP */
|
||||
|
48
src/optional/gtkmm/gncmm/private/Transaction_p.hpp
Normal file
48
src/optional/gtkmm/gncmm/private/Transaction_p.hpp
Normal file
@ -0,0 +1,48 @@
|
||||
// -*- c++ -*-
|
||||
// Generated by gtkmmproc -- DO NOT MODIFY!
|
||||
#ifndef _GNCMM_PRIVATE_TRANSACTION_P_HPP
|
||||
#define _GNCMM_PRIVATE_TRANSACTION_P_HPP
|
||||
|
||||
|
||||
#include <glibmm/private/object_p.h>
|
||||
|
||||
#include <glibmm/class.h>
|
||||
|
||||
namespace gnc
|
||||
{
|
||||
|
||||
class Transaction_Class : public Glib::Class
|
||||
{
|
||||
public:
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
typedef Transaction CppObjectType;
|
||||
typedef ::Transaction BaseObjectType;
|
||||
typedef ::TransactionClass BaseClassType;
|
||||
typedef Glib::Object_Class CppClassParent;
|
||||
typedef GObjectClass BaseClassParent;
|
||||
|
||||
friend class Transaction;
|
||||
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||
|
||||
const Glib::Class& init();
|
||||
|
||||
|
||||
static void class_init_function(void* g_class, void* class_data);
|
||||
|
||||
static Glib::ObjectBase* wrap_new(GObject*);
|
||||
|
||||
protected:
|
||||
|
||||
//Callbacks (default signal handlers):
|
||||
//These will call the *_impl member methods, which will then call the existing default signal callbacks, if any.
|
||||
//You could prevent the original default signal handlers being called by overriding the *_impl method.
|
||||
|
||||
//Callbacks (virtual functions):
|
||||
};
|
||||
|
||||
|
||||
} // namespace gnc
|
||||
|
||||
|
||||
#endif /* _GNCMM_PRIVATE_TRANSACTION_P_HPP */
|
||||
|
@ -16,6 +16,8 @@
|
||||
#include "Account.hpp"
|
||||
#include "Book.hpp"
|
||||
#include "Commodity.hpp"
|
||||
#include "Split.hpp"
|
||||
#include "Transaction.hpp"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
@ -25,6 +27,8 @@ extern "C"
|
||||
GType gnc_account_get_type(void);
|
||||
GType qof_book_get_type(void);
|
||||
GType gnc_commodity_get_type(void);
|
||||
GType gnc_split_get_type(void);
|
||||
GType gnc_transaction_get_type(void);
|
||||
} // extern "C"
|
||||
|
||||
//Declarations of the *_Class::wrap_new() methods, instead of including all the private headers:
|
||||
@ -32,6 +36,8 @@ extern "C"
|
||||
namespace gnc { class Account_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; }
|
||||
namespace gnc { class Book_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; }
|
||||
namespace gnc { class Commodity_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; }
|
||||
namespace gnc { class Split_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; }
|
||||
namespace gnc { class Transaction_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; }
|
||||
|
||||
namespace gnc
|
||||
{
|
||||
@ -41,11 +47,15 @@ void wrap_init()
|
||||
Glib::wrap_register(gnc_account_get_type(), &gnc::Account_Class::wrap_new);
|
||||
Glib::wrap_register(qof_book_get_type(), &gnc::Book_Class::wrap_new);
|
||||
Glib::wrap_register(gnc_commodity_get_type(), &gnc::Commodity_Class::wrap_new);
|
||||
Glib::wrap_register(gnc_split_get_type(), &gnc::Split_Class::wrap_new);
|
||||
Glib::wrap_register(gnc_transaction_get_type(), &gnc::Transaction_Class::wrap_new);
|
||||
|
||||
// Register our gtkmm gtypes:
|
||||
gnc::Account::get_type();
|
||||
gnc::Book::get_type();
|
||||
gnc::Commodity::get_type();
|
||||
gnc::Split::get_type();
|
||||
gnc::Transaction::get_type();
|
||||
} // wrap_init()
|
||||
} // END namespace gnc
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user