58 const wxPoint& pos = wxDefaultPosition,
59 const wxSize&
size = wxDefaultSize
70 void OnPaint(wxPaintEvent& event);
100 const wxPoint& pos = wxDefaultPosition,
101 const wxSize&
size = wxDefaultSize,
102 long style = wxHSCROLL | wxVSCROLL,
103 const wxString& name =
"scrolledWindow"
119 void OnPaint(wxPaintEvent& event);
135 void DrawCell(wxDC& dc,
unsigned int x,
unsigned int y,
unsigned int vsX,
unsigned int vsY,
bool redrawBackground);
142 void DrawLine(wxDC& dc,
unsigned int x1,
unsigned int y1,
unsigned int x2,
unsigned int y2);
144 unsigned int fromX,
unsigned int fromY,
unsigned int toX,
unsigned int toY,
unsigned int vsX,
unsigned int vsY);
145 void MoveRubberband(wxDC &dc,
unsigned int fromX,
unsigned int fromY,
146 unsigned int prevToX,
unsigned int prevToY,
unsigned int toX,
unsigned int toY,
unsigned int vsX,
unsigned int vsY);
148 unsigned int toX,
unsigned int toY,
unsigned int vsX,
unsigned int vsY);
150 DECLARE_EVENT_TABLE()
179 wxScrolledWindow(parent, -1, pos,
size, style, name),
183 currentBackgroundColor = *wxWHITE;
189 currentRubberbandColor = *wxRED;
241 #if defined(__WXMAC__)
242 static const int cellWidthSpacer = 2;
244 static const int cellWidthSpacer = 1;
248 dc.SetFont(wxNullFont);
255 dc.SetMapMode(wxMM_TEXT);
256 dc.GetTextExtent(
"A", &chW, &chH);
277 if (!
bitmap ||
bitmap->GetWidth() != GetClientSize().GetWidth() ||
278 bitmap->GetHeight() != GetClientSize().GetHeight()) {
280 bitmap =
new wxBitmap(GetClientSize().GetWidth(), GetClientSize().GetHeight());
284 memDC.SelectObject(*
bitmap);
287 updLeft, updRight, updTop, updBottom,
288 firstCellX, firstCellY,
289 lastCellX, lastCellY,
291 static int prevVsY = -1;
298 memDC.SetMapMode(wxMM_TEXT);
300 memDC.SetBackgroundMode(wxTRANSPARENT);
303 GetViewStart(&vsX, &vsY);
305 if (vsY != prevVsY) {
314 wxRegionIterator upd(GetUpdateRegion());
321 memDC.SetPen(*(wxThePenList->
323 memDC.SetBrush(*(wxTheBrushList->
325 memDC.DrawRectangle(upd.GetX(), upd.GetY(), upd.GetW(), upd.GetH());
334 updRight = updLeft + upd.GetW() - 1;
335 updBottom = updTop + upd.GetH() - 1;
356 for (y=firstCellY; y<=lastCellY; ++y) {
357 for (x=firstCellX; x<=lastCellX; ++x) {
358 DrawCell(memDC, x, y, vsX, vsY,
false);
366 wxPaintDC paintDC(
this);
367 paintDC.Blit(0, 0, GetClientSize().GetWidth(), GetClientSize().GetHeight(), &memDC, 0,0, wxCOPY);
372 unsigned int x,
unsigned int y,
unsigned int vsX,
unsigned int vsY,
bool redrawBackground)
375 wxColor
color, cellBackgroundColor;
376 bool drawBackground, drawChar;
385 if ((drawChar && drawBackground) || redrawBackground) {
386 if (drawChar && drawBackground) {
387 dc.SetPen(*(wxThePenList->FindOrCreatePen(cellBackgroundColor, 1, wxSOLID)));
388 dc.SetBrush(*(wxTheBrushList->FindOrCreateBrush(cellBackgroundColor, wxSOLID)));
396 if (!drawChar)
return;
399 dc.SetTextForeground(
color);
402 wxString
buf(character);
404 dc.GetTextExtent(
buf, &chW, &chH);
428 dc.DrawLine(x1, y1, x2, y2);
435 if (
i%4 == 0) dc.DrawLine(x1,
i, x1,
i + 2);
440 if (
i%4 == 0) dc.DrawLine(
i, y1,
i + 2, y1);
447 unsigned int toX,
unsigned int toY,
unsigned int vsX,
unsigned int vsY)
450 int minX, minY, maxX, maxY;
451 min_max((
int)fromX, (
int)toX, &minX, &maxX);
452 min_max((
int)fromY, (
int)toY, &minY, &maxY);
459 if (maxX < minX || maxY < minY)
467 DrawLine(dc, minX, minY, maxX, minY);
469 DrawLine(dc, maxX, minY, maxX, maxY);
471 DrawLine(dc, maxX, maxY, minX, maxY);
473 DrawLine(dc, minX, maxY, minX, minY);
479 unsigned int prevToX,
unsigned int prevToY,
unsigned int toX,
unsigned int toY,
unsigned int vsX,
unsigned int vsY)
483 if ((prevToX >= fromX && toX < fromX) ||
484 (prevToX < fromX && toX >= fromX) ||
485 (prevToY >= fromY && toY < fromY) ||
486 (prevToY < fromY && toY >= fromY)) {
494 if (toY != prevToY) {
501 if (fromX <= toX && toX < prevToX) {
504 }
else if (prevToX < toX && toX < fromX) {
508 for (
i=
a;
i<=
b; ++
i) {
510 DrawCell(dc,
i, prevToY, vsX, vsY,
true);
514 if (toX != prevToX) {
521 if (fromY <= toY && toY < prevToY) {
524 }
else if (prevToY < toY && toY < fromY) {
528 for (
i=
a;
i<=
b; ++
i) {
530 DrawCell(dc, prevToX,
i, vsX, vsY,
true);
540 unsigned int toX,
unsigned int toY,
unsigned int vsX,
unsigned int vsY)
564 wxMouseEvent fake(wxEVT_MOUSEWHEEL);
565 fake.m_wheelRotation = 0;
566 fake.m_wheelDelta = 120;
567 fake.m_linesPerAction = 3;
568 AddPendingEvent(fake);
575 static int prevMOX = -1, prevMOY = -1;
576 static bool dragging =
false;
579 prevAlignment =
NULL;
580 prevMOX = prevMOY = -1;
585 prevMOX = prevMOY = -1;
592 event.GetPosition(&mX, &mY);
596 GetViewStart(&vsX, &vsY);
599 static wxCoord windowMX = 0, windowMY = 0;
600 bool wheelEvent = (
event.GetEventType() == wxEVT_MOUSEWHEEL);
602 if (dragging || windowMX < 0 || windowMY < 0 ||
603 windowMX >= GetClientSize().GetWidth() || windowMY >= GetClientSize().GetHeight())
607 static int accumulatedRotation = 0;
608 accumulatedRotation -=
event.GetWheelRotation();
609 int nDeltas = accumulatedRotation /
event.GetWheelDelta();
611 accumulatedRotation -= nDeltas *
event.GetWheelDelta();
612 int toY = vsY + nDeltas *
event.GetLinesPerAction();
618 GetViewStart(&vsX, &vsY);
626 int cellX, cellY, MOX, MOY;
632 if (event.Leaving()) {
641 if (MOX != prevMOX || MOY != prevMOY)
651 cellY = vsY + GetClientSize().GetHeight() /
cellHeight;
653 cellX = vsX + GetClientSize().GetWidth() /
cellWidth;
656 if (cellX < 0) cellX = 0;
658 if (cellY < 0) cellY = 0;
664 static unsigned int fromX, fromY, prevToX, prevToY;
673 if (event.LeftDown()) {
676 unsigned int controls = 0;
679 if (event.MetaDown())
681 if (event.ControlDown())
689 prevToX = fromX = cellX;
690 prevToY = fromY = cellY;
693 TRACEMSG(
"drawing initial rubberband");
718 else if (dragging && (event.LeftUp() || event.Leaving() || event.Entering())) {
719 if (!event.LeftUp()) {
737 DrawCell(dc, fromX, fromY, vsX, vsY,
true);
738 if (cellX != (
int)fromX || cellY != (
int)fromY)
739 DrawCell(dc, cellX, cellY, vsX, vsY,
true);
759 ((
int)fromX < cellX) ? fromX : cellX,
760 ((
int)fromY < cellY) ? fromY : cellY,
761 (cellX > (
int)fromX) ? cellX : fromX,
762 (cellY > (
int)fromY) ? cellY : fromY);
769 else if (dragging && (cellX != (
int)prevToX || cellY != (
int)prevToY)) {
780 MoveRubberband(dc, fromX, fromY, prevToX, prevToY, cellX, cellY, vsX, vsY);
782 if (prevToX != fromX || prevToY != fromY)
783 DrawCell(dc, prevToX, prevToY, vsX, vsY,
true);
784 if (cellX != (
int)fromX || cellY != (
int)fromY) {
809 wxWindow(parent,
id, pos,
size, wxNO_BORDER),
811 cellHeight(0), maxTitleWidth(20)
813 currentBackgroundColor = *wxWHITE;
830 dc.SetMapMode(wxMM_TEXT);
844 dc.GetTextExtent(title, &tW, &tH);
869 int vsX, vsY, updTop, updBottom, firstRow, lastRow, row;
876 dc.SetMapMode(wxMM_TEXT);
878 dc.SetBackgroundMode(wxTRANSPARENT);
887 wxRegionIterator upd(GetUpdateRegion());
896 dc.SetPen(*(wxThePenList->
898 dc.SetBrush(*(wxTheBrushList->
900 dc.DrawRectangle(upd.GetX(), upd.GetY(), upd.GetW(), upd.GetH());
908 updBottom = updTop + upd.GetH() - 1;
920 for (row=firstRow; row<=lastRow; ++row) {
926 dc.SetTextForeground(*wxRED);
928 dc.SetTextForeground(
color);
931 dc.GetTextExtent(title, &tW, &tH);
942 static int prevMOY = -1;
945 prevAlignment =
NULL;
956 event.GetPosition(&mX, &mY);
973 if (event.LeftDown()) {
975 unsigned int controls = 0;
978 if (event.MetaDown())
980 if (event.ControlDown())
1007 wxSplitterWindow(parent, -1, wxPoint(0,0), parent->GetClientSize(), wxSP_BORDER)
1016 SetMinimumPaneSize(50);
1080 wxFont *newFont =
new wxFont(font->GetPointSize(), font->GetFamily(),
1081 wxNORMAL, wxNORMAL,
false, font->GetFaceName(), font->GetDefaultEncoding());
1083 newFont =
new wxFont(font->GetPointSize(), font->GetFamily(),
1084 wxITALIC, wxNORMAL,
false, font->GetFaceName(), font->GetDefaultEncoding());
1112 unsigned int nCells;
1118 if (column < vsX || column >= vsX + (
int)nCells) {
1119 vsX =
column - nCells / 2;
1120 if (vsX < 0) vsX = 0;
1127 if (row < vsY || row >= vsY + (
int)nCells) {
1128 vsY = row - nCells / 2;
1129 if (vsY < 0) vsY = 0;
1139 titleArea->Refresh(eraseBackground, rect);
virtual bool MouseDown(int column, int row, unsigned int controls)
virtual void MouseOver(int column, int row) const
virtual void SelectedRectangle(int columnLeft, int rowTop, int columnRight, int rowBottom)
virtual void DraggedCell(int columnFrom, int rowFrom, int columnTo, int rowTo)
virtual bool GetCharacterTraitsAt(unsigned int column, unsigned int row, char *character, wxColour *color, bool *drawBackground, wxColour *cellBackgroundColor) const =0
virtual void GetSize(unsigned int *columns, unsigned int *rows) const =0
virtual bool GetRowTitle(unsigned int row, wxString *title, wxColour *color) const =0
Include a standard set of the NCBI C++ Toolkit most basic headers.
const struct ncbi::grid::netcache::search::fields::SIZE size
static const char * column