File: PropertyBox.h

package info (click to toggle)
granule 1.4.0-7-9
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster
  • size: 5,236 kB
  • ctags: 2,144
  • sloc: cpp: 16,030; makefile: 353
file content (99 lines) | stat: -rw-r--r-- 2,565 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
// -*- c++ -*-
//------------------------------------------------------------------------------
//                             PropertyBox.h
//------------------------------------------------------------------------------
// $Id: PropertyBox.h,v 1.4 2008/06/02 03:03:54 vlg Exp $
//------------------------------------------------------------------------------
//  Copyright (c) 2004,2006 by Vladislav Grinchenko
//
//  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.
//------------------------------------------------------------------------------
#ifndef PROPERTY_BOX_H
#define PROPERTY_BOX_H

#include <gtkmm/dialog.h>
#include <gtkmm/notebook.h>

#ifdef IS_HILDON
#    include <hildonmm.h>
#endif

#include "Granule-main.h"
#include "Granule.h"

#include "ButtonWithImageLabel.h"

/*==============================================================================
 * Class PropertyBox
 *==============================================================================
 */
#ifdef IS_HILDON
class PropertyBox : public Hildon::Window
#else
class PropertyBox : public Gtk::Dialog
#endif
{
public:
	PropertyBox (const std::string& title_);
	~PropertyBox ();

	/** 
	 * When a setting has changed, application code needs to invoke 
	 * this function to make Ok button sensitive.
	 */
	void changed ();

	/**
	 * Append a new page
	 *
	 * @param child_ Widget to add to the new page
	 * @param tab_ Name of the page
	 */
	gint append_page (Gtk::Widget& child_, const std::string& tab_);

	/**
	 * Called in response to pressing Apply button if any changes
	 * were reported prior by the derived class.
	 */
	virtual void apply_impl () = 0;

	/**
	 * Called in response to pressing Close button.
	 */
	virtual void close_impl () = 0;

protected:
	Gtk::Notebook* m_notebook;

	ButtonWithImageLabel* m_close_button;
	ButtonWithImageLabel* m_apply_button;

private:
	void on_apply_clicked ();
	void on_close_clicked ();
	bool on_delete_window_clicked (GdkEventAny* event_);

private:
	bool m_property_changed;	// Reflects <Apply> button status only.

#ifdef IS_HILDON
	Gtk::VBox* get_vbox () { return m_vbox; }
	Gtk::HButtonBox* get_action_area () { return m_action_area; }

	Gtk::VBox*       m_vbox;
	Gtk::HButtonBox* m_action_area;
#endif
};

inline
PropertyBox::
~PropertyBox ()
{
	trace_with_mask("PropertyBox::~PropertyBox",GUITRACE);
}


#endif /* PROPERTY_BOX_H */