~ubuntu-branches/ubuntu/utopic/mysql-workbench/utopic

« back to all changes in this revision

Viewing changes to library/forms/form.cpp

  • Committer: Package Import Robot
  • Author(s): Dmitry Smirnov
  • Date: 2014-05-31 12:03:58 UTC
  • mfrom: (1.2.4)
  • Revision ID: package-import@ubuntu.com-20140531120358-cjik5ofkmj0fxsn8
Tags: 6.1.6+dfsg-1
* New upstream release [May 2014].
* Dropped "prtcl.patch".
* "debian/clean": better clean-up.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* 
2
 
 * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
 
2
 * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
3
3
 *
4
4
 * This program is free software; you can redistribute it and/or
5
5
 * modify it under the terms of the GNU General Public License as
23
23
 
24
24
using namespace mforms;
25
25
 
 
26
//--------------------------------------------------------------------------------------------------
 
27
 
26
28
Form::Form(Form *owner, FormFlag flag)
27
29
{
28
30
  _form_impl= &ControlFactory::get_instance()->_form_impl;
29
31
  
30
 
  _content= 0;
31
 
  _fixed_size= false;
 
32
  _content = NULL;
 
33
  _fixed_size = false;
32
34
  _release_on_close = false;
 
35
  _active = true;
33
36
  _form_impl->create(this, owner, flag);
34
37
}
35
38
 
 
39
//--------------------------------------------------------------------------------------------------
 
40
 
36
41
Form::Form()
37
42
{
38
 
  _form_impl= &ControlFactory::get_instance()->_form_impl;
39
 
  _content= 0;
 
43
  _form_impl = &ControlFactory::get_instance()->_form_impl;
 
44
  _content = NULL;
 
45
  _fixed_size = false;
 
46
  _release_on_close = false;
 
47
  _active = true;
40
48
}
41
49
 
 
50
//--------------------------------------------------------------------------------------------------
 
51
 
42
52
Form *Form::main_form()
43
53
{
44
54
  static Form *main_form = new Form();
47
57
  return main_form;
48
58
}
49
59
 
 
60
//--------------------------------------------------------------------------------------------------
 
61
 
50
62
Form::~Form()
51
63
{
52
64
  if (_content && !_content->release_on_add())
53
65
    _content->release();
54
66
}
55
67
 
 
68
//--------------------------------------------------------------------------------------------------
 
69
 
56
70
void Form::set_title(const std::string &title)
57
71
{
58
72
  if (_form_impl)
59
73
    _form_impl->set_title(this, title);
60
74
}
61
75
 
 
76
//--------------------------------------------------------------------------------------------------
 
77
 
62
78
void Form::set_release_on_close(bool flag)
63
79
{
64
80
  if (_form_impl)
65
81
    _release_on_close = flag;
66
82
}
67
83
 
 
84
//--------------------------------------------------------------------------------------------------
 
85
 
68
86
bool Form::run_modal(Button *accept, Button *cancel)
69
87
{
70
88
  if (_form_impl)
72
90
  return false;
73
91
}
74
92
 
 
93
//--------------------------------------------------------------------------------------------------
 
94
 
75
95
void Form::show_modal(Button *accept, Button *cancel)
76
96
{
77
97
  if (_form_impl)
78
98
    _form_impl->show_modal(this, accept, cancel);
79
99
}
80
100
 
 
101
//--------------------------------------------------------------------------------------------------
 
102
 
81
103
void Form::end_modal(bool result)
82
104
{
83
105
  if (_form_impl)
84
106
    _form_impl->end_modal(this, result);
85
107
}
86
108
 
 
109
//--------------------------------------------------------------------------------------------------
 
110
 
87
111
void Form::close()
88
112
{
89
113
  if (_form_impl)
90
114
    _form_impl->close(this);
91
115
}
92
116
 
 
117
//--------------------------------------------------------------------------------------------------
93
118
 
94
119
void Form::center()
95
120
{
97
122
    _form_impl->center(this);
98
123
}
99
124
 
 
125
//--------------------------------------------------------------------------------------------------
100
126
 
101
127
void Form::set_content(View *view)
102
128
{
115
141
  }
116
142
}
117
143
 
 
144
//--------------------------------------------------------------------------------------------------
 
145
 
118
146
void Form::flush_events()
119
147
{
120
148
  if (_form_impl)
121
149
    _form_impl->flush_events(this);
122
150
}
123
151
 
 
152
//--------------------------------------------------------------------------------------------------
 
153
 
 
154
void Form::activated()
 
155
{
 
156
  _active = true;
 
157
  _activated_signal();
 
158
}
 
159
 
 
160
//--------------------------------------------------------------------------------------------------
 
161
 
 
162
void Form::deactivated()
 
163
{
 
164
  _active = false;
 
165
  _deactivated_signal();
 
166
}
 
167
 
 
168
//--------------------------------------------------------------------------------------------------
 
169
 
 
170
bool Form::is_active()
 
171
{
 
172
  return _active;
 
173
}
 
174
 
 
175
//--------------------------------------------------------------------------------------------------