#include #include #include // Icons #include "icons/accept.xpm" #include "icons/add.xpm" #include "icons/folder-down.xpm" #include "icons/page-down.xpm" #include "icons/remove.xpm" #include "icons/help.xpm" #include namespace creaImageIO { //====================================================================== // The ids of the different tools enum { TOOL_ADDFILE_ID = 1, TOOL_ADDDIR_ID = 2, TOOL_REMOVE_ID = 3, TOOL_HELP_ID = 4 }; //====================================================================== //================================================================ // const int icon_number = 6; // Icon ids typedef enum { Icon_accept, Icon_add, Icon_folder_down, Icon_page_down, Icon_remove, Icon_help } icon_id; //================================================================ //================================================================ /* const icon_id Icon[5] = { Icon_Database, Icon_Patient, Icon_Study, Icon_Series, Icon_Image }; */ //================================================================ //====================================================================== // CTor WxGimmickView::WxGimmickView(Gimmick* gimmick, wxWindow *parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, int image_type, int number_of_threads) : wxPanel(parent,id,pos,size), GimmickView(gimmick) { GimmickDebugMessage(1,"WxGimmickView::WxGimmickView" <Add( mToolBar ,0, wxGROW ,0); // Split part below toolbar into notebook for views and panel // for preview, messages... mSplitter = new wxSplitterWindow( this , -1); // Notebook mNotebook = new wxNotebook(mSplitter, -1,wxDefaultPosition, wxDefaultSize, 0); // Create the views CreateTreeViews(); // Bottom panel mBottomPanel = new wxPanel(mSplitter,-1); // Splitting int hsize = size.GetHeight(); int bottom_minsize = 200; mSplitter->SetMinimumPaneSize( bottom_minsize ); mSplitter->SplitHorizontally( mNotebook, mBottomPanel, hsize - bottom_minsize); sizer->Add( mSplitter,1,wxGROW ,0); SetSizer( sizer ); SetAutoLayout(true); Layout(); } //====================================================================== //====================================================================== /// Destructor WxGimmickView::~WxGimmickView() { GimmickDebugMessage(1,"WxGimmickView::~WxGimmickView" <AddTool( TOOL_ADDFILE_ID, _T("Add file"), mIcon->GetBitmap(Icon_page_down), _T("Add file") ); mToolAddDir = mToolBar->AddTool( TOOL_ADDDIR_ID, _T("Add folder"), mIcon->GetBitmap(Icon_folder_down), _T("Add folder") ); mToolRemove = mToolBar->AddTool( TOOL_REMOVE_ID, _T("Remove selected"), mIcon->GetBitmap(Icon_remove), _T("Remove selected") ); mToolHelp = mToolBar->AddTool( TOOL_HELP_ID, _T("Help"), mIcon->GetBitmap(Icon_help), _T("Help") ); //const wxBitmap& bitmap1, const wxString& shortHelpString = "", wxItemKind kind = wxITEM_NORMAL) mToolBar->Realize(); } //====================================================================== //====================================================================== /// Create the tree view for TreeHandler provided void WxGimmickView::CreateTreeView( TreeHandler* h) { std::string name(h->GetTree().GetAttribute("Name")); GimmickMessage(2,"Creating the tree view for '"<< name<<"'"<AddPage( view, crea::std2wx(name) ); } //====================================================================== //================================================= void WxGimmickView::CreateIconList() { // Size of the icons; int size = 48; wxIcon icons[20]; // should correspond to Icon_xxx enum icons[Icon_accept] = wxIcon(accept_xpm); icons[Icon_add] = wxIcon(add_xpm); icons[Icon_folder_down] = wxIcon(folder_down_xpm); icons[Icon_page_down] = wxIcon(page_down_xpm); icons[Icon_remove] = wxIcon(remove_xpm); icons[Icon_help] = wxIcon(help_xpm); // unsigned int NbIcons = 8; // Make an image list containing small icons mIcon = new wxImageList(size,size,true); // Make all icons the same size = size of the first one int sizeOrig = icons[0].GetWidth(); for ( size_t i = 0; i < icon_number; i++ ) { if ( size == sizeOrig ) { mIcon->Add(icons[i]); } else { mIcon->Add(wxBitmap(wxBitmap(icons[i]).ConvertToImage().Rescale(size, size))); } } } //================================================= } // EO namespace creaImageIO