24 #include "wx/editor/candoc.h"
25 #include "wx/editor/cancom.h"
27 #define STRUCT_HSIZE 220
28 #define STRUCT_VSIZE 400
30 const int GROUP_BUTTON_OK = wxID_HIGHEST + 5401 ;
31 const int GROUP_BUTTON_CANCEL = wxID_HIGHEST + 5402 ;
32 const int GROUP_BUTTON_SHOW = wxID_HIGHEST + 5403 ;
33 const int GROUP_UPDATE_DIALOG = wxID_HIGHEST + 5404 ;
34 const int GROUP_BUTTON_APPLY = wxID_HIGHEST + 5405 ;
35 const int GROUP_DCLICK = wxID_HIGHEST + 5406 ;
51 wxWindowID
id, const wxString& caption, const wxPoint& pos, const wxSize& size )
54 Create( parent,
id, caption, pos, size, style );
61 m_document = document;
63 m_structureSet.clear();
70 if ( m_structureSet.size() )
71 m_listbox->SetSelection( 0,
true );
75 a2dCanvasObjectsDocDialog::a2dCanvasObjectsDocDialog( wxWindow* parent,
a2dCanvasObjectList* total,
bool modal,
long style,
76 wxWindowID
id,
const wxString& caption,
const wxPoint& pos,
const wxSize& size )
79 Create( parent,
id, caption, pos, size, style );
96 m_listbox->SetSelection( 0,
true );
107 SetExtraStyle( GetExtraStyle() | wxWS_EX_BLOCK_EVENTS );
108 wxDialog::Create( parent,
id, caption, pos, size, style );
112 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer( wxVERTICAL );
113 itemDialog1->SetSizer( itemBoxSizer2 );
115 m_numberObjects =
new wxStaticText( itemDialog1, STRUCT_ID_STATIC, _(
"Number of objects:" ), wxDefaultPosition, wxDefaultSize, 0 );
116 m_numberObjects->SetHelpText( _(
"Displays number of objects in list" ) );
118 m_numberObjects->SetToolTip( _(
"Displays number of objects in list" ) );
119 itemBoxSizer2->Add( m_numberObjects, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
121 wxBoxSizer* itemBoxSizer4 =
new wxBoxSizer( wxHORIZONTAL );
122 itemBoxSizer2->Add( itemBoxSizer4, 1, wxGROW | wxALL, 1 );
124 wxString* m_listboxStrings = NULL;
125 m_listbox =
new wxListBox( itemDialog1, STRUCT_ID_LISTBOX, wxDefaultPosition, wxDefaultSize, 0, m_listboxStrings, wxLB_SINGLE | wxLB_NEEDED_SB );
126 m_listbox->SetHelpText( _(
"list of objects to choose from, Double click to choose." ) );
128 m_listbox->SetToolTip( _(
"list of objects to choose from, Double click to choose." ) );
129 itemBoxSizer4->Add( m_listbox, 1, wxGROW | wxALL, 1 );
131 wxBoxSizer* itemBoxSizer6 =
new wxBoxSizer( wxHORIZONTAL );
132 itemBoxSizer2->Add( itemBoxSizer6, 0, wxGROW | wxALL, 1 );
136 m_hide =
new wxButton( itemDialog1, STRUCT_ID_HIDE, _(
"Ok" ), wxDefaultPosition, wxDefaultSize, 0 );
137 m_Apply =
new wxButton( itemDialog1, STRUCT_ID_APPLY, _(
"Cancel" ), wxDefaultPosition, wxDefaultSize, 0 );
141 m_hide =
new wxButton( itemDialog1, STRUCT_ID_HIDE, _(
"Hide" ), wxDefaultPosition, wxDefaultSize, 0 );
142 m_Apply =
new wxButton( itemDialog1, STRUCT_ID_APPLY, _(
"Apply" ), wxDefaultPosition, wxDefaultSize, 0 );
145 m_hide->SetHelpText( _(
"Hide this dialog" ) );
147 m_hide->SetToolTip( _(
"Hide this dialog" ) );
148 itemBoxSizer6->Add( m_hide, 0, wxALIGN_CENTER_VERTICAL | wxALL, 1 );
150 m_Apply->SetHelpText( _(
"Set this object as top in canvas" ) );
152 m_Apply->SetToolTip( _(
"Set this object as top in canvas" ) );
153 itemBoxSizer6->Add( m_Apply, 0, wxALIGN_CENTER_VERTICAL | wxALL, 1 );
155 GetSizer()->Fit(
this );
156 GetSizer()->SetSizeHints(
this );
161 a2dCanvasObjectsDocDialog::~a2dCanvasObjectsDocDialog()
175 for( a2dCanvasObjectList::iterator iter = objects->begin(); iter != objects->end(); ++iter )
187 m_listbox->Append( obj->
GetName() + wxT(
"=>top" ) );
190 m_listbox->Append( obj->
GetName() );
193 wxString mess = wxT(
"" );
194 mess.Printf( _(
"Number of structures: %ld" ),
m_structureSet.size() - 1 );
195 m_numberObjects->SetLabel( mess );
199 m_listbox->SetSelection( 0,
true );
229 if ( obj->GetHighLight() )
231 m_listbox->Append( obj->
GetName() + wxT(
"=>top" ) );
234 m_listbox->Append( obj->
GetName() );
242 collector.SetSkipNotRenderedInDrawing(
true );
253 m_listbox->Append( obj->
GetName() + wxT(
"=>top" ) );
256 m_listbox->Append( obj->
GetName() );
260 wxString mess = wxT(
"" );
261 mess.Printf( _(
"Number of structures: %i" ),
m_structureSet.size() - 1 );
262 m_numberObjects->SetLabel( mess );
266 m_listbox->SetSelection( 0,
true );
285 SetReturnCode( wxID_OK );
294 EndModal( wxID_CANCEL );
304 void a2dCanvasObjectsDocDialog::CmApply()
307 buf = m_listbox->GetStringSelection();
311 wxString name = obj->
GetName();
312 if ( !name.Cmp( buf ) )
317 else if ( name + wxT(
"=>top" ) == buf )
330 a2dGetCmdh()->
Submit( command,
false );
345 SetReturnCode( wxID_OK );
356 if ( !IsModal() && doc )
363 void a2dCanvasObjectsDocDialog::OnComEvent(
a2dComEvent& event )
#define wxDynamicCast(obj, className)
Define wxDynamicCast so that it will give a compiler error for unrelated types.
#define EVT_CHANGED_DOCUMENT(func)
event sent to a2dDocumentCommandProcessor when the current document has changed in the a2dDocumentCom...
diagram is an appearance for a2dCameleon
virtual wxString GetName() const
Returns the name of this object, if no name is given the internal id will be returned.
a2dDrawingId GetDrawingId()
set special id to differentiate drawings
a2dCanvasCommandProcessor * GetDrawingCmdProcessor()
get commandprocessor of document
View on a a2dCanvasDocument.
a2dCommand * GetCommand()
the command ( if there was one ) that did it.
a2dCanvasObjectsSet m_structureSet
Pointer to object list.
a2dCanvasObject * GetRootObject() const
get the root object, which holds the objects in the document
#define EVT_DO(func)
event sent from a2DocumentCommandProcessor when a command is initially done
void ConnectEvent(wxEventType type, wxEvtHandler *eventSink)
a2dDrawing * GetDrawing() const
get the root object, which holds the objects in the document.
void OnStructIdHideClick(wxCommandEvent &event)
wxEVT_COMMAND_BUTTON_CLICKED event handler for STRUCT_ID_HIDE
object to show several appearance views on what it contains
a2dCanvasObject is the base class for Canvas Objects.
a2dCanvasView * CheckDrawer() const
is a view with a2dCanvasView active
a2dCanvasObject * GetCanvasObject()
Pointer to object selected.
static const a2dCommandId Id
Print the current document or view.
virtual a2dObject * GetRefObject() const
when a2dProperty, return its value else assert
a2dCanvasObjectList * GetChildObjectList()
get the list where the child objects are stored in.
void OnCloseWindow(wxCloseEvent &event)
wxEVT_CLOSE_WINDOW event handler for ID_DIALOG
void SetWithChilds(bool check)
if set, objects must have childs
static const a2dSignal sig_changedShowObject
#define EVT_COM_EVENT(func)
static wxEvtHandler for communication event
const a2dCommandId * GetCommandId()
a specific id for this command.
#define wxStaticCast(obj, className)
The wxWindows 2.4.2 wxStaticCast is buggy. It evaluates its argument twice.
a2dCanvasObject * m_object
Pointer to the choosen object.
bool Create(wxWindow *parent, wxWindowID id=SYMBOL_A2DCANVASOBJECTSDIALOG_IDNAME, const wxString &caption=SYMBOL_A2DCANVASOBJECTSDIALOG_TITLE, const wxPoint &pos=SYMBOL_A2DCANVASOBJECTSDIALOG_POSITION, const wxSize &size=SYMBOL_A2DCANVASOBJECTSDIALOG_SIZE, long style=SYMBOL_A2DCANVASOBJECTSDIALOG_STYLE)
Creation.
void OnStructIdListboxSelected(wxCommandEvent &event)
wxEVT_COMMAND_LISTBOX_SELECTED event handler for STRUCT_ID_LISTBOX
Tappear * GetAppearance(bool autoCreate=false)
Get a specific a2dAppear derived class instance from here.
collect a2dCanvasObject's in a hierarchy of a a2dCanvasDocument
Symbolic appearance for a2dCameleon.
virtual bool Submit(a2dCommand *command, bool storeIt=true)
next to the base class submit, it sets a2DocumentCommandProcessor for a2dCommand
bool NameSorter(const a2dCanvasObjectPtr &x, const a2dCanvasObjectPtr &y)
used to canvas object on name
void OnStructIdApplyClick(wxCommandEvent &event)
wxEVT_COMMAND_BUTTON_CLICKED event handler for STRUCT_ID_APPLY
a2dDocviewGlobal * a2dDocviewGlobals
a global pointer to get to global instance of important classes.
a2dCanvasObjectsSet m_found
objects found
Each a2dCanvasView needs to have a a2dCanvasDocument set in order to render data. ...
Event sent to a2dCommandProcessor.
a2dDocumentCommandProcessor * GetDocviewCommandProcessor() const
Gets a2dDocumentCommandProcessor pointer.
void Init(a2dCanvasObjectList *objects)
take over object to show from objects
void OnChangedDocument(a2dCommandEvent &event)
document changed
void OnStructIdListboxDoubleClicked(wxCommandEvent &event)
wxEVT_COMMAND_LISTBOX_DOUBLECLICKED event handler for STRUCT_ID_LISTBOX
all headers of the canvas module
for choosing a a2dCanvasObject from a list.
bool DisconnectEvent(wxEventType type, wxEvtHandler *eventSink)
a2dDocument * GetDocument()
the document created/removed or on which the command was applied.
static bool ShowToolTips()
Should we show tooltips?