Commit e7ae67c8 authored by Murray Cumming's avatar Murray Cumming
Browse files

Remove the unnused PlaceholderGlom class.

	* glom/mode_data/placeholder-glom.[h|cc]: Remove these files.
	* Makefile_glom.am: Remove mentions of these files.
	* glom/mode_data/flowtable_withfields.cc: Remove uses of PlaceholderGlom.
parent e2c7bce4
2011-10-24 Murray Cumming <murrayc@murrayc.com>
Remove the unnused PlaceholderGlom class.
* glom/mode_data/placeholder-glom.[h|cc]: Remove these files.
* Makefile_glom.am: Remove mentions of these files.
* glom/mode_data/flowtable_withfields.cc: Remove uses of PlaceholderGlom.
2011-10-24 Murray Cumming <murrayc@murrayc.com>
Do not include gtkmm.h, glibmm.h, giomm.h, or similar in headers.
......
......@@ -152,8 +152,6 @@ glom_source_files = \
glom/mode_data/flowtablewithfields.h \
glom/mode_data/notebook_data.cc \
glom/mode_data/notebook_data.h \
glom/mode_data/placeholder-glom.cc \
glom/mode_data/placeholder-glom.h \
glom/mode_data/datawidget/datawidget.cc \
glom/mode_data/datawidget/datawidget.h \
glom/mode_data/datawidget/cellcreation.cc \
......
......@@ -27,7 +27,6 @@
#include <glom/utility_widgets/imageglom.h>
#include <glom/mode_data/datawidget/label.h>
#include <glom/utility_widgets/dialog_flowtable.h>
#include <glom/mode_data/placeholder-glom.h>
#include <glom/application.h>
#include <gtkmm/checkbutton.h>
#include <libglom/data_structure/glomconversions.h>
......@@ -145,13 +144,6 @@ void FlowTableWithFields::add_layout_item(const sharedptr<LayoutItem>& item)
sharedptr<LayoutItem_Image> layout_imageobject = sharedptr<LayoutItem_Image>::cast_dynamic(item);
if(layout_imageobject)
add_imageobject(layout_imageobject, m_table_name);
else
{
sharedptr<LayoutItem_Placeholder> layout_placeholder =
sharedptr<LayoutItem_Placeholder>::cast_dynamic(item);
if(layout_placeholder)
add_placeholder(layout_placeholder, m_table_name);
}
}
}
}
......@@ -647,26 +639,6 @@ void FlowTableWithFields::add_textobject(const sharedptr<LayoutItem_Text>& layou
}
}
void FlowTableWithFields::add_placeholder(const sharedptr<LayoutItem_Placeholder>& /* layoutitem_placeholder */, const Glib::ustring& /* table_name */)
{
//Delete any existing placeholder (there can be only one):
delete m_placeholder;
m_placeholder = 0;
//Add the widget:
m_placeholder = Gtk::manage(new Gtk::Alignment());
m_placeholder->set(Gtk::ALIGN_START, Gtk::ALIGN_CENTER);
m_placeholder->show();
PlaceholderGlom* preview = Gtk::manage(new PlaceholderGlom);
preview->show();
m_placeholder->add(*preview);
m_list_layoutwidgets.push_back(preview);
add(*m_placeholder, false);
}
void FlowTableWithFields::add_imageobject(const sharedptr<LayoutItem_Image>& layoutitem_image, const Glib::ustring& table_name)
{
//Add the widget:
......
......@@ -247,7 +247,6 @@ private:
void add_button(const sharedptr<LayoutItem_Button>& layoutitem_button, const Glib::ustring& table_name);
void add_textobject(const sharedptr<LayoutItem_Text>& layoutitem_text, const Glib::ustring& table_name);
void add_imageobject(const sharedptr<LayoutItem_Image>& layoutitem_image, const Glib::ustring& table_name);
void add_placeholder(const sharedptr<LayoutItem_Placeholder>& layoutitem_image, const Glib::ustring& table_name);
void add_layoutwidgetbase(LayoutWidgetBase* layout_widget);
void add_layout_notebook(const sharedptr<LayoutItem_Notebook>& notebook);
......
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
* glom
* Copyright (C) Johannes Schmid 2007 <jhs@gnome.org>
*
* glom 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.
*
* glom 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 glom. If not, write to:
* The Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
*/
#include "placeholder-glom.h"
#include <gtkmm/messagedialog.h>
#include <glom/application.h>
#include <gdkmm.h>
#include <glibmm/i18n.h>
#include <string.h> // for memset
namespace Glom
{
PlaceholderGlom::PlaceholderGlom() :
Glib::ObjectBase("glom_placeholder"),
Gtk::Widget()
{
set_has_window(false);
}
PlaceholderGlom::~PlaceholderGlom()
{
}
Application* PlaceholderGlom::get_application()
{
Gtk::Container* pWindow = get_toplevel();
//TODO: This only works when the child widget is already in its parent.
return dynamic_cast<Application*>(pWindow);
}
void PlaceholderGlom::on_size_request(Gtk::Requisition* requisition)
{
//Initialize the output parameter:
*requisition = Gtk::Requisition();
// Take some mimimum size, we later want to cover the whole space available
requisition->height = 30;
requisition->width = 200;
}
void PlaceholderGlom::on_size_allocate(Gtk::Allocation& allocation)
{
//Use the offered allocation for this container:
set_allocation(allocation);
if(m_refGdkWindow)
{
m_refGdkWindow->move_resize( allocation.get_x(), allocation.get_y(),
allocation.get_width(), allocation.get_height() );
}
}
void PlaceholderGlom::on_realize()
{
//Call base class:
Gtk::Widget::on_realize();
if(!m_refGdkWindow)
{
//Create the GdkWindow:
GdkWindowAttr attributes;
memset(&attributes, 0, sizeof(attributes));
Gtk::Allocation allocation = get_allocation();
//Set initial position and size of the Gdk::Window:
attributes.x = allocation.get_x();
attributes.y = allocation.get_y();
attributes.width = allocation.get_width();
attributes.height = allocation.get_height();
attributes.event_mask = get_events () | Gdk::EXPOSURE_MASK;
attributes.window_type = GDK_WINDOW_CHILD;
attributes.wclass = GDK_INPUT_OUTPUT;
m_refGdkWindow = Gdk::Window::create(get_window() /* parent */, &attributes,
GDK_WA_X | GDK_WA_Y);
set_has_window();
set_window(m_refGdkWindow);
//set colors
override_color(Gdk::RGBA("black"));
//make the widget receive expose events
m_refGdkWindow->set_user_data(gobj());
}
}
void PlaceholderGlom::on_unrealize()
{
m_refGdkWindow.reset();
Gtk::Widget::on_unrealize();
}
bool PlaceholderGlom::on_draw(const Cairo::RefPtr<Cairo::Context>& cr)
{
// Paint the background:
Gdk::Cairo::set_source_rgba(cr, get_style_context()->get_background_color());
cr->paint();
// Draw the foreground:
Gdk::Cairo::set_source_rgba(cr, get_style_context()->get_color());
cr->set_line_width(4);
cr->rectangle(0, 0, get_allocation().get_width(), get_allocation().get_height());
cr->stroke();
return true;
}
} // namespace Glom
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
* glom
* Copyright (C) Johannes Schmid 2007 <jhs@gnome.org>
*
* glom 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.
*
* glom 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 glom. If not, write to:
* The Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
*/
#ifndef GLOM_MODE_DATA_PLACEHOLDER_GLOM_H
#define GLOM_MODE_DATA_PLACEHOLDER_GLOM_H
#include <gtkmm/widget.h>
#include <glom/utility_widgets/layoutwidgetbase.h>
//#include <libglom/data_structure/layout/layoutitem_button.h>
//#include <gtkmm/builder.h>
namespace Glom
{
class PlaceholderGlom:
public Gtk::Widget,
public LayoutWidgetBase
{
public:
//explicit PlaceholderGlom(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& builder);
explicit PlaceholderGlom();
virtual ~PlaceholderGlom();
private:
virtual Application* get_application();
virtual void on_size_request(Gtk::Requisition* requisition);
virtual void on_size_allocate(Gtk::Allocation& allocation);
virtual void on_realize();
virtual void on_unrealize();
virtual bool on_draw(const Cairo::RefPtr<Cairo::Context>& cr);
Glib::RefPtr<Gdk::Window> m_refGdkWindow;
};
} // namespace Glom
#endif // GLOM_MODE_DATA_PLACEHOLDER_GLOM_H
......@@ -27,7 +27,8 @@
namespace Glom
{
//TODO: Remove this, using the vbox directly?
/** This is just an easy way to use a Gtk::Box as a single-item container.
*/
class PlaceHolder : public Gtk::Box
{
public:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment