BEGIN_EVENT_TABLE(
CGrid, wxGrid )
109 constwxString& name)
110: wxGrid(parent,
id, pos,
size, style, name),
111m_ImageList( 16, 16 ), m_CurLink(), m_Timer(this)
113m_ImageList.Add( wxBitmap(
up_xpm) );
114m_ImageList.Add( wxBitmap(
down_xpm) );
122 if(col != GetSortingColumn() || m_nativeColumnLabels) {
123wxGrid::DrawColLabel( dc, col );
127 if( GetColWidth(col) <= 0 || m_colLabelHeight <= 0 )
130 intimgWidth = 0, imgHeight = 0, imageIndex = (IsSortOrderAscending() ? 0 : 1);
131 m_ImageList.GetSize(imageIndex, imgWidth, imgHeight);
133 intcolLeft = GetColLeft(col);
134wxRect rect(colLeft, 0, GetColWidth(col), m_colLabelHeight);
136wxGridCellAttrProvider *
const 137attrProvider = m_table ? m_table->GetAttrProvider() :
NULL;
139wxGridColumnHeaderRendererDefault defaultRenderer;
141 constwxGridColumnHeaderRenderer&
142rend = attrProvider ? attrProvider->GetColumnHeaderRenderer(col)
147wxDCBrushChanger setBrush(dc, GetGridColLabelWindow()->GetBackgroundColour());
148dc.DrawRectangle(rect);
150rend.DrawBorder(*
this, dc, rect);
153GetColLabelAlignment(&hAlign, &vAlign);
154 const intorient = GetColLabelTextOrientation();
156wxString labelText = GetColLabelValue(col);
157wxSize labelSize = dc.GetTextExtent(labelText);
158labelSize.x += imgWidth;
160 if(labelSize.GetWidth() <= rect.GetWidth()) {
161 if(hAlign&wxALIGN_RIGHT) {
162rect.x = rect.GetRight() - labelSize.GetWidth();
164 else if(hAlign&wxALIGN_CENTER_HORIZONTAL) {
165rect.x += (rect.GetWidth() - labelSize.GetWidth())/2;
167rect.SetWidth(labelSize.GetWidth());
171rect.x, (m_colLabelHeight - 4 - imgHeight)/2 + 2,
172wxIMAGELIST_DRAW_TRANSPARENT);
175rect.width -= imgWidth;
177 if(rect.width > 0) {
178rend.DrawLabel(*
this, dc, GetColLabelValue(col), rect, wxALIGN_LEFT, vAlign, orient);
184 staticwxTipWindow* s_tipWindow =
NULL;
188s_tipWindow->SetTipWindowPtr(
NULL);
189s_tipWindow->Close();
196 if(IsCellEditControlShown())
202 if(
row< 0 && col < 0)
205wxRect rect = CellToRect(
row, col);
206wxString
value= GetCellValue(
row, col);
207 if(
value.IsEmpty())
210wxGridCellAttr* attr = GetCellAttr(
row, col);
211wxGridCellRenderer* renderer = attr->GetRenderer(
this,
row, col);
213wxWindow* gridWindow = GetGridWindow();
216wxClientDC dc(gridWindow);
217wxSize
size= renderer->GetBestSize(*
this, *attr, dc,
row, col);
218 if(
size.GetWidth() <= rect.GetWidth() &&
219 size.GetHeight() <= rect.GetHeight()) {
226gridWindow->SetCursor( *wxSTANDARD_CURSOR );
227wxPoint posScrolled = CalcScrolledPosition(rect.GetTopLeft());
228wxRect screenRect(gridWindow->ClientToScreen(posScrolled), rect.GetSize());
229s_tipWindow =
newwxTipWindow(GetGridWindow(),
value, 1000, &s_tipWindow, &screenRect);
242 if(event.Dragging()) {
247 constwxPoint pos = CalcUnscrolledPosition(event.GetPosition());
249wxGridCellCoords coords = XYToCell(pos);
251 int row= coords.GetRow();
252 intcol = coords.GetCol();
254 if(
row< 0 || col < 0 ) {
278 m_Timer.Start(500, wxTIMER_ONE_SHOT);
289wxHyperlinkEvent hoverEvent(
this,
GetId(), url);
290hoverEvent.SetEventType(wxEVT_COMMAND_HYPERLINK_HOVER);
291wxPostEvent(
this, hoverEvent);
294GetGridWindow()->SetCursor( wxCursor(wxCURSOR_HAND) );
297GetGridWindow()->SetCursor( *wxSTANDARD_CURSOR );
307 constwxPoint pos = CalcUnscrolledPosition(event.GetPosition());
309wxGridCellCoords coords = XYToCell(pos);
311 int row= coords.GetRow();
312 intcol = coords.GetCol();
314 if(
row< 0 || col < 0 ) {
323wxString url = link->
GetURL();
325wxHyperlinkEvent linkEvent(
this,
GetId(), url);
326 if(!GetEventHandler()->ProcessEvent(linkEvent))
328 if(!wxLaunchDefaultBrowser(url))
330wxLogWarning(
wxT(
"Could not launch the default browser with url '%s' !"), url.c_str());
342 intselRow = evt.GetRow();
343 if(selRow > 0 && evt.ControlDown()) {
344wxArrayInt selRows = GetSelectedRows();
345 if(find(selRows.begin(), selRows.end(), selRow) != selRows.end()) {
351 intselCol = evt.GetCol();
362 if((
size_t)selCol >= vis_columns.size())
369 if(newSort.first == curSort.first) {
376vector<size_t>::const_iterator it =
377find (vis_columns.begin(), vis_columns.end(), newSort.first);
379SetSortingColumn (
static_cast<int>((it == vis_columns.end()) ? -1 : it - vis_columns.begin()),
397wxArrayInt sel_rows = GetSelectedRows();
402vector<size_t> selected_idx;
403 for(
i=0;
i<sel_rows.size(); ++
i) {
405selected_idx.push_back(row_idx);
430 for(
i=0;
i<selected_idx.size(); ++
i) {
431 size_tsorted_idx = gridAdapter->
GetCurrentRow(selected_idx[
i]);
432 if(sorted_idx != (
size_t)-1)
433SelectRow(
static_cast<int>(sorted_idx),
true);
459 if(evt.GetCol() < 0)
468vis_set.
insert(vis_columns.begin(), vis_columns.end());
480PopupMenu(&menu, evt.GetPosition());
494 if(vis_columns.size() == 1 && gridAdapter->
IsColumnShown(col))
509dlgFilterColumns.ShowModal();
std::invoke_result< _Fty, ICanceled & >::type GUI_AsyncExec(_Fty &&_Fnarg, const wxString &msg=wxT("Accessing network..."))
const CHyperlink * HitTest(const wxPoint &pt) const
void SetGridAdapter(IGridTableAdapter *gridAdapter)
const CCellHyperlinks * GetLink(int col, int row) const
virtual void DrawColLabel(wxDC &dc, int col)
CGridHyperlinks m_HyperLinks
const CCellHyperlinks::CHyperlink * m_CurLink
void OnShowHideColumn(wxCommandEvent &event)
void x_ShowTooltip(bool show)
void OnLeftDown(wxMouseEvent &event)
void OnFilterColumns(wxCommandEvent &event)
wxGridCellCoords m_MouseOverCell
void OnMouseMove(wxMouseEvent &event)
void OnTimer(wxTimerEvent &event)
void OnGridLabelLeftClick(wxGridEvent &evt)
void OnGridLabelRightClick(wxGridEvent &evt)
static void StripHtml(wxString &text)
Interface for testing cancellation request in a long lasting operation.
virtual size_t GetOriginalRow(size_t queryRow) const =0
virtual TSortColumn GetSortColumn() const =0
virtual bool IsColumnShown(size_t col) const =0
virtual size_t GetCurrentRow(size_t queryRow) const =0
virtual void ShowColumn(size_t col, bool show)=0
virtual void SortByColumn(TSortColumn sortColumn)=0
virtual vector< size_t > GetVisibleColumns() const
pair< size_t, ESort > TSortColumn
virtual string GetColumnLabel(size_t col) const =0
virtual size_t GetColsCount() const =0
iterator_bool insert(const value_type &val)
const_iterator find(const key_type &key) const
const_iterator end() const
static const char * down_xpm[]
#define ID_FIRST_COLUMN_MENU
static const char * up_xpm[]
#define MAX_COLUMNS_IN_MENU
#define ID_FILTER_COLUMNS_MENU
wxDEFINE_EVENT(wxEVT_COMMAND_HYPERLINK_HOVER, wxHyperlinkEvent)
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.
static const char label[]
const struct ncbi::grid::netcache::search::fields::SIZE size
const GenericPointer< typename T::ValueType > T2 value
EVT_MENU_RANGE(MID_SHOW_TITLES, MID_HIDE_TITLES, ViewerWindowBase::OnTitleView) EVT_MENU_RANGE(MID_ENABLE_EDIT
ViewerWindowBase::OnEditMenu ViewerWindowBase::OnJustification EVT_MENU(MID_SHOW_GEOM_VLTNS, ViewerWindowBase::OnShowGeomVltns) EVT_MENU(MID_FIND_PATTERN
#define row(bind, expected)
wxString ToWxString(const string &s)
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