bbtkWxGUITextEditor.cxx

Go to the documentation of this file.
00001 /*=========================================================================                                                                               
00002   Program:   bbtk
00003   Module:    $RCSfile: bbtkWxGUITextEditor.cxx,v $
00004   Language:  C++
00005   Date:      $Date: 2008/10/17 08:18:15 $
00006   Version:   $Revision: 1.18 $
00007 =========================================================================*/
00008 
00009 /* ---------------------------------------------------------------------
00010 
00011 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
00012 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
00013 *
00014 *  This software is governed by the CeCILL-B license under French law and 
00015 *  abiding by the rules of distribution of free software. You can  use, 
00016 *  modify and/ or redistribute the software under the terms of the CeCILL-B 
00017 *  license as circulated by CEA, CNRS and INRIA at the following URL 
00018 *  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
00019 *  or in the file LICENSE.txt.
00020 *
00021 *  As a counterpart to the access to the source code and  rights to copy,
00022 *  modify and redistribute granted by the license, users are provided only
00023 *  with a limited warranty  and the software's author,  the holder of the
00024 *  economic rights,  and the successive licensors  have only  limited
00025 *  liability. 
00026 *
00027 *  The fact that you are presently reading this means that you have had
00028 *  knowledge of the CeCILL-B license and that you accept its terms.
00029 * ------------------------------------------------------------------------ */                                                                         
00030 
00031 
00048 #ifdef _USE_WXWIDGETS_
00049 
00050 #include <iostream>     
00051 #include "bbtkWxGUITextEditor.h"
00052 #include "bbtkWxBlackBox.h"
00053 #include "bbtkConfigurationFile.h"
00054 #include "bbtkUtilities.h"
00055 
00056 //#include "icons/cc_new.xpm"
00057 //#include "icons/cc_open.xpm"
00058 //#include "icons/cc_stop.xpm"
00059 //#include "icons/cc_save.xpm"
00060 //#include "icons/cc_save_as.xpm"
00061 //#include "icons/cc_run.xpm"
00062 //#include "icons/cc_exit.xpm"
00063 
00064 #include "../data/icons/wxart_new.xpm"
00065 #include "../data/icons/wxart_fileopen.xpm"
00066 #include "../data/icons/wxart_filesave.xpm"
00067 #include "../data/icons/wxart_filesaveas.xpm"
00068 //#include "../data/icons/wxart_exefile.xpm"
00069 //#include "../data/icons/wxart_delete.xpm"
00070 #include "../data/icons/wxart_down.xpm"
00071 #include "../data/icons/wxart_eldel.xpm"
00072 
00073 namespace bbtk
00074 {
00075 
00076 
00077   //================================================================
00078   class WxTextCtrlGettingKeyEvents : public wxTextCtrl
00079   {
00080   public:
00081     WxTextCtrlGettingKeyEvents(wxWindow *parent, wxWindowID id, const wxString &value,
00082                                const wxPoint &pos, const wxSize &size, int style = 0)
00083       : wxTextCtrl(parent, id, value, pos, size, style)
00084     {
00085     }
00086     
00087     void SetWxGUITextEditor(WxGUITextEditor* e) 
00088     { mWxGUITextEditor = e; }
00089     
00090     void OnKeyDown(wxKeyEvent& event);
00091     void OnKeyUp(wxKeyEvent& event);
00092     void OnChar(wxKeyEvent& event);
00093   private :
00094     WxGUITextEditor* mWxGUITextEditor;
00095     
00096     DECLARE_EVENT_TABLE()
00097       };
00098   
00099   BEGIN_EVENT_TABLE(WxTextCtrlGettingKeyEvents, wxTextCtrl)
00100     EVT_KEY_DOWN(WxTextCtrlGettingKeyEvents::OnKeyDown)
00101     EVT_KEY_UP(WxTextCtrlGettingKeyEvents::OnKeyUp)
00102     EVT_CHAR(WxTextCtrlGettingKeyEvents::OnChar)
00103     END_EVENT_TABLE()
00104     
00105     
00106     void WxTextCtrlGettingKeyEvents::OnChar(wxKeyEvent& event)
00107   {
00108     event.Skip();
00109   }
00110   
00111   void WxTextCtrlGettingKeyEvents::OnKeyUp(wxKeyEvent& event)
00112   {
00113     mWxGUITextEditor->OnKeyUp(event);
00114     event.Skip();
00115   }
00116   
00117   void WxTextCtrlGettingKeyEvents::OnKeyDown(wxKeyEvent& event)
00118   {
00119     mWxGUITextEditor->OnKeyDown(event);
00120     event.Skip();
00121   }
00122   //================================================================
00123   
00124   
00125   //================================================================  
00126   /*  BEGIN_EVENT_TABLE(WxGUITextEditorPage, wxPanel)
00127     EVT_CLOSE(WxGUITextEditorPage::OnClose)
00128     END_EVENT_TABLE()
00129   */
00130  
00131   //================================================================
00132   WxGUITextEditorPage::WxGUITextEditorPage(wxWindow* parent,
00133                                                WxGUITextEditor* editor)
00134     : wxPanel(parent,-1),
00135       mEditor(editor),
00136       mName(""),
00137       mAskFilename(true)
00138   {  
00139 
00140           //      std::cout << "WxGUITextEditorPage::WxGUITextEditorPage("<<mName<<")"<<std::endl;
00141 
00142     wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
00143  
00144     mwxInputText = 
00145                 
00146       new WxTextCtrlGettingKeyEvents(this,
00147                                      -1, //ID_InputText,
00148                                      _T(""),
00149                                      wxDefaultPosition,
00150                                      wxDefaultSize,
00151                                      wxTE_MULTILINE 
00152                                      //    |wxTE_PROCESS_ENTER
00153                                      //| wxTE_PROCESS_TAB 
00154                                      //             | wxWANTS_CHARS 
00155                                     // |  wxTAB_TRAVERSAL
00156                                      );
00157     mwxInputText->SetWxGUITextEditor(mEditor);
00158     /*
00159         new wxTextCtrl(this,-1,_T(""),
00160                 wxDefaultPosition,
00161                                              wxDefaultSize,
00162                                              wxTE_MULTILINE 
00163                                              //    |wxTE_PROCESS_ENTER
00164                                         //       | wxTE_PROCESS_TAB 
00165                                 //                  | wxWANTS_CHARS 
00166                                  //    |  wxTAB_TRAVERSAL
00167                                      );
00168                                          */
00169     wxFont* FixedFont = new wxFont(10,
00170                                    wxFONTFAMILY_MODERN,
00171                                    wxFONTSTYLE_NORMAL,
00172                                    wxFONTWEIGHT_NORMAL,
00173                                    false);
00174     
00175     mwxInputTextAttr = new wxTextAttr;
00176     mwxInputTextAttr->SetFont(*FixedFont);
00177    
00178     sizer->Add(mwxInputText,1,wxGROW);
00179     SetSizer(sizer);
00180     SetAutoLayout(true);
00181     Layout();
00182   }
00183   //================================================================
00184 
00185   //================================================================
00186   WxGUITextEditorPage::~WxGUITextEditorPage()
00187   {
00188   }
00189   //================================================================
00190 
00191   bool WxGUITextEditorPage::IsModified()
00192    { return mwxInputText->IsModified(); }
00193 
00194   std::string WxGUITextEditorPage::GetText()
00195   {
00196     return wx2std(GetTextCtrl()->GetValue());
00197   }
00198 
00199   //================================================================
00200   void WxGUITextEditorPage::Load(const std::string& filename)
00201   {
00202     //    std::cout << "-------------- LOAD ---------------"<<std::endl;
00203     //    std::cout << "'" << filename << "'"<<std::endl;
00204     //std::string oldFilename = mFilename;
00205     mName = filename;
00206     mAskFilename = false;
00207     mwxInputText->LoadFile(std2wx(mName));
00208   }
00209   //================================================================
00210 
00211   //================================================================
00212   void WxGUITextEditorPage::Save(const std::string& filter)
00213   {
00214     //    std::cout << "-------------- SAVE ---------------"<<std::endl;
00215     if (mAskFilename)
00216       {
00217         wxFileDialog* fd = new wxFileDialog(this,_T("Save file"),_T(""),
00218                                             _T(""),std2wx(filter),
00219                                             wxSAVE | wxOVERWRITE_PROMPT );
00220         int result_fd = fd->ShowModal();
00221     
00222         // This line is need it by windows // EED
00223         fd->SetReturnCode( result_fd );
00224 
00225         if (fd->GetReturnCode()==wxID_OK)
00226           {
00227             mName = wx2std(fd->GetPath());
00228             mAskFilename = false;
00229           }
00230         else 
00231           {
00232             //      std::cout << "-------------- CANCELLED ---------------"
00233             //                <<std::endl;
00234             return;
00235           } 
00236       }
00237     //    std::cout << "file [" << mName << "]" <<std::endl;
00238     mwxInputText->SaveFile(std2wx(mName));
00239     mwxInputText->SetModified(false);
00240   }
00241   //================================================================
00242   
00243 
00244 
00245 
00246 
00247 
00248 
00249 
00250 
00251 
00252 
00253 
00254 
00255 
00256 
00257 
00258 
00259 
00260 
00261 
00262 
00263 
00264   //================================================================
00265   // WxGUITextEditor
00266   //================================================================
00267 
00268 
00269   //================================================================
00270   WxGUITextEditor::WxGUITextEditor( wxWindow *parent,
00271                                     WxGUITextEditorUser* user )
00272     : wxPanel(parent, -1),
00273       mUser(user),
00274       mFileNameFilter("*.*")
00275   {
00276   //  m_mgr.SetManagedWindow(this);
00277                     //    wxInitAllImageHandlers();
00278      
00279         //  std::cout << "WxGUITextEditor::WxGUITextEditor"<<std::endl;
00280 
00281       wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
00282 
00283     mwxNotebook = new wxNotebook(this,-1,
00284                 wxDefaultPosition, wxDefaultSize, 
00285                 wxNB_TOP 
00286 
00287                 
00288                 );
00289                 
00290    sizer->Add(mwxNotebook,1,wxGROW);
00291 
00292                 
00293                 /*
00294    mwxNotebook =                new wxAuiNotebook(this,  
00295                                     -1,
00296                                     wxPoint(0, 0),
00297                                     wxSize(500,500),
00298                                     wxAUI_NB_TAB_SPLIT 
00299                                     | wxAUI_NB_TAB_MOVE
00300                                     | wxAUI_NB_TAB_EXTERNAL_MOVE
00301                                     | wxAUI_NB_WINDOWLIST_BUTTON
00302                                     |wxAUI_NB_SCROLL_BUTTONS
00303                                     // | wxAUI_NB_CLOSE_BUTTON 
00304                                     | wxAUI_NB_CLOSE_ON_ACTIVE_TAB
00305                                     //| wxAUI_NB_CLOSE_ON_ALL_TABS
00306                                     | wxNO_BORDER);
00307     
00308     m_mgr.AddPane(mwxNotebook,
00309                   wxAuiPaneInfo().Name(wxT("notebook"))
00310                   .Caption(wxT(""))
00311                   .CaptionVisible(false)
00312                   .MinimizeButton(false)
00313                   .MaximizeButton(false)
00314                   .CloseButton(false)
00315                   //              .Dockable(false).Float()
00316                   .Center()
00317                   .MinSize(wxSize(100,50))
00318                   );   
00319 */
00320  
00321     /*   
00322     wxBitmap bmp_new(cc_new_xpm);
00323     wxBitmap bmp_open(cc_open_xpm);
00324     wxBitmap bmp_close(cc_stop_xpm);
00325     wxBitmap bmp_save(cc_save_xpm);
00326     wxBitmap bmp_saveas(cc_save_as_xpm);
00327     wxBitmap bmp_run(cc_run_xpm);
00328     */
00329     wxBitmap bmp_new(new_xpm);
00330     wxBitmap bmp_open(fileopen_xpm);
00331     wxBitmap bmp_close(eldel_xpm);
00332     wxBitmap bmp_save(filesave_xpm);
00333     wxBitmap bmp_saveas(filesaveas_xpm);
00334     wxBitmap bmp_run(down_xpm);
00335 
00336     mwxToolBar = new wxToolBar(this, wxID_ANY, 
00337                                wxDefaultPosition, wxDefaultSize,
00338                                wxTB_FLAT | wxTB_NODIVIDER);
00339     
00340     mwxToolBar->AddTool(ID_ButtonNew, _T("New"),
00341                      bmp_new, wxNullBitmap, wxITEM_NORMAL,
00342                      _T("New file"), _T("Create a new file"));
00343     mwxToolBar->AddTool(ID_ButtonOpen, _T("Open"),
00344                      bmp_open, wxNullBitmap, wxITEM_NORMAL,
00345                      _T("Open file"), _T("This is help for new file tool"));
00346     mwxToolBar->AddTool(ID_ButtonClose, _T("Close"),
00347                      bmp_close, wxNullBitmap, wxITEM_NORMAL,
00348                      _T("Close file"), _T("Close current file"));
00349     mwxToolBar->AddTool(ID_ButtonSave, _T("New"),
00350                      bmp_save, wxNullBitmap, wxITEM_NORMAL,
00351                      _T("Save file"), _T("Save current file"));
00352     mwxToolBar->AddTool(ID_ButtonSaveAs, _T("New"),
00353                      bmp_saveas, wxNullBitmap, wxITEM_NORMAL,
00354                      _T("Save file as"), _T("Save current file as"));
00355     mwxToolBar->AddTool(ID_ButtonRun, _T("Run"),
00356                      bmp_run, wxNullBitmap, wxITEM_NORMAL,
00357                      _T("Run file"), _T("Run current file"));
00358  
00359     mwxToolBar->AddSeparator();
00360     mwxPosition = new wxStaticText ( mwxToolBar, -1, _T(""));
00361     mwxToolBar->AddControl(mwxPosition);
00362     mwxToolBar->Realize();
00363 
00364           sizer->Add(mwxToolBar,0,wxGROW);
00365 
00366         /*
00367     m_mgr.AddPane(mwxToolBar, 
00368                   wxAuiPaneInfo().Name(wxT("toolBar"))
00369                   .Caption(wxT(""))
00370                   .ToolbarPane()
00371                   .Bottom()
00372                   .MinSize(wxSize(100,50))
00373                   .LeftDockable(false).RightDockable(false)
00374                   );   
00375 */
00376   SetSizer(sizer);
00377   
00378     
00379 //    m_mgr.Update();
00380     SetAutoLayout(true);
00381     Layout();
00382 
00383     NewPage("");
00384     UpdateInfo();
00385 
00386   }
00387   //================================================================
00388   
00389   //================================================================
00390   WxGUITextEditor::~WxGUITextEditor()
00391   {
00392   //  m_mgr.UnInit();
00393 
00394     //    delete mInterpreter;
00395   }
00396   //================================================================
00397 
00398   //================================================================
00399   void WxGUITextEditor::NewPage(const std::string& filename)
00400   {
00401    WxGUITextEditorPage* page = 
00402       new WxGUITextEditorPage(mwxNotebook,this);
00403     std::string name("untitled");
00404     if (filename.size()!=0) 
00405       {
00406         name = filename;
00407         page->Load(name);
00408       }
00409     page->SetPageName(name);
00410     std::string fname = Utilities::get_file_name(name);
00411     mwxNotebook->AddPage(page,std2wx(fname),true);
00412     FocusOnCurrentPage();
00413   }
00414   //================================================================
00415 
00416   //================================================================
00417   WxGUITextEditorPage* WxGUITextEditor::GetCurrentPage()
00418   {
00419     return (WxGUITextEditorPage*)
00420       mwxNotebook->GetPage(mwxNotebook->GetSelection());
00421   }
00422   //================================================================
00423 
00424   //================================================================
00425   void WxGUITextEditor::FocusOnCurrentPage()
00426   {
00427     if (mwxNotebook->GetPageCount()==0) return;
00428     GetCurrentPage()->SetFocus();    
00429   }
00430   //================================================================
00431 
00432   //================================================================  
00433   void WxGUITextEditor::OnToolLeftClick(wxCommandEvent& event)
00434   {
00435     switch (event.GetId())
00436       {
00437       case ID_ButtonNew :
00438         New(); 
00439         FocusOnCurrentPage();
00440         break;
00441       case ID_ButtonOpen :
00442         Open(); 
00443         FocusOnCurrentPage();
00444         break;
00445       case ID_ButtonClose :
00446         CloseCurrentPage();
00447         break;
00448       case ID_ButtonSave :
00449         SaveCurrentPage();
00450         break;
00451       case ID_ButtonSaveAs :
00452         if (mwxNotebook->GetPageCount()==0) break;  
00453         GetCurrentPage()->SetAskFilename(true);
00454         SaveCurrentPage();
00455         break;
00456       case ID_ButtonRun :
00457         if ((mUser!=0) && (mwxNotebook->GetPageCount()>0)) 
00458           mUser->WxGUITextEditorRun();
00459         FocusOnCurrentPage();
00460         break;
00461       }
00462   }
00463   //================================================================  
00464 
00465   //================================================================  
00466   void WxGUITextEditor::OnToolRightClick(wxCommandEvent& event)
00467   {
00468   }
00469   //================================================================  
00470 
00471   //================================================================  
00472   void WxGUITextEditor::New()
00473   {
00474     NewPage("");
00475     UpdateInfo();
00476   }
00477   //================================================================
00478 
00479   //================================================================  
00480   void WxGUITextEditor::Open()
00481   {
00482     //    std::cout << "-------------- OPEN ---------------"<<std::endl;
00483 
00484     wxFileDialog* fd = new wxFileDialog(this,_T("Open file"),_T(""),
00485                                         _T(""),std2wx(mFileNameFilter),
00486                                         wxOPEN | wxFILE_MUST_EXIST );
00487     int result_fd = fd->ShowModal();
00488 
00489         // This line is need it by windows //EED
00490         fd->SetReturnCode( result_fd );
00491 
00492     if (fd->GetReturnCode()==wxID_OK)
00493       {
00494         std::string filename = wx2std(fd->GetPath());
00495         std::cout << "file [" << filename << "]" <<std::endl;
00496         Open(filename);
00497       }
00498     else 
00499       {
00500         //      std::cout << "-------------- CANCELLED ---------------"<<std::endl;
00501       }
00502   }
00503   //================================================================  
00504   
00505   //================================================================  
00506   void WxGUITextEditor::Open(const std::string& filename)
00507   {
00508     NewPage(filename);
00509     UpdateInfo();
00510   }
00511   //================================================================  
00512 
00513 
00514   //================================================================  
00515   bool WxGUITextEditor::CloseCurrentPage()
00516   {
00517     if (mwxNotebook->GetPageCount()==0) return true;
00518 
00519     if (GetCurrentPage()->IsModified()) 
00520       {
00521         wxString mess = std2wx(GetCurrentPage()->GetPageName());
00522         mess += _T(" modified. Save it ?");
00523         wxMessageDialog* d = 
00524           new wxMessageDialog(this,
00525                               mess, 
00526                               _T("Save buffer"), 
00527                               wxYES_NO | wxCANCEL | wxICON_QUESTION);
00528         switch (d->ShowModal())
00529           {
00530           case wxID_CANCEL : 
00531             return false;
00532             break;
00533           case wxID_YES : 
00534             GetCurrentPage()->Save(mFileNameFilter); 
00535             break;
00536           case wxID_NO : ;
00537           }       
00538       } 
00539     mwxNotebook->DeletePage(mwxNotebook->GetSelection());
00540     FocusOnCurrentPage();
00541     return true;
00542   }
00543   //================================================================  
00544 
00545   //================================================================  
00546   bool WxGUITextEditor::CloseAllPages()
00547   {
00548     bool ok = true;
00549     while (mwxNotebook->GetPageCount()!=0)
00550       {
00551         if (!CloseCurrentPage()) 
00552           {
00553             ok = false;
00554             break;
00555           }
00556       }
00557     return ok;
00558   }
00559   //================================================================  
00560 
00561   //================================================================  
00562   void WxGUITextEditor::SaveCurrentPage()
00563   {
00564     if (mwxNotebook->GetPageCount()==0) return;  
00565     GetCurrentPage()->Save(mFileNameFilter);
00566     mwxNotebook->SetPageText(mwxNotebook->GetSelection(),
00567                              std2wx(GetCurrentPage()->GetPageName()));
00568   }
00569   //================================================================  
00570 
00571 
00572   //================================================================  
00573   void WxGUITextEditor::OnPageClose(wxAuiNotebookEvent& evt)
00574   {
00575     if (!CloseCurrentPage()) evt.Veto();
00576   }
00577   //================================================================
00578 
00579 
00580 
00581   /*
00582   //================================================================  
00583   void WxGUITextEditor::OnButtonQuit(wxCommandEvent& event) 
00584   { 
00585     Quit(); 
00586     FocusOnCurrentPage();
00587   }
00588   void WxGUITextEditor::Quit()
00589   {
00590     std::cout << "-------------- QUIT ---------------"<<std::endl;
00591     if (AskSave()) GetParent()->Close();
00592   }
00593   //================================================================  
00594   */
00595 
00596   //================================================================  
00597 
00598   /*
00599   void WxGUITextEditor::Run()
00600   {
00601     std::cout << "-------------- RUN ---------------"<<std::endl;
00602 
00603     if (!mwxSplit->IsSplit()) 
00604       {
00605         int size = -100;
00606         int minsize = - (int)(mwxInputText->GetSize().GetHeight() / 2.);
00607         if (size<minsize) size = minsize;
00608         mwxSplit->SplitHorizontally( mwxInputText, mwxOutputText, size);
00609       }
00610 
00611     std::stringstream* buffer = new std::stringstream(bbtk::wx2std(mwxInputText->GetValue()));
00612     mInterpreter->InterpretLine("reset");
00613     try 
00614       {
00615         mInterpreter->InterpretBuffer(buffer);
00616       }
00617     catch (...)
00618       {
00619       }
00620   } 
00621   //================================================================  
00622 */
00623   
00624  
00625   
00626   //================================================================
00627   
00628 
00629   //================================================================
00630   void WxGUITextEditor::UpdateInfo()
00631   {
00632     if (mwxNotebook->GetPageCount()==0) return;
00633     WxTextCtrlGettingKeyEvents* text = GetCurrentPage()->GetTextCtrl();
00634     
00635     long line, column, pos;
00636     pos = text->GetInsertionPoint();
00637     text->PositionToXY(pos, &column, &line);
00638     
00639     
00640     //                wxLogMessage(_T("Current position: %ld\nCurrent line, column: (%ld, %ld)\nNumber of lines: %ld\nCurrent line length: %ld\nTotal text length: %u (%ld)"),
00641     
00642     
00643     char mess[200];
00644     sprintf(mess,"%ld:%ld/%ld:%ld",
00645             line+1,column+1,
00646             (long)text->GetNumberOfLines(),
00647             (long)text->GetLineLength(line)+1);
00648     //       pos+1,
00649     //       (long)mwxInputText->GetValue().length())+1;
00650     
00651    // mwxPosition->SetLabel(wxString(mess));
00652     mwxPosition->SetLabel(std2wx(mess));    
00653     mwxPosition->Show();
00654     
00655     if (text->IsModified()) 
00656       {
00657         std::string title("*");
00658         title += GetCurrentPage()->GetPageName();
00659         mwxNotebook->SetPageText(mwxNotebook->GetSelection(),std2wx(title));
00660       }
00661   }
00662   //================================================================
00663   //================================================================
00664   void WxGUITextEditor::OnKeyUp(wxKeyEvent& event)
00665   {
00666   //    std::cout << "U" << std::endl;
00667     UpdateInfo();
00668   }
00669   //================================================================
00670 
00671   //================================================================
00672   void WxGUITextEditor::OnKeyDown(wxKeyEvent& event)
00673   {
00674      //   std::cout << "D" << std::endl;
00675     // std::cout << "Key="<<event.GetKeyCode()<<std::endl;
00676     if ( event.ControlDown() )
00677       {
00678         switch (event.GetKeyCode())
00679           {
00680           case 'n': case 'N' : New(); break;
00681           case 's': case 'S' : SaveCurrentPage(); break;
00682           case 'o': case 'O' : Open(); break;
00683             //    case 'r': case 'R' : Run(); break;
00684             //    case 'q': case 'Q' : Quit(); break;
00685           }
00686       }
00687   }
00688   //================================================================
00689   
00690   //================================================================  
00691   BEGIN_EVENT_TABLE(WxGUITextEditor, wxPanel)
00692     EVT_MENU(wxID_ANY,  WxGUITextEditor::OnToolLeftClick)
00693     EVT_TOOL_RCLICKED(wxID_ANY,  WxGUITextEditor::OnToolRightClick)
00694     EVT_AUINOTEBOOK_PAGE_CLOSE(wxID_ANY, WxGUITextEditor::OnPageClose)
00695     END_EVENT_TABLE()
00696   //================================================================
00697     
00698 
00699 
00700 
00701   
00702   //================================================================
00703   WxGUITextEditorWindow::WxGUITextEditorWindow( wxWindow *parent, 
00704                                                     wxString title, 
00705                                                     wxSize size)
00706     : wxFrame((wxFrame *)parent, -1, title, wxDefaultPosition, size)
00707   {     
00708     
00709     
00710     wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
00711 
00712     mEditor = new WxGUITextEditor(this);
00713     sizer->Add(mEditor,1,wxGROW);
00714     
00715     //    WxGUICommand* com = new WxGUICommand(this,this);
00716     //    sizer->Add(com);
00717     
00718     SetSizer(sizer);
00719 
00720     // parent window of all bbtk windows will be a child of this
00721     Wx::SetTopWindowParent(this);
00722     // Add the method OnWxSignal as a Wx::Signal observer 
00723     //bbtkAddWxSignalObserver(WxGUITextEditorWindow::OnWxSignal);
00724     
00725    
00726     SetAutoLayout(true);
00727     Layout();
00728   }
00729   //================================================================
00730 
00731   //================================================================
00732   WxGUITextEditorWindow::~WxGUITextEditorWindow()
00733   {
00734   }
00735   //================================================================
00736 
00737 
00738 } // namespace bbtk
00739 
00740 
00741 #endif //_USE_WXWIDGETS_

Generated on Wed Nov 12 11:37:08 2008 for BBTK by  doxygen 1.5.6