44 #include <wx/stattext.h>
45 #include <wx/bmpbuttn.h>
47 #include <wx/bitmap.h>
48 #include <wx/dcclient.h>
49 #include <wx/settings.h>
50 #include <wx/artprov.h>
51 #include <wx/dcbuffer.h>
59 #define ID_BTN_MENU 10101
60 #define ID_BTN_MINIMIZE 10102
61 #define ID_BTN_FLOAT 10103
62 #define ID_BTN_CLOSE 10104
104 : wxPanel(container,
wxID_ANY, wxDefaultPosition, wxSize(0, 0),
107 m_DockManager(manager),
108 m_DockContainer(container),
112 m_ShowingPopup(
false),
116 SetBackgroundStyle(wxBG_STYLE_PAINT);
126 wxSize wsize = wxPanel::ClientToWindowSize(
size);
134 long styles = GetWindowStyleFlag();
136 styles &= ~(wxBORDER_STATIC | wxBORDER_SIMPLE |
137 wxBORDER_RAISED | wxBORDER_THEME | wxBORDER_NONE);
140 SetWindowStyleFlag(styles);
150 ERR_POST(
"CDockPanel() destructor - CLIENT IS NOT NULL");
157 wxBoxSizer* sizer =
new wxBoxSizer(wxVERTICAL);
184 wxArtProvider::GetBitmap(
ToWxString(hover_icon)),
198 client_w->Reparent(
this);
199 GetSizer()->Add(client_w, 1, wxEXPAND);
218 client_w->Reparent(new_parent);
219 GetSizer()->Detach(client_w);
235 wxSize s = this->GetSize();
236 if (s.GetX() <= 0 || s.GetY() <= 0)
241 wxAutoBufferedPaintDC dc(
this);
243 dc.SetPen(*wxTRANSPARENT_PEN);
248 wxSystemColour sys_colour = focus ? wxSYS_COLOUR_ACTIVECAPTION : wxSYS_COLOUR_INACTIVECAPTION;
249 wxColor cl_back = wxSystemSettings::GetColour(sys_colour);
250 wxBrush brush(cl_back);
254 wxRect client_rc = GetClientRect();
257 rc.width = client_rc.width;
259 dc.DrawRectangle(rc);
287 int bttn_size = rc.height - y_off * 2;
289 wxBrush brush(wxColour(
color.GetRedUC(),
292 dc.DrawRectangle(pos_x, rc.y + y_off, bttn_size, bttn_size);
297 wxFontWeight
weight =
HasFocus() ? wxFONTWEIGHT_BOLD : wxFONTWEIGHT_NORMAL;
303 wxFont font(8, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL,
weight);
305 wxFont font(10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL,
weight);
310 wxColor cl_text = wxSystemSettings::GetColour(wxSYS_COLOUR_CAPTIONTEXT);
311 dc.SetTextForeground(cl_text);
315 int av_w = rc.x + rc.width - pos_x -
kTextOffX;
320 dc.GetTextExtent(s, &w, &h);
321 int pos_y = rc.y + (rc.height - h) / 2;
323 dc.DrawText(s, pos_x, pos_y);
330 static wxEventType inEvent = wxEVT_NULL;
331 if (inEvent == event.GetEventType())
333 inEvent =
event.GetEventType();
338 if(
m_Client && event.IsCommandEvent()) {
339 wxEventType
type =
event.GetEventType();
345 res =
handler->ProcessEvent(event);
348 wxUpdateUIEvent* ui_event =
dynamic_cast<wxUpdateUIEvent*
>(&event);
351 int cmd =
event.GetId();
361 res = TParent::ProcessEvent(event);
364 inEvent = wxEVT_NULL;
373 rc.y = GetClientRect().x;
396 const wxWindow* target;
405 wxWindow* win = wxWindow::FindFocus();
406 while( win && win != target ){
407 win = win->GetParent();
418 int selpage = notebook->GetSelection();
420 return (selpage != wxNOT_FOUND &&
422 selpage < (
int)notebook->GetPageCount() &&
423 notebook->GetPage( selpage ) ==
this);
436 PopupMenu(menu.get());
474 wxWindow* focus = evt.GetWindow();
476 string type =
typeid(*focus).
name();
517 wxPoint pt = evt.GetPosition();
529 wxPoint pt = evt.GetPosition();
533 if(evt.LeftIsDown()) {
534 int drag_x_threshold = wxSystemSettings::GetMetric(wxSYS_DRAG_X);
535 int drag_y_threshold = wxSystemSettings::GetMetric(wxSYS_DRAG_Y);
590 wxPoint pt = ScreenToClient(sc_mouse_pos);
604 bool ok = TParent::Layout();
CDockContainer is a window that hosts docked windows.
CDockManager & GetDockManager()
CDockManager CDockManager sends requests to Window Manager, Window Manager makes decisions about dele...
bool OnDockPanelCommand(CDockPanel &panel, TCmdID cmd)
CWindowManager & GetWindowManager()
wxFrame * MoveToFloatingFrame(IWMClient &client)
wxMenu * GetDockPanelMenu(CDockPanel &panel)
void OnCloseDockable(IDockableWindow &dockable)
void Minimize(IWMClient &client)
bool IsFloating(IWMClient &client) const
CDockNotebook - an extended version of wxAuiNotebook capable of working with Dock Manager and Window ...
CDockPanel - a container with a title bar (caption) hosting a single client window (IWMClient).
void OnLeftUp(wxMouseEvent &evt)
void OnPaint(wxPaintEvent &event)
virtual void x_CreateControls()
CDockManager * m_DockManager
virtual void x_SetClient(IWMClient &client)
void OnContextMenu(wxContextMenuEvent &event)
CDockContainer * m_DockContainer
virtual void FinishDrag()
void OnMenuButtonClick(wxCommandEvent &event)
void OnMouseCaptureLost(wxMouseCaptureLostEvent &event)
void OnLeftDown(wxMouseEvent &evt)
virtual bool HasFocus() const
virtual void SetDockContainer(CDockContainer *dock_cont)
virtual void MakeActive(bool flag)
virtual void UpdateButtons()
virtual void ShowBorder(bool show)
void OnMinimizeButtonClick(wxCommandEvent &event)
void OnMotion(wxMouseEvent &evt)
void OnCloseButtonClick(wxCommandEvent &event)
void RemoveClient(wxWindow *new_parent)
disconnect the client and re-parent it to the given window
virtual EDockEffect DropTest(const wxPoint &screen_pt, wxWindow *&target)
virtual void x_ShowContextMenu()
virtual wxWindow * x_CreateButton(TCmdID id, const string &icon, const string &hover_icon)
void OnSetFocus(wxFocusEvent &event)
virtual wxSize ClientToWindowSize(const wxSize &size) const
virtual void UpdateFocusState()
void OnFloatButtonClick(wxCommandEvent &event)
wxBoxSizer * m_CaptionSizer
wxSizerItem * m_CaptionItem
virtual bool ProcessEvent(wxEvent &event)
virtual void x_DrawClientElements(wxDC &dc, const wxRect &rc)
virtual CDockContainer * GetDockContainer()
void OnChildFocus(wxChildFocusEvent &evt)
CDockPanel(CDockContainer *container, CDockManager *manager, IWMClient *client, const wxString &name)
class CRgbaColor provides a simple abstraction for managing colors.
void OnFocusChanged(wxWindow *new_focus)
void OnDockPanelStartDrag(CDockPanel *panel, const wxPoint &pt)
Called by CDockPanel to delegated DnD handling to Window Manager.
IWClient - abstract Window Manager client.
virtual wxWindow * GetWindow()=0
returns a pointer to the wxWindow representing the client
virtual wxEvtHandler * GetCommandHandler()=0
returns a pointer to the command handler (for menu commands and updates)
virtual string GetClientLabel(IWMClient::ELabel ltype=IWMClient::eDefault) const =0
returns the client label (name) to be displayed in UI
virtual string GetIconAlias() const =0
returns an icon alias that can be used to retrieve the client's icon
void(*)(CSeq_entry_Handle seh, IWorkbench *wb, const CSerialObject &obj) handler
static const char * bounds[]
#define ID_BTN_MENU
CDockPanel.
static const int kTextOffX
const long kwxBorderStyle
static const int kIconOffX
static const int kIconOffY
thread_local unique_ptr< FtaMsgPost > bmp
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static const char label[]
const struct ncbi::grid::netcache::search::fields::SIZE size
wxEVT_COMMAND_MENU_SELECTED
static CNamedPipeClient * client
void SetFocus(CRef< objects::CSeq_entry > entry)
wxString ToWxString(const string &s)
wxString TruncateText(wxDC &dc, const wxString &s, int w, Ewx_Truncate trunc=ewxTruncate_Ellipsis)
truncates given string so that its length is less or equal "w" "trunc" controls truncation,...