[ wxwindows-Patches-1510788 ] wxGrid cell scroll & more

0 views
Skip to first unread message

SourceForge.net

unread,
Jun 22, 2006, 12:33:19 PM6/22/06
to nor...@sourceforge.net
Patches item #1510788, was opened at 2006-06-22 16:33
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=309863&aid=1510788&group_id=9863

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Grid
Group: new feature
Status: Open
Resolution: None
Priority: 5
Submitted By: Søren Lassen (slassen)
Assigned to: Nobody/Anonymous (nobody)
Summary: wxGrid cell scroll & more

Initial Comment:
Purpose of the patch:
-------------------------------
1.To enable cell scrolling (scrolling in rows and
columns instead of pixels).
2.To make it possible to turn scrollbars off.
3.To get better control over when scrollbars were
turned on and off automatically.
4.To correct behaviour when expanding selection with
keyboard, so that the cell cursor moves (like it does
in e.g. Excel or OpenOffice, and as it is described in
the wxGrid documentation).
5.To enable expanding selection with keys
Shift+Ctrl+Home, Shift+Ctrl+End, Shift+PgUp,
Shift+PgDn

The patch contains changes for:
---------------------------------------------
grid.cpp
grid.h
grid.tex
griddemo.h
griddemo.cpp

Changes in wxGrid:
----------------------------------------------------
wxGridis now derived directly from wxWindow (instead
of wxScrolledWindow).

CalcDimensions(), Onsize() and SetScrollbar() have
been changed to work in the following way:
SetScrollbar() sets a boolean to show that it is being
called. This is read by OnSize(), which returns
without further action if a size event originates from
SetScrollbar(). CalcDimensions() iterates until
SetScrollbar() does not change the client size of the
grid.

MakeCellVisiblenow returns a bool which tells whether
the cell could be made visible.

new function bool MoveCursorToCell( int row , int col
, bool expandSelection ). This is used to simplify
all the other cursor movement funtions, and also
provides for purpose 4.

bool MovePageDown( bool expandSelection ) - the new
parameter makes it possible to expand selection with
this function.

bool MovePageUp( bool expandSelection ) - the new
parameter makes it possible to expand selection with
this function.

bool SetScrollLineX( int x ) - the function now
returns false (and produces a wxLogError message) if
given an invalid parameter. There are two new possible
parameter values: WXGRID_SCROLL_DISABLED (macro
variable, resolves to 0, disables all horizontal
scrolling) and WXGRID_SCROLL_CELL (macro variable,
resolves to -1, sets horizontal scrolling to whole
rows)

bool SetScrollLineY( int y ) - changes correspond to
SetScrollLineX.

int GetScrollLineX() const- returns the horizontal
Scroll increment or special value (see SetScrollLineX).

int GetScrollLineY() const- returns the vertical
Scroll increment or special value (see SetScrollLineX).

void EnableScrollbar( int orientation, bool enable ) -
enables or disables scrollbar in the given orientation
(wxHORIZONTAL/wxVERTICAL). As default, scrollbars are
enabled.

bool ScrollbarEnabled( int orientation ) const- tells
whether scrollbar is enabled for the given orientation.
The following functions duplicates the functionality
from wxScrolledWindow:
void CalcScrolledPosition( int x, int y, int *xx, int
*yy ) const
void CalcUnscrolledPosition( int x, int y, int *xx,
int *yy ) const;
virtual void DoPrepareDC( wxDC& dc );
void PrepareDC( wxDC& dc ){ DoPrepareDC(dc); }
void Scroll( int xPos, int yPos );
Of these functions, only Scroll() has been added to
the wxGrid documentation.
Protected functions in wxGrid
int GetWinTop() constreturns the unscrolled pixel Y
coordinate of the top left corner.

int GetWinLeft() constreturns the unscrolled pixel X
coordinate of the top left corner.

void OnScroll(wxScrollWinEvent& e)handles wxGrid
scrolling

int FindPageUp(int row,bool keepOriginVisible=false)
const - finds the cell one page up from (row,col). If
keepOriginVisible is true, finds the cell that can be
shown keeping (row,col) fully visible. Helper function
for column scrolling.

int FindPageDown(int row,bool
keepOriginVisible=false)const - helper function for
row scrolling, see FindPageUp.

int FindPageLeft(int col,bool findFullyVisible=false)
const - helper function for column scrolling, see
FindPageUp.

int FindPageRight(int col,bool findFullyVisible=false)
const - helper function for column scrolling, see
FindPageUp.

The following functions have been declared const:
-------------------------------------------------
int YToRow( int y )
int XToCol( int x )
int YToEdgeOfRow( int y )
int XToEdgeOfCol( int x )
int GetRowLabelSize()
int GetColLabelSize()
int GetDefaultRowSize()
int GetRowSize( int row )
int GetDefaultColSize()
int GetColSize( int col )

The following functions have been declared public:
-----------------------------------------------------
int GetColLeft(int col) const
int GetColRight(int col) const
(doing this made it possible to simplify and speed up
some functions in helper classes)

Other changes:
------------------------------
wxGridCellEditor::IsAcceptedKeyhas been simplified a
bit, mostly to avoid compiler warnings when compiling
without unicode.

wxGridCellEditorEvtHandler::OnChar: minor changes
because some functions from wxScrolledWindow are no
more available. Also some simplification taking
advantage of wxGrid functionality, and some minor
changes to account for new scroll modes.

Changes in Grid demo:
------------------------------
The samples have a couple of extra menu items:
View->X scrollbar
View->Y Scrollbar

Edit->Set horizontal scroll
Edit->Set vertical scroll

The use of the first two is obvious: if not checked,
no scrollbar is shown (but scrolling may still be
possible when moving the cursor with the keyboard).
The two other items sets the scroll amount in pixels
when given a positive number, 0 disables scrolling,
and -1 enables column/row scrolling.

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=309863&aid=1510788&group_id=9863

Reply all
Reply to author
Forward
0 new messages