Page 1 of 1

A couple of GUI questions

Posted: Wed Dec 13, 2006 5:35 pm
by rimbou
1) On IGUIWindow. Is there any way to prevent irrlicht from drawing the X to close the window?
2) On IGUIListBox. It always displays an scrollbar even if it's not needed. Can you make it only appear when necessary?

I know I could change those things in the irrlicht source, but I was wondering if there is some way to do this using the IGUISkin or something else.

Thanks.
________
Vapir no2

Posted: Wed Dec 13, 2006 5:50 pm
by JP
1) should be quite simple if you look at the API
2) you can set the scrollbar invisible yourself though i don't know if there's any easy way of knowing whether it's needed or not.

Posted: Wed Dec 13, 2006 5:58 pm
by rimbou
JP wrote:1) should be quite simple if you look at the API
Yes that was very easy. getCloseButton()->setVisible(0)
JP wrote: 2) you can set the scrollbar invisible yourself though i don't know if there's any easy way of knowing whether it's needed or not.
I guess I'll have to add a function to the IGUIListBox that returns a pointer to the IGUIScrollBar
________
Lamborghini Lm002 Specifications

Posted: Wed Dec 13, 2006 6:55 pm
by rimbou
If anyone is interested I made a patch:

Code: Select all

$ diff old --to-file=new
diff --to-file=new old/CGUIListBox.cpp new/CGUIListBox.cpp
382a383,387
> //! Returns a pointer to the Scroll Bar
> IGUIScrollBar* CGUIListBox::getScrollBar()
> {
>       return ScrollBar;
> }
diff --to-file=new old/CGUIListBox.h new/CGUIListBox.h
71a72,74
>               //! Returns a pointer to the Scroll Bar
>               virtual IGUIScrollBar* getScrollBar();
>
diff --to-file=new old/IGUIListBox.h new/IGUIListBox.h
15a16
>       class IGUIScrollBar;
60a62,64
>
>               //! Returns a pointer to the Scroll Bar
>               virtual IGUIScrollBar* getScrollBar() = 0;
I probably didn't use the right diff options to make the patch, so please enlienghten me on what options should I use ;)
________
BUY NO2 VAPORIZER

Posted: Wed Dec 13, 2006 8:59 pm
by hybrid
Try 'diff -Naurp <olddir> <newdir>'

Posted: Wed Dec 13, 2006 10:09 pm
by rimbou
This patch adds getScrollBar() to IGUIListBox. This is useful for example if you dont want to display the scrollbar on the listbox.
Example:

Code: Select all

ListBox->getScrollBar()->setVisible(0);
Here it is with the other options.

Code: Select all

$ diff -Naurp old new
diff -Naurp old/CGUIListBox.cpp new/CGUIListBox.cpp
--- old/CGUIListBox.cpp 2006-11-26 07:11:36.000000000 +0100
+++ new/CGUIListBox.cpp 2006-12-13 19:35:49.687500000 +0100
@@ -380,6 +380,11 @@ void CGUIListBox::setIconFont(IGUIFont*
                IconFont->grab();
 }

+//! Returns a pointer to the Scroll Bar
+IGUIScrollBar* CGUIListBox::getScrollBar()
+{
+       return ScrollBar;
+}

 } // end namespace gui
 } // end namespace irr
diff -Naurp old/CGUIListBox.h new/CGUIListBox.h
--- old/CGUIListBox.h   2006-11-26 07:11:34.000000000 +0100
+++ new/CGUIListBox.h   2006-12-13 19:35:11.796875000 +0100
@@ -69,6 +69,9 @@ namespace gui
                //! Update the position and size of the listbox, and update the
scrollbar
                virtual void updateAbsolutePosition();

+               //! Returns a pointer to the Scroll Bar
+               virtual IGUIScrollBar* getScrollBar();
+
        private:

                struct ListItem
diff -Naurp old/IGUIListBox.h new/IGUIListBox.h
--- old/IGUIListBox.h   2006-06-17 08:12:12.000000000 +0200
+++ new/IGUIListBox.h   2006-12-13 19:36:17.562500000 +0100
@@ -13,6 +13,7 @@ namespace irr
 namespace gui
 {
        class IGUIFont;
+       class IGUIScrollBar;

        //! Default list box GUI element.
        class IGUIListBox : public IGUIElement
@@ -58,6 +59,9 @@ namespace gui

                //! sets the selected item. Set this to -1 if no item should be
selected
                virtual void setSelected(s32 id) = 0;
+
+               //! Returns a pointer to the Scroll Bar
+               virtual IGUIScrollBar* getScrollBar() = 0;
        };
________
MY WEBCAMS HOOKUP