/*
 * File         : loader.cpp
 * Author       : Timothy Wiley
 * Version      :
 * Created      : 09/02/2010
 * Description  : Loads all entities from the library
 * Copyright    :
 */

#include "victim_id/class.hpp"

#include <crosbot_ui/panels/panelfactory.hpp>

#include "victim_id/gui/victimpanel.hpp"

#define PANEL_VICTIM        "victimview"
#define LOG_START           "VictimIdGuiLibrary ::"

using namespace crosbot;
using namespace crosbot::gui;
using std::string;

namespace casualty {
namespace gui {

/**
 * Generate panels for this library
 */
Panel* VictimIdPanelFactory(ConfigElementPtr config) {
    // Setup
    Panel *panel = NULL;
    string name = config->name;
    //LOG("%sRunning VictimIdPanelFactory: %s\n", LOG_START, name.c_str());

    if (name == PANEL_VICTIM) {
        panel = new VictimIdViewPanel(config);
    }

    return panel;
}

class VictimIdLibraryProxy {
public:
    VictimIdLibraryProxy() {
        PanelFactory::addFactory(VictimIdPanelFactory);
        LOG("%s Loaded\n", LOG_START);
    }
};

// Global variable for loading this library
VictimIdLibraryProxy victimIdLoadProxy;
} // namespace gui
} // namespace casualty
