Example #1
0
void PG_ListBox::GetSelectedItems(std::vector<PG_ListBoxBaseItem*>& items) {
	PG_RectList* list = my_scrollarea->GetChildList();
	if(list == NULL) {
		return;
	}

	for(PG_Widget* i = list->first(); i != NULL; i = i->next()) {
		PG_ListBoxBaseItem* item = static_cast<PG_ListBoxBaseItem*>(i);
		if (item->IsSelected()) {
			items.push_back(item);	
		}
	}
}
Example #2
0
void PG_ListBox::SetAlignment(PG_Label::TextAlign style) {
	my_alignment = style;
	
	PG_RectList* list = my_scrollarea->GetChildList();
	if(list == NULL) {
		return;
	}
	
	for(PG_Widget* i = list->first(); i != NULL; i = i->next()) {
		static_cast<PG_ListBoxBaseItem*>(i)->SetAlignment(style);
	}
	Update();
}
Example #3
0
void PG_ListBox::SetIndent(Uint16 indent) {
	my_indent = indent;
	PG_RectList* list = my_scrollarea->GetChildList();
	if(list == NULL) {
		return;
	}

	for(PG_Widget* w = list->first(); w != NULL; w = w->next()) {
		PG_ListBoxBaseItem* item = static_cast<PG_ListBoxBaseItem*>(w);
		item->SetIndent(my_indent);
	}
	Update();
}
Example #4
0
int PG_WidgetList::FindIndex(PG_Widget* w) {
	int index = 0;

	PG_Widget* list = my_scrollarea->GetChildList()->first();
	for( ; list != NULL; list = list->next()) {
		if(list == w) {
			return index;
		}
		index++;
	}

	return -1;
}
Example #5
0
PG_ListBoxBaseItem::~PG_ListBoxBaseItem() {
	if(GetParent() == NULL) {
		return;
	}

	if(GetParent()->GetSelectedItem() == this) {
		GetParent()->SelectItem(NULL);
		//GetParent()->RemoveWidget(this, true, true);
	}

	for (PG_Widget* w = next(); w != NULL; w = w->next()) {
		w->SetID(w->GetID() - 1);
	}
}
Example #6
0
PG_Widget* PG_WidgetList::FindWidget(int index) {

	if((index < 0) || (index >= GetWidgetCount())) {
		return NULL;
	}

	int i = 0;
	PG_Widget* list = my_scrollarea->GetChildList()->first();
	for( ; list != NULL; list = list->next()) {
		if(i == index) {
			return list;
		}
		i++;
	}

	return NULL;
}
Example #7
0
PG_Widget* PG_WidgetList::GetWidgetFromPos(Sint32 y) {
	Uint32 dy = 0;
	Uint32 min_dy = 100000000;

	PG_Widget* result = NULL;

	PG_Widget* list = GetChildList()->first();
	for( ; list != NULL; list = list->next()) {
		dy = abs(0- (list->my_ypos - my_ypos));

		if(dy < min_dy) {
			min_dy = dy;
			result = list;
		}
	}

	return result;
}