Ejemplo n.º 1
0
/* Construct a new IComboBox from the passed in values.
 * constructor does not do any parameter checking at this time.
 *
 * PARAMS
 *   location - the top left corner of the box
 *   size - the size in the X, Y and Z directions
 *   paneColor - the color of the pane
 */
IComboBox::IComboBox(GPoint location, GPoint size, GColor paneColor, int itemNumber)
{
    this->location = location;
    this->size = size;
    this->paneColor = paneColor;
    line_max = itemNumber;
    if (line_max < 5)
	line_max = 5;
    //this->size.setY(line_max * 4);
    if (CHAR_CNT(size.getX()) < 5) {
	this->size.setX(5 * CHAR_WIDTH + OVERHEAD);
    }
    char_max = CHAR_CNT(this->size.getX());
    item_cnt = 0;
    head = NULL;
    top = head;
    next_idx = 0;

    Text = (char*)malloc(sizeof (char) * 2 + 1);
    Text = "";

    TextLongName = (char*)malloc(sizeof(char) * 2 + 1);
    TextLongName = "";

    //Set ListBox drawing variables
    ListBoxLocation = GPoint(location.getX(), location.getY() - size.getY() - 0.5, location.getZ());
    ListBoxSize = GPoint(size.getX() - 0.5, itemNumber * 4, size.getZ());

    //Set external flags to default
    CloseList = false;
    OpenList = false;
    TitleChange = false;
    FocusLock = false;

    //Set animation flags
    Animate = true;
    aa = 0.0;
    dohighlight = false;
    highlight = 0;

    //Set reading flags
    ReRead = false;

    Items = NULL;
}