[Libreoffice] [GSOC] Multiline Inputbar

Kohei Yoshida kyoshida at novell.com
Wed Jun 15 09:04:53 PDT 2011


Hi Anurag,

On Wed, 2011-06-15 at 13:29 +0530, Anurag Jain wrote:

> Here I'm drafting the basic flow work for implementing my task. As of
> now this mainly focus on Scrollbar but I'll be expanding on it for the
> button also.
> 
> 1:Creating a contain class inheriting Window class with the objects
> ScinputWnd, ScrollBar and PushButton.

Assuming that ScinputWnd is ScInputWindow, you got it 90%, but it's not
exactly what I suggested.  But perhaps you meant ScTextWnd? in which
case you got it right 100%.

Just in case you meant ScInputWindow, let me re-iterate my suggestion.
ScInputWindow will stay as-is GUI-hierarchy-wise.  My suggestion was to
create a new container class that will be a child control of
ScInputWindow, to take the place of where ScTextWnd currently is.  Let's
name this child container control ScInputBarGroup just for this
discussion (to make it easier to reference it).  ScInputWindow will
contain, as its immediate child controls, ScPosWnd (that's the name
range box), the three buttons (function wizard, sum, and function), and
ScInputBarGroup.  ScTextWnd will no longer be a direct child of
ScInputWindow in this new layout.

Then, ScInputBarGroup will contain, as its immediate childs, ScTextWnd,
a scroll bar, and a push button.

But reading your other replies below, I think you understand this
correctly.

> 2: Now the ScInputWnd which used to contain the object or ScTextWnd
> i.e. aTextWnd will now have the object of this new class and all the
> functions of ScInputWindow which used to use aTextWnd to call the
> ScTextWnd function, will now call the similar functions defined in
> this new class which again will call the underlying ScTextWnd
> functions.

Yes.  This you got 100% right.

> So the hierarchy can be ScInputWindow--->NewClass--->ScTextwnd

Yes.  I guess your understanding is right on.

> 3: Now in the constructor I'd initialize attributes of ScrollBar like
> Start position, Thumb pixel size, Thumb pixel range, Thumb pixel
> position, Page Size, Line Size and Visible Size (What is it actually
> ?).

So, I'm not exactly sure what the line size, visible size, page, size
etc mean.  Hopefully someone who is more versed with the ScrollBar class
can answer that.

Having said that, for the simplest use cases of ScrollBar, you can just
set the page, line and visible sizes to 1, then only play with the min
and max range values.

> 4: Embed this object of new class into the InsertWindow() function of
> ScInputWindow.

Yes.  You got it.

> This is my outline so far as I've understood the track. Please correct
> me if there is anything which I'm missing. I'm going through the
> scrollbar code as of now.

I think you got it all right.

> @Kohei Can you point me to some code where scrollbar has got similar
> implementation ?

There are plenty of reference use case of ScrollBar across Calc's code.
Running

  git grep "ScrollBar\ .*ma"

shows several places where ScrollBar is used.  Based on that, you can
perhaps take a look at

ScCsvTableBox - which implements the preview window in the CSV import
option dialog.
ScOptSolverDlg - which implements the solver dialog (Tools - Solver).

All the other uses are somewhat more complex, so I would look at those
two classes to learn how to use ScrollBar class if I were you.

Good luck, and please keep us informed of your progress, with the list
and/or with Noel while I'm away. :-)

Kohei

-- 
Kohei Yoshida, LibreOffice hacker, Calc
<kyoshida at novell.com>



More information about the LibreOffice mailing list