Reformatted code to comply with project format guidlines, and added some documentation
This commit is contained in:
parent
6f5c701c57
commit
bd0e634a27
6 changed files with 290 additions and 228 deletions
|
|
@ -1,18 +1,32 @@
|
|||
/*
|
||||
* 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 Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
|
||||
gtk-lumiera.hpp - Application wide global definitions
|
||||
|
||||
Copyright (C) Lumiera.org
|
||||
2008, Joel Holdsworth <joel@airwebreathe.org.uk>
|
||||
|
||||
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, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
*/
|
||||
/** @file gtk-lumiera.hpp
|
||||
** This file contains application wide global definitions
|
||||
** user actions.
|
||||
** @see main.cpp
|
||||
*/
|
||||
|
||||
#ifndef GTK_LUMIERA_HPP
|
||||
#define GTK_LUMIERA_HPO
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
# include <libintl.h>
|
||||
|
|
@ -26,4 +40,11 @@
|
|||
# define bindtextdomain(Package, Directory)
|
||||
#endif
|
||||
|
||||
const gchar* AppTitle = N_("Lumiera");
|
||||
/**
|
||||
* The name of the Lumiera application
|
||||
*/
|
||||
static const gchar* AppTitle = N_("Lumiera");
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,26 +1,24 @@
|
|||
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
|
||||
/*
|
||||
* main.cpp
|
||||
* Copyright (C) Joel Holdsworth 2008 <joel@airwebreathe.org.uk>
|
||||
*
|
||||
* main.cc is free software.
|
||||
*
|
||||
* You may 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.
|
||||
*
|
||||
* main.cc 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 main.cc. If not, write to:
|
||||
* The Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
Main.cpp - The entry point for the GTK GUI application
|
||||
|
||||
Copyright (C) Lumiera.org
|
||||
2008, Joel Holdsworth <joel@airwebreathe.org.uk>
|
||||
|
||||
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, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
* *****************************************************/
|
||||
|
||||
#include <gtkmm.h>
|
||||
#include <iostream>
|
||||
|
|
@ -29,20 +27,27 @@
|
|||
# include <libintl.h>
|
||||
#endif
|
||||
|
||||
#include "gtk-lumiera.hpp"
|
||||
#include "workspace/mainwindow.hpp"
|
||||
|
||||
using namespace Lumiera::Workspace;
|
||||
|
||||
//const gchar* AppTitle
|
||||
//const gchar AppTitle[] = N_("Lumiera");
|
||||
|
||||
using namespace lumiera::workspace;
|
||||
using namespace Gtk;
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
Main kit(argc, argv);
|
||||
|
||||
Glib::set_application_name("UIManager example");
|
||||
Glib::set_application_name(AppTitle);
|
||||
|
||||
MainWindow main_window;
|
||||
|
||||
kit.run(main_window);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,101 +1,105 @@
|
|||
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
|
||||
/*
|
||||
* gui
|
||||
* Copyright (C) 2008 <>
|
||||
*
|
||||
* gui is free software.
|
||||
*
|
||||
* You may 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.
|
||||
*
|
||||
* gui 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 gui. If not, write to:
|
||||
* The Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
Actions.cpp - Definition of the main workspace window object
|
||||
|
||||
Copyright (C) Lumiera.org
|
||||
2008, Joel Holdsworth <joel@airwebreathe.org.uk>
|
||||
|
||||
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, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
* *****************************************************/
|
||||
|
||||
#include "actions.hpp"
|
||||
#include "mainwindow.hpp"
|
||||
|
||||
namespace Lumiera {
|
||||
namespace Workspace {
|
||||
namespace lumiera
|
||||
{
|
||||
namespace workspace
|
||||
{
|
||||
|
||||
Actions::Actions(MainWindow &main_window) :
|
||||
_main_window(main_window)
|
||||
{
|
||||
_action_group = Gtk::ActionGroup::create();
|
||||
Actions::Actions(MainWindow &main_window) :
|
||||
mainWindow(main_window)
|
||||
{
|
||||
actionGroup = Gtk::ActionGroup::create();
|
||||
|
||||
// File|New sub menu:
|
||||
_action_group->add(Gtk::Action::create("FileNewStandard",
|
||||
actionGroup->add(Gtk::Action::create("FileNewStandard",
|
||||
Gtk::Stock::NEW, "_New", "Create a new file"),
|
||||
sigc::mem_fun(*this, &Actions::on_menu_file_new_generic));
|
||||
|
||||
_action_group->add(Gtk::Action::create("FileNewFoo",
|
||||
actionGroup->add(Gtk::Action::create("FileNewFoo",
|
||||
Gtk::Stock::NEW, "New Foo", "Create a new foo"),
|
||||
sigc::mem_fun(*this, &Actions::on_menu_file_new_generic));
|
||||
|
||||
_action_group->add(Gtk::Action::create("FileNewGoo",
|
||||
actionGroup->add(Gtk::Action::create("FileNewGoo",
|
||||
Gtk::Stock::NEW, "_New Goo", "Create a new goo"),
|
||||
sigc::mem_fun(*this, &Actions::on_menu_file_new_generic));
|
||||
|
||||
// File menu:
|
||||
_action_group->add(Gtk::Action::create("FileMenu", "File"));
|
||||
actionGroup->add(Gtk::Action::create("FileMenu", "File"));
|
||||
// Sub-menu.
|
||||
_action_group->add(Gtk::Action::create("FileNew", Gtk::Stock::NEW));
|
||||
_action_group->add(Gtk::Action::create("FileQuit", Gtk::Stock::QUIT),
|
||||
actionGroup->add(Gtk::Action::create("FileNew", Gtk::Stock::NEW));
|
||||
actionGroup->add(Gtk::Action::create("FileQuit", Gtk::Stock::QUIT),
|
||||
sigc::mem_fun(*this, &Actions::on_menu_file_quit));
|
||||
|
||||
// Edit menu:
|
||||
_action_group->add(Gtk::Action::create("EditMenu", "Edit"));
|
||||
_action_group->add(Gtk::Action::create("EditCopy", Gtk::Stock::COPY),
|
||||
actionGroup->add(Gtk::Action::create("EditMenu", "Edit"));
|
||||
actionGroup->add(Gtk::Action::create("EditCopy", Gtk::Stock::COPY),
|
||||
sigc::mem_fun(*this, &Actions::on_menu_others));
|
||||
_action_group->add(Gtk::Action::create("EditPaste", Gtk::Stock::PASTE),
|
||||
actionGroup->add(Gtk::Action::create("EditPaste", Gtk::Stock::PASTE),
|
||||
sigc::mem_fun(*this, &Actions::on_menu_others));
|
||||
_action_group->add(Gtk::Action::create("EditSomething", "Something"),
|
||||
actionGroup->add(Gtk::Action::create("EditSomething", "Something"),
|
||||
Gtk::AccelKey("<control><alt>S"),
|
||||
sigc::mem_fun(*this, &Actions::on_menu_others));
|
||||
|
||||
// Choices menu, to demonstrate Radio items
|
||||
_action_group->add( Gtk::Action::create("ChoicesMenu", "Choices") );
|
||||
actionGroup->add( Gtk::Action::create("ChoicesMenu", "Choices") );
|
||||
Gtk::RadioAction::Group group_userlevel;
|
||||
m_refChoiceOne = Gtk::RadioAction::create(group_userlevel, "ChoiceOne", "One");
|
||||
_action_group->add(m_refChoiceOne,
|
||||
actionGroup->add(m_refChoiceOne,
|
||||
sigc::mem_fun(*this, &Actions::on_menu_choices_one) );
|
||||
m_refChoiceTwo = Gtk::RadioAction::create(group_userlevel, "ChoiceTwo", "Two");
|
||||
_action_group->add(m_refChoiceTwo,
|
||||
actionGroup->add(m_refChoiceTwo,
|
||||
sigc::mem_fun(*this, &Actions::on_menu_choices_two) );
|
||||
|
||||
// Help menu:
|
||||
_action_group->add( Gtk::Action::create("HelpMenu", "Help") );
|
||||
_action_group->add( Gtk::Action::create("HelpAbout", Gtk::Stock::HELP),
|
||||
actionGroup->add( Gtk::Action::create("HelpMenu", "Help") );
|
||||
actionGroup->add( Gtk::Action::create("HelpAbout", Gtk::Stock::HELP),
|
||||
sigc::mem_fun(*this, &Actions::on_menu_others) );
|
||||
}
|
||||
}
|
||||
|
||||
void Actions::on_menu_file_quit()
|
||||
{
|
||||
_main_window.hide(); // Closes the main window to stop the Gtk::Main::run().
|
||||
}
|
||||
void
|
||||
Actions::on_menu_file_quit()
|
||||
{
|
||||
mainWindow.hide(); // Closes the main window to stop the Gtk::Main::run().
|
||||
}
|
||||
|
||||
void Actions::on_menu_file_new_generic()
|
||||
{
|
||||
void
|
||||
Actions::on_menu_file_new_generic()
|
||||
{
|
||||
g_message("A File|New menu item was selecteda.");
|
||||
}
|
||||
}
|
||||
|
||||
void Actions::on_menu_others()
|
||||
{
|
||||
void
|
||||
Actions::on_menu_others()
|
||||
{
|
||||
g_message("A menu item was selected.");
|
||||
}
|
||||
}
|
||||
|
||||
void Actions::on_menu_choices_one()
|
||||
{
|
||||
void
|
||||
Actions::on_menu_choices_one()
|
||||
{
|
||||
Glib::ustring message;
|
||||
//if(m_refChoiceOne->get_active())
|
||||
// message = "Choice 1 was selected.";
|
||||
|
|
@ -103,10 +107,11 @@ void Actions::on_menu_choices_one()
|
|||
message = "Choice 1 was deselected";
|
||||
|
||||
g_message(message.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void Actions::on_menu_choices_two()
|
||||
{
|
||||
void
|
||||
Actions::on_menu_choices_two()
|
||||
{
|
||||
Glib::ustring message;
|
||||
//if(_main_window.m_refChoiceTwo->get_active())
|
||||
// message = "Choice 2 was selected.";
|
||||
|
|
@ -114,8 +119,8 @@ void Actions::on_menu_choices_two()
|
|||
message = "Choice 2 was deselected";
|
||||
|
||||
g_message(message.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Workspace
|
||||
} // namespace Lumiera
|
||||
} // namespace workspace
|
||||
} // namespace lumiera
|
||||
|
||||
|
|
|
|||
|
|
@ -1,61 +1,71 @@
|
|||
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
|
||||
/*
|
||||
* gui
|
||||
* Copyright (C) 2008 <>
|
||||
*
|
||||
* gui is free software.
|
||||
*
|
||||
* You may 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.
|
||||
*
|
||||
* gui 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 gui. If not, write to:
|
||||
* The Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301, USA.
|
||||
ACTIONS.hpp - Definition of a helper class for user actions
|
||||
|
||||
Copyright (C) Lumiera.org
|
||||
2008, Joel Holdsworth <joel@airwebreathe.org.uk>
|
||||
|
||||
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, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
*/
|
||||
/** @file actions.hpp
|
||||
** This file contains the definition of a helper class for the
|
||||
** main workspace window object, which registers and handles
|
||||
** user actions.
|
||||
** @see mainwindow.hpp
|
||||
*/
|
||||
|
||||
#ifndef ACTIONS_H
|
||||
#define ACTIONS_H
|
||||
#ifndef ACTIONS_HPP
|
||||
#define ACTIONS_HPP
|
||||
|
||||
#include <gtkmm.h>
|
||||
|
||||
namespace Lumiera {
|
||||
namespace Workspace {
|
||||
namespace lumiera {
|
||||
namespace workspace {
|
||||
|
||||
class MainWindow;
|
||||
|
||||
class Actions
|
||||
{
|
||||
private:
|
||||
Actions(MainWindow &main_window);
|
||||
/**
|
||||
* A helper class which registers and handles
|
||||
* user action events.
|
||||
*/
|
||||
class Actions
|
||||
{
|
||||
private:
|
||||
Actions(MainWindow &main_window);
|
||||
|
||||
//----- Event Handlers -----//
|
||||
void on_menu_file_new_generic();
|
||||
void on_menu_file_quit();
|
||||
void on_menu_others();
|
||||
/**
|
||||
* A reference to the MainWindow which owns
|
||||
* this helper */
|
||||
MainWindow &mainWindow;
|
||||
|
||||
void on_menu_choices_one();
|
||||
void on_menu_choices_two();
|
||||
/* ===== Event Handlers ===== */
|
||||
void on_menu_file_new_generic();
|
||||
void on_menu_file_quit();
|
||||
void on_menu_others();
|
||||
|
||||
//----- Actions -----//
|
||||
Glib::RefPtr<Gtk::ActionGroup> _action_group;
|
||||
Glib::RefPtr<Gtk::RadioAction> m_refChoiceOne, m_refChoiceTwo;
|
||||
void on_menu_choices_one();
|
||||
void on_menu_choices_two();
|
||||
|
||||
// Reference to the main window
|
||||
MainWindow &_main_window;
|
||||
/* ===== Actions ===== */
|
||||
Glib::RefPtr<Gtk::ActionGroup> actionGroup;
|
||||
Glib::RefPtr<Gtk::RadioAction> m_refChoiceOne, m_refChoiceTwo;
|
||||
|
||||
friend class MainWindow;
|
||||
};
|
||||
friend class MainWindow;
|
||||
};
|
||||
|
||||
} // namespace Workspace
|
||||
} // namespace Lumiera
|
||||
} // namespace workspace
|
||||
} // namespace lumiera
|
||||
|
||||
#endif // ACTIONS_H
|
||||
|
|
|
|||
|
|
@ -1,21 +1,24 @@
|
|||
// main-window.cpp
|
||||
// Tue Apr 8 23:54:36 2008
|
||||
// Copyright 2008 joel
|
||||
// <joel@airwebreathe.org.uk>
|
||||
|
||||
// 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 3 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 Library General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
|
||||
/*
|
||||
MainWindow.cpp - Definition of the main workspace window object
|
||||
|
||||
Copyright (C) Lumiera.org
|
||||
2008, Joel Holdsworth <joel@airwebreathe.org.uk>
|
||||
|
||||
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, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
* *****************************************************/
|
||||
|
||||
#include <gtkmm/stock.h>
|
||||
|
||||
|
|
@ -26,32 +29,33 @@
|
|||
#include "gtk-lumiera.hpp"
|
||||
#include "mainwindow.hpp"
|
||||
|
||||
namespace Lumiera {
|
||||
namespace Workspace {
|
||||
namespace lumiera {
|
||||
namespace workspace {
|
||||
|
||||
MainWindow::MainWindow()
|
||||
: _actions(*this)
|
||||
{
|
||||
MainWindow::MainWindow()
|
||||
: actions(*this)
|
||||
{
|
||||
create_ui();
|
||||
}
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
}
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
}
|
||||
|
||||
void MainWindow::create_ui()
|
||||
{
|
||||
void
|
||||
MainWindow::create_ui()
|
||||
{
|
||||
//----- Configure the Window -----//
|
||||
set_title(AppTitle);
|
||||
set_default_size(1024, 768);
|
||||
|
||||
// The UI will be nested within a VBOX
|
||||
add(_box);
|
||||
add(box);
|
||||
|
||||
m_refUIManager = Gtk::UIManager::create();
|
||||
m_refUIManager->insert_action_group(_actions._action_group);
|
||||
uiManager = Gtk::UIManager::create();
|
||||
uiManager->insert_action_group(actions.actionGroup);
|
||||
|
||||
add_accel_group(m_refUIManager->get_accel_group());
|
||||
add_accel_group(uiManager->get_accel_group());
|
||||
|
||||
//Layout the actions in a menubar and toolbar:
|
||||
Glib::ustring ui_info =
|
||||
|
|
@ -87,35 +91,33 @@ void MainWindow::create_ui()
|
|||
#ifdef GLIBMM_EXCEPTIONS_ENABLED
|
||||
try
|
||||
{
|
||||
m_refUIManager->add_ui_from_string(ui_info);
|
||||
uiManager->add_ui_from_string(ui_info);
|
||||
}
|
||||
catch(const Glib::Error& ex)
|
||||
{
|
||||
g_error("building menus failed: ");
|
||||
return;
|
||||
g_error("building menus failed: ");
|
||||
return;
|
||||
}
|
||||
#else
|
||||
std::auto_ptr<Glib::Error> ex;
|
||||
m_refUIManager->add_ui_from_string(ui_info, ex);
|
||||
uiManager->add_ui_from_string(ui_info, ex);
|
||||
if(ex.get())
|
||||
{
|
||||
g_error("building menus failed: ");
|
||||
return;
|
||||
g_error("building menus failed: ");
|
||||
return;
|
||||
}
|
||||
#endif //GLIBMM_EXCEPTIONS_ENABLED
|
||||
|
||||
// Get the menubar and toolbar widgets, and add them to a container widget:
|
||||
Gtk::Widget* pMenubar = m_refUIManager->get_widget("/MenuBar");
|
||||
if(pMenubar)
|
||||
_box.pack_start(*pMenubar, Gtk::PACK_SHRINK);
|
||||
Gtk::Widget* menu_bar = uiManager->get_widget("/MenuBar");
|
||||
if(menu_bar) box.pack_start(*menu_bar, Gtk::PACK_SHRINK);
|
||||
|
||||
Gtk::Widget* pToolbar = m_refUIManager->get_widget("/ToolBar") ;
|
||||
if(pToolbar)
|
||||
_box.pack_start(*pToolbar, Gtk::PACK_SHRINK);
|
||||
Gtk::Widget* toolbar = uiManager->get_widget("/ToolBar") ;
|
||||
if(toolbar) box.pack_start(*toolbar, Gtk::PACK_SHRINK);
|
||||
|
||||
show_all_children();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Workspace
|
||||
} // namespace Lumiera
|
||||
} // namespace workspace
|
||||
} // namespace lumiera
|
||||
|
||||
|
|
|
|||
|
|
@ -1,17 +1,29 @@
|
|||
/*
|
||||
* 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 3 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 Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
|
||||
MainWindow.hpp - Definition of the main workspace window object
|
||||
|
||||
Copyright (C) Lumiera.org
|
||||
2008, Joel Holdsworth <joel@airwebreathe.org.uk>
|
||||
|
||||
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, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
*/
|
||||
/** @file mainwindow.hpp
|
||||
** This file contains the definition of the main workspace window
|
||||
** parent, which is the toplevel parent of the whole workspace.
|
||||
**
|
||||
** @see mainwindow.hpp
|
||||
*/
|
||||
|
||||
#ifndef MAIN_WINDOW_H
|
||||
|
|
@ -20,28 +32,35 @@
|
|||
#include <gtkmm.h>
|
||||
#include "actions.hpp"
|
||||
|
||||
namespace Lumiera {
|
||||
namespace Workspace {
|
||||
namespace lumiera {
|
||||
namespace workspace {
|
||||
|
||||
/**
|
||||
* The main lumiera workspace window
|
||||
*/
|
||||
class MainWindow : public Gtk::Window
|
||||
{
|
||||
public:
|
||||
MainWindow();
|
||||
virtual ~MainWindow();
|
||||
|
||||
class MainWindow : public Gtk::Window
|
||||
{
|
||||
public:
|
||||
MainWindow();
|
||||
virtual ~MainWindow();
|
||||
|
||||
protected:
|
||||
void create_ui();
|
||||
|
||||
// Helpers
|
||||
Actions _actions;
|
||||
protected:
|
||||
void create_ui();
|
||||
|
||||
// Child widgets
|
||||
Gtk::VBox _box;
|
||||
/* ===== UI ===== */
|
||||
protected:
|
||||
Gtk::VBox box;
|
||||
Glib::RefPtr<Gtk::UIManager> uiManager;
|
||||
|
||||
/* ===== Helpers ===== */
|
||||
protected:
|
||||
/**
|
||||
* The instantiation of the actions helper class, which
|
||||
* registers and handles user action events */
|
||||
Actions actions;
|
||||
};
|
||||
|
||||
Glib::RefPtr<Gtk::UIManager> m_refUIManager;
|
||||
};
|
||||
|
||||
} // namespace Workspace
|
||||
} // namespace Lumiera
|
||||
} // namespace workspace
|
||||
} // namespace lumiera
|
||||
|
||||
#endif // MAIN_WINDOW_H
|
||||
|
|
|
|||
Loading…
Reference in a new issue