m_SepLineVertOffset(2),
73m_SeparateGroups(
true),
74m_SingleColumn(
false),
75m_SizePolicy(eAdjustVertSize)
81 constwxSize&
size,
longstyle,
constwxString& name)
91SetBackgroundStyle(wxBG_STYLE_CUSTOM);
93SetScrollRate( 16, 16 );
97wxColour cl_back = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
98SetBackgroundColour(cl_back);
163 for(
size_t i= 0;
i< indexes.size();
i++ ) {
175 if(i_focused >= 0) {
177 m_Items[i_focused]->GetRect(rc_foc);
180 TIndexcol_start_index = -1, to_index = -1;
185 if(rc.GetLeft() >= rc_foc.GetRight()) {
186col_start_index =
i;
193 for(
TIndex i= i_focused;
i>= 0;
i-- ) {
195 if(rc.GetRight() < rc_foc.GetLeft() && rc.GetTop() <= rc_foc.GetTop()) {
196col_start_index =
i;
202 if(col_start_index >= 0) {
205to_index = col_start_index;
207 for( ; to_index < (
TIndex)
m_Items.size(); to_index++ ) {
208 m_Items[to_index]->GetRect(rc);
209 if(! (rc.GetTop() > rc_foc.GetBottom() || rc.GetBottom() < rc_foc.GetTop())) {
213 if(to_index == (
int)
m_Items.size()) {
218 if(to_index != -1) {
228wxAutoBufferedPaintDC dc(
this);
231wxRect rc = GetClientSize();
232wxBrush brush(GetBackgroundColour());
234dc.SetPen(*wxTRANSPARENT_PEN);
235dc.DrawRectangle(rc.x, rc.y, rc.width, rc.height);
245dc.SetDeviceOrigin(0, 0);
251 boolfocused = (wxWindow::FindFocus() ==
this);
253wxSystemColour
type= focused ? wxSYS_COLOUR_HIGHLIGHTTEXT : wxSYS_COLOUR_WINDOWTEXT;
257 type= focused ? wxSYS_COLOUR_HIGHLIGHT : wxSYS_COLOUR_BTNFACE;
270 intorigin_x = 0, origin_y = 0, size_x, size_y;
271GetViewStart(&origin_x, &origin_y);
272GetVirtualSize(&size_x, &size_y);
275 intstart = step * (
int) (floor(
double(origin_x + step) / step));
276 intend = step * (
int) (floor(
double(origin_x + size_x - 1) / step));
281wxRect rc = GetClientRect();
283 inty1 = rc.y + off_y;
284 intline_h = rc.height - 2 * off_y;
289dc.SetPen(*wxTRANSPARENT_PEN);
291 for(
intxx = start; xx <= end; xx += step ) {
292dc.DrawRectangle(xx, y1, sep_w, line_h);
344 boolvalid = (index >=0 && index <= (
TIndex)
m_Items.size());
365SetCursor(wxCursor(wxCURSOR_DEFAULT));
393SetCursor(wxCursor(wxCURSOR_DEFAULT));
406 for(
size_t i= 0;
i<
m_Items.size();
i++ ) {
443 intfocused = (wxWindow::FindFocus() ==
this) ?
446 intorigin_x, origin_y;
447GetViewStart(&origin_x, &origin_y);
461wxSize old_virt_size = GetVirtualSize();
462wxSize sz = GetClientSize();
465 if(new_virt_sz != old_virt_size) {
466SetVirtualSize(new_virt_sz);
478 intmax_y = height - 1;
486wxClientDC dc(
this);
488 for(
size_t i= 0;
i<
m_Items.size();
i++ ) {
494 boolcolumn_full = (item_y + real_h > max_y) && (item_y > 0);
509rc.SetSize(wxSize(item_w, real_h));
515sz.y =
max(sz.y, item_y + real_h);
525wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED,
GetId());
526 event.SetEventObject(
this);
527 event.SetInt(index);
529(void)GetEventHandler()->ProcessEvent(event);
542 for(
TIndex i= start;
i<= end;
i++ ) {
552wxPoint pos = GetPosition();
553 intorigin_x, origin_y;
554GetViewStart(&origin_x, &origin_y);
556rc_draw.Offset(pos.x - origin_x, pos.y - origin_x );
558 if( ! rc_draw.IsEmpty()) {
566CalcUnscrolledPosition(x, y, &x, &y);
569 for(
size_t i= 0;
i<
m_Items.size();
i++ ){
571 if( rc.Contains( x, y ) ){
586wxSize sz = GetSize();
587 intorigin_x, origin_y;
588GetViewStart(&origin_x, &origin_y);
590 if(rc.GetLeft() < origin_x) {
591origin_x = rc.GetLeft();
592}
else if(rc.GetRight() >= origin_x + sz.x) {
593origin_y = rc.GetRight() - sz.x + 1;
595 if(rc.GetTop() < origin_y) {
596origin_y = rc.GetTop();
597}
else if(rc.GetBottom() >= origin_y + sz.y) {
598origin_y = rc.GetBottom() - sz.y + 1;
600Scroll(origin_x, origin_y);
630 LOG_POST(
"CMapControl::OnContextMenu()");
639wxPoint ms_pos =
event.GetPosition();
641CalcUnscrolledPosition(ms_pos.x, ms_pos.y, &ms_pos.x, &ms_pos.y);
654wxPoint ms_pos =
event.GetPosition();
658CalcUnscrolledPosition(ms_pos.x, ms_pos.y, &ms_pos.x, &ms_pos.y);
676 intshift =
event.GetWheelRotation() /
event.GetWheelDelta();
678 intorigin_x, origin_y;
679GetViewStart(&origin_x, &origin_y);
681 intold_origin_x = origin_x;
682 intold_origin_y = origin_y;
691 for(
size_t i= 0;
i<
m_Items.size();
i++ ) {
693 if(rc.GetBottom() > y) {
698origin_y += rc_next.GetTop();
705 for(
size_t i=
m_Items.size();
i> 0; ) {
708 if(rc.GetTop() < y) {
709origin_y = rc.GetTop();
732 if(origin_x != old_origin_x || origin_y != old_origin_y) {
733Scroll(origin_x, origin_y);
751CalcUnscrolledPosition(ms_pos.x, ms_pos.y, &ms_pos.x, &ms_pos.y);
763SetCursor(wxCursor(wxCURSOR_HAND));
774SetCursor(wxCursor(wxCURSOR_DEFAULT));
791 int key=
event.GetKeyCode();
801 caseWXK_NUMPAD_ENTER:
806 if(!event.ShiftDown())
808 if(event.ControlDown())
809 flags|= wxNavigationKeyEvent::WinChange ;
bool IsForward(ENa_strand s)
static EGUIState wxGetSelectState(const wxMouseEvent &event)
CMapControl owns all its items.
void OnPaint(wxPaintEvent &event)
virtual void AddItem(IwxMapItem *item)
void OnSize(wxSizeEvent &event)
SwxMapItemProperties m_ItemProps
virtual void SetColumnWidth(int w, bool update=true)
virtual void x_InitItemProperties()
virtual void DeleteAllItems()
@ eAdjustVertSize
widget adjusts its model space so that its vertical size fits into available viewport
@ eAdjustHorzSize
widget adjusts its model space so that its horizontal size fits into available viewport
virtual int x_GetIndexByWindowPos(int win_x, int win_y, bool clip=false)
virtual void x_DoDefaultActionOnSelected()
virtual wxSize x_CalculateLayout(int width, int height)
void OnContextMenu(wxContextMenuEvent &event)
virtual void x_DrawSeparationLines(wxDC &dc)
CIRef< IwxMapItem > TItemRef
void OnMouseWheel(wxMouseEvent &event)
virtual void x_UpdateItems(TIndexVector &indexes)
CMapControl(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxHSCROLL|wxVSCROLL|wxTAB_TRAVERSAL|wxWANTS_CHARS|wxFULL_REPAINT_ON_RESIZE, const wxString &name=wxT("mapcontrol"))
void OnMouseLeave(wxMouseEvent &event)
virtual void InsertItem(TIndex index, IwxMapItem *item)
virtual void SetMaxItemHeight(int h, bool update=true)
void OnMouseMove(wxMouseEvent &event)
virtual void x_DrawItemsRange(wxDC &dc, TIndex from, TIndex to)
bool x_IsUpdatesLocked() const
virtual void LockUpdates(bool lock=true)
block layout and repainting until control is unlocked
void OnKeyDown(wxKeyEvent &event)
void x_HorzMoveSelectionBy(int shift, CGUIEvent::EGUIState state)
void OnMouseDown(wxMouseEvent &evt)
void x_UpdateHotItem(wxPoint ms_pos)
virtual void x_SendSelectionEvent(TIndex index)
void OnLeftDoubleClick(wxMouseEvent &evt)
virtual TIndex GetSelectedIndex() const
virtual void x_MakeVisible(TIndex index)
virtual TItemRef GetItem(TIndex index)
virtual TIndex GetItemsCount() const
TItemRef x_GetItem(TIndex index)
void OnMouseUp(wxMouseEvent &evt)
virtual SwxMapItemProperties & GetMapItemProperties()
virtual void x_UpdateItemsRange(TIndex start, TIndex end)
virtual TIndex GetItemIndex(IwxMapItem &item) const
virtual void DeleteItem(TIndex index)
void OnFocusChanged(wxFocusEvent &event)
virtual TIndex GetFocusedIndex() const
virtual void GetSelectedIndexes(TIndexVector &indexes) const
virtual TIndex GetSelectedIndex() const
bool x_InsertItem(TIndex index, const TItemHandle &item, bool update)
virtual void x_SelectTo(TIndex index)
virtual int GetItemState(TIndex index) const
Items state and selection.
void MoveSelectionBy(int shift, CGUIEvent::EGUIState state)
void OnMouseDown(wxMouseEvent &event)
Event handling.
bool x_DeleteItem(TIndex index, bool update=true)
vector< TIndex > TIndexVector
bool x_AssertIndexValid(TIndex index) const
Protected API -.
void OnKeyDown(wxKeyEvent &event)
IwxMapItem Abstarct item of the Map Control.
virtual void OnMouseDown(const wxPoint &ms_pos)=0
virtual void Layout(wxDC &dc, SwxMapItemProperties &props)=0
virtual bool IsGroupSeparator() const =0
virtual int PreferredHeight(wxDC &dc, SwxMapItemProperties &props, int width)=0
virtual void SetRect(const wxRect &rc)=0
virtual void OnLeftDoubleClick(const wxPoint &ms_pos)=0
virtual void OnDefaultAction()=0
a callback to perform a default action associated with the item
virtual bool OnHotTrack(const wxPoint &ms_pos)=0
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
const CSeq_id & GetId(const CSeq_loc &loc, CScope *scope)
If all CSeq_ids embedded in CSeq_loc refer to the same CBioseq, returns the first CSeq_id found,...
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
unsigned int
A callback function used to compare two keys in a database.
static const int kMaxItemH
default column width
static const int kDefaultColumnW
CMapControl.
const struct ncbi::grid::netcache::search::fields::SIZE size
const struct ncbi::grid::netcache::search::fields::KEY key
int m_ItemOffsetY
horz space between an item and separation line or border
int m_ItemOffsetX
vertical space between separation lines and the borders
bool m_SeparateGroups
vert space around an item
int m_SepLineWidth
max item height
int m_SepLineVertOffset
width of the separation line between the columns
SwxMapItemProperties - properties of the IwxMapItem.
void SetFocus(CRef< objects::CSeq_entry > entry)
wxColour GetAverage(const wxColor &c1, const wxColor &c2, double ratio)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4