53 #include <wx/toolbar.h>
68 m_Persistent(persistent)
75 m_Persistent(
orig.m_Persistent)
82 return m_Id ==
orig.m_Id;
107 size_t pos1 = s.find(
'(');
108 if (pos1 == string::npos) {
111 size_t pos2 = s.find(
')');
112 if (pos2 == string::npos) {
116 string s2 = s.substr(pos1+1, (pos2 - pos1)-1);
129 m_Persistent = ! s.empty();
202 m_MenuListener(
NULL),
203 m_FrameWindow(frame),
205 m_ActiveClient(
NULL),
206 m_DragDockPanel(
NULL),
209 SetSizer(
new wxBoxSizer(wxVERTICAL));
211 wxAuiDockArt* dock_art = m_AuiManager.GetArtProvider();
212 dock_art->SetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE, 0);
239 const wxPoint& pos,
const wxSize&
size)
241 bool res = wxPanel::Create(parent,
id, pos,
size, wxBORDER_NONE,
wxT(
"window_manager"));
255 GetSizer()->Add(dock_cont, 1, wxEXPAND);
259 GetSizer()->Add(cont, 0, wxEXPAND);
306 if (!
client.IsADialog()) {
311 wxWindow* wnd =
client.GetWindow();
424 wxWindow* win =
dynamic_cast<wxWindow*
>(&panel);
469 for(
size_t i = 0;
i < clients.size();
i++ ) {
490 TClients::iterator it =
510 ERR_POST(
"CWindowManager::x_CloseClient() - client not registred, cannot close");
532 clients.push_back(&
client);
592 wxAuiPaneInfo pane_info;
594 wxString name = toolbar->GetName();
595 pane_info.Name(name);
596 pane_info.Caption(name);
598 pane_info.ToolbarPane().Top();
599 pane_info.TopDockable(
true)
601 .RightDockable(
false)
602 .BottomDockable(
false);
603 pane_info.Resizable(
false);
604 pane_info.DestroyOnClose(
true);
616 wxWindow* toolbar = pane.window;
685 if( ! m_Menu.get()) {
693 x_UpdateWindowsMenu(*m_Menu);
696 if (m_ActiveClient) {
697 const wxMenu* client_root = m_ActiveClient->GetMenu();
700 Merge(*m_Menu, *client_root);
725 }
else if(index == 10) {
736 static wxString sWindow(
wxT(
"&Window"));
739 wxMenu* win_menu = win_item ? win_item->GetSubMenu() :
NULL;
741 if(win_menu ==
NULL) {
743 win_menu =
new wxMenu(sWindow);
744 root_menu.Append(
wxID_ANY, win_menu->GetTitle(), win_menu);
747 wxMenuItemList& items = win_menu->GetMenuItems();
748 for(wxMenuItemList::compatibility_iterator it = items.GetFirst();
750 wxMenuItem* sub_item = it->GetData();
752 wxMenuItemList::compatibility_iterator it_next = it->GetNext();
754 if(sub_item->GetKind() == wxITEM_NORMAL) {
757 win_menu->Delete(sub_item);
785 for (wxWindow* w = new_focus; w !=
NULL && w !=
this; w = w->GetParent()) {
824 int cmd =
event.GetId();
875 switch(event.GetId()) {
913 clients.push_back(&
client);
966 static int frameId = 1;
981 wxWindow* window =
client.GetWindow();
982 if( !window )
return;
990 wxWindow* parent = panel->GetParent();
1007 return client_handler->
Send(evt, disp_how, pool);
1019 static wxEventType inEvent = wxEVT_NULL;
1020 if( inEvent == event.GetEventType() ){
1023 inEvent =
event.GetEventType();
1027 if( event.IsCommandEvent() ){
1028 wxEventType
type =
event.GetEventType();
1037 res =
handler->ProcessEvent( event );
1042 res = TParent::ProcessEvent( event );
1045 inEvent = wxEVT_NULL;
1107 wxPoint pt = evt.GetPosition();
1111 if ( ! evt.LeftIsDown()) {
1122 wxPoint pt = evt.GetPosition();
1140 wxPoint pt = ::wxGetMousePosition();
1151 wxPoint sc_mouse_pos = ClientToScreen(mouse_pos);
1160 wxPoint sc_mouse_pos = ClientToScreen(mouse_pos);
1181 wxPoint sc_mouse_pos = ClientToScreen(mouse_pos);
virtual void SetRegistryPath(const string &path)
CDockContainer is a window that hosts docked windows.
CDockManager CDockManager sends requests to Window Manager, Window Manager makes decisions about dele...
objects::CUser_object * SaveLayout()
produces Memento describing the current window layout (including all clients)
void Restore(IWMClient &client)
void MoveToMainTab(IWMClient &client)
moves the given client into the Main Tab Control ("Reset")
void OnBeginDrag(IDockableWindow &dockable, const wxPoint &sc_mouse_pos)
wxFrame * MoveToFloatingFrame(IWMClient &client)
void AddToDefaultLocation(IWMClient &client, bool bFloat)
CDockContainer * GetMainContainer()
CMinPanelContainer * GetMinPanelContainer()
bool OnDrag(IDockableWindow &dockable, const wxPoint &sc_mouse_pos)
void Remove(IWMClient &client)
void LoadLayout(const objects::CUser_object &object, IWMClientFactory &factory)
creates a new window layout based on the given Memento instantiates the clients as needed using the g...
void ActivateClients(TClients &clients)
void OnEndDrag(IDockableWindow &dockable, EDragResult result, const wxPoint &sc_mouse_pos)
bool IsInMainTab(IWMClient &client) const
void Minimize(IWMClient &client)
void SetKeyboardHook(wxFrame *frame)
void RaiseFloatingInZOrder()
bool IsMinimized(IWMClient &client) const
bool IsFloating(IWMClient &client) const
void ApplyLayout(const objects::CUser_object &object)
CDockNotebook - an extended version of wxAuiNotebook capable of working with Dock Manager and Window ...
void RefreshPageByWindow(wxWindow *page)
CDockPanel - a container with a title bar (caption) hosting a single client window (IWMClient).
virtual void FinishDrag()
CEvent - generic event implementation TODO TODO - Attachments.
static string MakeKey(const string §ion, const string &key, const string &delim=CGuiRegistry::kDecimalDot)
create a key from a section and a subkey
class CRgbaColor provides a simple abstraction for managing colors.
CUICommandRegistry is a centralized registry where all application commands should be registered.
static CUICommandRegistry & GetInstance()
the main instance associated with the application
wxMenu * CreateMenu(const SwxMenuItemRec *items)
create a menu from a static definition (see WX_*_MENU macros)
vector< IWMClient * > m_Clients
void GetClients(vector< IWMClient * > &clients)
CWindowManagerEvent(EEventType type, IWMClient *client)
CWindowManagerEvent.
CWindowManager - component controlling windowing of client windows.
void x_RemoveClient(IWMClient &client)
bool HasToolBar(const string &name)
bool CloseClient(IWMClient &client)
vector< IWMClient * > TClients
virtual bool Dispatch(CEvent *evt, EDispatch disp_how, int pool)
Dispatches an event to the listeners (but does not handle it).
void Minimize(IWMClient &client)
TClients m_Clients
the collection of registered Client
wxAuiManager m_AuiManager
wxAuiManager is required for CNotebook
IWMClient * x_GetActiveClientByWindow(wxWindow *widget)
static void RegisterImageAliases(wxFileArtProvider &provider)
registers graphical resources used by Window Manager
void DeleteToolBar(const string &name)
virtual void SetAdvisor(IWindowManagerAdvisor *advisor)
virtual void SetMenuListener(IWindowManagerMenuListener *listener)
void OnWindowCommand(wxCommandEvent &event)
virtual void x_OnBeginDrag(const wxPoint &mouse_pos)
bool OnCloseClientsRequest(const TClients &clients)
virtual ~CWindowManager()
void RegisterActiveClient(IWMClient &client)
bool IsRegistered(IWMClient &client) const
checks if the client in registered in the Window Manager
virtual void x_OnEndDrag(const wxPoint &mouse_pos, CDockManager::EDragResult result)
bool OnCaptionPanelCommand(CDockPanel &panel, TCmdID cmd)
TCmdToWindowMap m_CmdToWindow
bool x_RegisterClient(IWMClient &client)
virtual void SetRegistryPath(const string ®_path)
void UnRegisterActiveClient(IWMClient &client)
void x_HandlePanelCommand(IWMClient &client, int cmd)
void ActivateClient(IWMClient &client)
void OnCloseClientsRequestEvent(CEvent *evt)
void GetAllClients(TClients &clients)
void OnUpdateWindowCommand(wxUpdateUIEvent &event)
CDockManager * GetDockManager()
void OnShowWindowsDlg(wxCommandEvent &event)
virtual void x_UpdateWindowsMenu(wxMenu &root_menu)
void LoadLayout(const objects::CUser_object &layout, IWMClientFactory &factory)
bool IsInMainTab(IWMClient &client) const
void CloseClients(const TClients &clients)
unique_ptr< wxMenu > m_Menu
bool x_CloseClient(IWMClient &client)
void RaiseFloatingWindowsInZOrder()
CDockManager * m_DockManager
the Docking Manager associated with this Window Manager
void AddToolBar(wxAuiToolBar *toolbar)
virtual void x_ResetMenuBar()
wxFrame * MoveToFloatingFrame(IWMClient &client)
IWMClient * GetActiveClient()
void OnFocusChanged(wxWindow *new_focus)
bool IsFloating(IWMClient &client) const
void MoveToMainTab(IWMClient &client)
virtual bool ProcessEvent(wxEvent &event)
void ActivateClients(TClients &clients)
CDockPanel * m_DragDockPanel
void OnMouseCaptureLost(wxMouseCaptureLostEvent &event)
void OnActivateWindow(wxCommandEvent &event)
IWMClient * m_ActiveClient
belonging to focused IWMClient
void OnDockPanelStartDrag(CDockPanel *panel, const wxPoint &pt)
Called by CDockPanel to delegated DnD handling to Window Manager.
objects::CUser_object * SaveLayout()
virtual bool Create(wxWindow *parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize)
wxFrame * m_FrameWindow
main frame window hosting window manager
void OnLeftUp(wxMouseEvent &evt)
void ApplyLayout(const objects::CUser_object &layout)
wxFrame * GetFrameWindow()
void OnMotion(wxMouseEvent &evt)
IWindowManagerMenuListener * m_MenuListener
virtual bool AddClient(IWMClient &client, bool bFloat)
adds the client to the Main Tabbed Pane
void x_UpdateListener(IWMClient &client)
void RefreshClient(IWMClient &client)
void OnPostCommand(CEvent *evt)
handles an internal command posted to itself
virtual void x_UpdateActiveClient()
bool OnSetClientColor(CDockPanel &panel)
TWindowToClientMap m_WindowToClient
index wxWindow -> IWMClient
virtual void x_OnDrag(const wxPoint &mouse_pos)
string GetNewFloatingFrameTitle()
void Restore(IWMClient &client)
bool IsMinimized(IWMClient &client) const
string x_GetClientLabelForMenu(IWMClient &client)
IWindowManagerAdvisor * m_Advisor
Advisor is an external object that wants to customize the behavior of Window Manager by providing a c...
void OnUpdateWindowCommand_Client(wxUpdateUIEvent &event, IWMClient *client)
void SetWindowManager(CWindowManager *manager)
bool Create(wxWindow *parent, wxWindowID id=ID_WINDOWS_DLG, const wxString &caption=_("Windows"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxTAB_TRAVERSAL)
Creation.
IWMClientFactory - IWMClient factory.
CFingerprint identifies an instance of IWMClient and is used for labeling layout positions.
void FromPersistentString(const string &s)
CFingerprint()
IWMClient::CFingerprint.
bool operator==(const CFingerprint &orig) const
string AsPersistentString() const
returns a string for serialization (if persistent) or ""
const string GetId() const
IWClient - abstract Window Manager client.
virtual wxWindow * GetWindow()=0
returns a pointer to the wxWindow representing the client
virtual string GetFloatingFrameTitle(int index)=0
returns the title for the floating frames created by the Window Manager
virtual void OnClientClosed(IWMClient &client)=0
called after the client has been removed
virtual void OnCloseClientsRequest(const TClients &clients)=0
indicates that user requested closing the following clients (by pressing a "close" button,...
virtual void OnActiveClientChanged(IWMClient *new_active)=0
called when Active Client is changed (i.e. focus goes into another client)
virtual void OnClientAboutToClose(IWMClient &client)=0
called before removing the client
container_type::const_iterator const_iterator
const_iterator end() const
const_iterator find(const key_type &key) const
virtual void RegisterFileAlias(const wxArtID &anId, const wxArtClient &aClient, const wxSize &aSize, const wxString &aName, long aType=wxBITMAP_TYPE_ANY, int anIndex=-1)
void(*)(CSeq_entry_Handle seh, IWorkbench *wb, const CSerialObject &obj) handler
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
virtual void RemoveListener(CEventHandler *listener)
Remove a listener.
void Post(CRef< CEvent > evt, EDispatch disp_how=eDispatch_Default, int pool_name=ePool_Default)
Handles an event asynchronously (process and/or dispatch).
virtual bool Dispatch(CEvent *evt, EDispatch disp_how=eDispatch_Default, int pool_name=ePool_Default)
Dispatches an event to the listeners (but does not handle it).
#define END_EVENT_MAP()
Ends definition of Command Map.
#define BEGIN_EVENT_MAP(thisClass, baseClass)
Begins definition of Command Map for CEventHandler-derived class.
EDispatch
enum controlling dispatching strategies
virtual bool HasListener(CEventHandler *listener, int pool_name=ePool_Default) const
returns "true" if the given listener belongs to the specified pool
virtual bool Send(CEvent *evt, EDispatch disp_how=eDispatch_Default, int pool_name=ePool_Default)
Sends an event synchronously.
@ eCmdInvalid
marks menu end in array initializers
@ eDispatch_FirstHandler
dispatch to all handlers
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
static void TruncateSpacesInPlace(string &str, ETrunc where=eTrunc_Both)
Truncate spaces in a string (in-place)
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
static const char label[]
where boath are integers</td > n< td ></td > n</tr > n< tr > n< td > tse</td > n< td > optional</td > n< td > String</td > n< td class=\"description\"> TSE option controls what blob is orig
@ eCmdWindowXXXX
a range of automatically generated commands that will be used for activating windows
CMinPanelContainer::OnRestoreWindow EVT_UPDATE_UI_RANGE(eCmdCloseDockPanel, eCmdWindowRestore, CMinPanelContainer::OnUpdateWindowCommand) CMinPanelContainer
const struct ncbi::grid::netcache::search::fields::SIZE size
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
wxEVT_COMMAND_MENU_SELECTED
ViewerWindowBase::OnEditMenu ViewerWindowBase::OnJustification EVT_MENU(MID_SHOW_GEOM_VLTNS, ViewerWindowBase::OnShowGeomVltns) EVT_MENU(MID_FIND_PATTERN
static CNamedPipeClient * client
#define WX_DEFINE_MENU(name)
New macros for defining menus for use with CUICommandRegistry.
#define WX_SUBMENU(label)
#define WX_MENU_SEPARATOR_L(label)
#define WX_MENU_ITEM(cmd)
EVT_MENU_RANGE(eCmdCloseDockPanel, eCmdWindowRestore, CWindowManager::OnWindowCommand) EVT_UPDATE_UI_RANGE(eCmdCloseDockPanel
CWindowManager.
CWindowManager::OnUpdateWindowCommand ON_EVENT(CWindowManagerEvent, CWindowManagerEvent::ePostCommand, &CWindowManager::OnPostCommand) ON_EVENT(CWindowManagerEvent
CEventHandler map.
static const int kMaxRecentItems
string GenerateWinItemPrefix(int index)
static const int kMaxClientLabel
max number of characters in the client labels shown in popups
void Merge(wxMenu &menu_1, const wxMenu &menu_2)
merges all items form menu_2 into menu_1, preserving the structure if possible
wxString ToWxString(const string &s)
wxMenuItem * FindSubItem(wxMenu &menu, const wxString &text)
Find a subitem of the given menu by text.
bool NcbiChooseColor(wxWindow *parent, CRgbaColor &color)