- implement setSize(): We can't just use puObject::setSize() -- we do, of
course, have to re-layout all sub-widgets on resizing - make slider size configurable, like it's done for the close relative puLargeInput
This commit is contained in:
parent
0c85cdbd7e
commit
b650e86e74
2 changed files with 24 additions and 7 deletions
|
@ -61,15 +61,17 @@ handle_arrow (puObject * arrow)
|
||||||
slider->setValue(1.0f - float(index)/list_box->getNumItems());
|
slider->setValue(1.0f - float(index)/list_box->getNumItems());
|
||||||
}
|
}
|
||||||
|
|
||||||
puList::puList (int x, int y, int w, int h)
|
puList::puList (int x, int y, int w, int h, int sl_width)
|
||||||
: puGroup(x, y)
|
: puGroup(x, y),
|
||||||
|
sw(sl_width)
|
||||||
{
|
{
|
||||||
type |= PUCLASS_LIST;
|
type |= PUCLASS_LIST;
|
||||||
init(w, h);
|
init(w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
puList::puList (int x, int y, int w, int h, char ** contents)
|
puList::puList (int x, int y, int w, int h, char ** contents, int sl_width)
|
||||||
: puGroup(x, y)
|
: puGroup(x, y),
|
||||||
|
sw(sl_width)
|
||||||
{
|
{
|
||||||
type |= PUCLASS_LIST;
|
type |= PUCLASS_LIST;
|
||||||
init(w, h);
|
init(w, h);
|
||||||
|
@ -103,7 +105,6 @@ puList::getListIntegerValue()
|
||||||
void
|
void
|
||||||
puList::init (int w, int h)
|
puList::init (int w, int h)
|
||||||
{
|
{
|
||||||
const int sw = 20;
|
|
||||||
_frame = new puFrame(0, 0, w, h);
|
_frame = new puFrame(0, 0, w, h);
|
||||||
|
|
||||||
_list_box = new puListBox(0, 0, w-sw, h);
|
_list_box = new puListBox(0, 0, w-sw, h);
|
||||||
|
@ -143,4 +144,18 @@ puList::setColour (int which, float r, float g, float b, float a)
|
||||||
_list_box->setColour(which, r, g, b, a);
|
_list_box->setColour(which, r, g, b, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
puList::setSize (int w, int h)
|
||||||
|
{
|
||||||
|
puObject::setSize(w, h);
|
||||||
|
_frame->setSize(w, h);
|
||||||
|
_list_box->setSize(w-sw, h);
|
||||||
|
|
||||||
|
_slider->setPosition(w-sw, sw);
|
||||||
|
_slider->setSize(sw, h-2*sw);
|
||||||
|
|
||||||
|
_down_arrow->setPosition(w-sw, 0);
|
||||||
|
_up_arrow->setPosition(w-sw, h-sw);
|
||||||
|
}
|
||||||
|
|
||||||
// end of puList.cxx
|
// end of puList.cxx
|
||||||
|
|
|
@ -19,8 +19,8 @@
|
||||||
class puList : public puGroup
|
class puList : public puGroup
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
puList (int x, int y, int w, int h);
|
puList (int x, int y, int w, int h, int sl_width = 20);
|
||||||
puList (int x, int y, int w, int h, char ** contents);
|
puList (int x, int y, int w, int h, char ** contents, int sl_width = 20);
|
||||||
virtual ~puList ();
|
virtual ~puList ();
|
||||||
|
|
||||||
virtual void newList (char ** contents);
|
virtual void newList (char ** contents);
|
||||||
|
@ -29,12 +29,14 @@ class puList : public puGroup
|
||||||
virtual int getListIntegerValue();
|
virtual int getListIntegerValue();
|
||||||
virtual void setColourScheme (float r, float g, float b, float a);
|
virtual void setColourScheme (float r, float g, float b, float a);
|
||||||
virtual void setColour (int which, float r, float g, float b, float a);
|
virtual void setColour (int which, float r, float g, float b, float a);
|
||||||
|
virtual void setSize (int w, int h);
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void init (int w, int h);
|
virtual void init (int w, int h);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
int sw; // slider width
|
||||||
char ** _contents;
|
char ** _contents;
|
||||||
puFrame * _frame;
|
puFrame * _frame;
|
||||||
puListBox * _list_box;
|
puListBox * _list_box;
|
||||||
|
|
Loading…
Reference in a new issue