/** Copyright 2003 Cyril Picard This file is part of the GEDCOMViewer tool (developed within the Genealogy Free Software Tools project). The GEDCOMViewer tool 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. The GEDCOMViewer tool 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 the GEDCOMViewer tool ; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA **/ #ifndef _BAKERYGATEWAY_VIEWFAMILYLINK_HH_ #define _BAKERYGATEWAY_VIEWFAMILYLINK_HH_ #include "config.h" #include "BakeryExtras/View_Linked.hh" #include "BakeryExtras/View_Navigator.hh" #include "BakeryExtras/View_RunTimeSubscriber.hh" #include "BakeryGateway/Document.hh" #include "OneFamilyLinkHandler.hh" #include "widgets/WidgetNote.hh" #include #include namespace BakeryGateway { template < class T_FamilyLink > class ViewFamilyLink : public BakeryExtras::View_Linked < BakeryGateway::Document, GEDCOMParser::IndividualRecord >, public BakeryExtras::View_Navigator < BakeryGateway::Document, std::string >, public BakeryExtras::View_RunTimeSubscriber < BakeryGateway::Document, T_FamilyLink, WidgetNote >, public SigC::Object { public: ViewFamilyLink(void) : _during_load(false) {}; protected: OneFamilyLinkHandler::ReturnHandler_t ButtonPressed(GdkEventButton * event, std::string const * key) { bool new_win = false; if (event->state & GDK_CONTROL_MASK) { new_win = true; } Navigate(*key, new_win); return false; }; std::string get_name_individual(GEDCOMParser::IndividualRecords_t const &individuals, std::string const &individual_id) const { std::string * individual_name = new std::string(); GEDCOMParser::IndividualRecords_t::const_iterator iter = individuals.find(individual_id); if (iter != individuals.end()) { if ((*iter).second->getPersonalNames().size() > 0) { if (!((*iter).second->getPersonalNames()[0]).Null()) { delete individual_name; individual_name = new std::string ((*iter).second->getPersonalNames()[0]->getName()); } } } return *individual_name; }; bool _during_load; virtual void family_added(void) = 0; virtual void family_deleted(int family_index) = 0; }; }; #endif