Files
haiku-beta6/src/servers/app/server/FMWList.cpp
T

122 lines
3.1 KiB
C++
Raw Normal View History

#include <stdio.h>
2004-01-13 01:03:29 +00:00
#include <List.h>
#include "FMWList.h"
#include "WinBorder.h"
#include "ServerWindow.h"
2004-01-13 01:03:29 +00:00
FMWList::FMWList(){
}
2004-01-13 01:03:29 +00:00
FMWList::~FMWList(){
//printf("~FMWList()\n");
// if (fList.CountItems() > 0)
// printf("SERVER: WARNING: FMWList NOT empty in destructor!\n");
}
2004-01-13 01:03:29 +00:00
void FMWList::AddItem(void* item){
int32 feelItem = ((WinBorder*)item)->Window()->Feel();;
int32 feelTemp = 0;
int32 location = 0;
2004-01-13 01:03:29 +00:00
for(int32 i=0; i<fList.CountItems(); i++){
location = i + 1;
2004-01-13 01:03:29 +00:00
feelTemp = ((WinBorder*)fList.ItemAt(i))->Window()->Feel();
// in short: if 'item' is a floating window
if( (feelItem == B_FLOATING_SUBSET_WINDOW_FEEL ||
feelItem == B_FLOATING_APP_WINDOW_FEEL ||
feelItem == B_FLOATING_ALL_WINDOW_FEEL)
2004-01-13 01:03:29 +00:00
&& // and 'temp' a modal one
(feelTemp == B_MODAL_SUBSET_WINDOW_FEEL ||
feelTemp == B_MODAL_APP_WINDOW_FEEL ||
feelTemp == B_MODAL_ALL_WINDOW_FEEL)
)
2004-01-13 01:03:29 +00:00
// means we found the place for our window('wb')
{ location--; break; }
}
fList.AddItem(item, location);
}
2004-01-13 01:03:29 +00:00
bool FMWList::HasItem(void* item) const{
return fList.HasItem(item);
}
2004-01-13 01:03:29 +00:00
bool FMWList::RemoveItem(void* item){
return fList.RemoveItem(item);
}
2004-01-13 01:03:29 +00:00
void* FMWList::ItemAt(int32 i) const{
return fList.ItemAt(i);
}
2004-01-13 01:03:29 +00:00
int32 FMWList::CountItems() const{
return fList.CountItems();
}
2004-01-13 01:03:29 +00:00
void* FMWList::LastItem() const{
return fList.LastItem();
}
2004-01-13 01:03:29 +00:00
void* FMWList::FirstItem() const{
return fList.FirstItem();
}
2004-01-13 01:03:29 +00:00
int32 FMWList::IndexOf(void *item){
return fList.IndexOf(item);
}
2004-01-13 01:03:29 +00:00
void FMWList::AddFMWList(FMWList *list){
int32 i = 0;
2004-01-13 01:03:29 +00:00
for(i=0; i<fList.CountItems(); i++){
int32 feel = ((WinBorder*)fList.ItemAt(i))->Window()->Feel();
if(feel == B_MODAL_SUBSET_WINDOW_FEEL ||
feel == B_MODAL_APP_WINDOW_FEEL ||
feel == B_MODAL_ALL_WINDOW_FEEL)
{
break;
}
}
int32 j = 0;
2004-01-13 01:03:29 +00:00
for(j=0; j<list->CountItems(); j++){
void *item = list->ItemAt(j);
2004-01-13 01:03:29 +00:00
int32 feel = ((WinBorder*)item)->Window()->Feel();
if(feel == B_MODAL_SUBSET_WINDOW_FEEL ||
feel == B_MODAL_APP_WINDOW_FEEL ||
feel == B_MODAL_ALL_WINDOW_FEEL)
{
fList.AddItem(item, fList.CountItems());
}
2004-01-13 01:03:29 +00:00
else{
fList.AddItem(item, i);
i++;
}
}
}
2004-01-13 01:03:29 +00:00
void FMWList::PrintToStream() const{
printf("Floating and modal windows list:\n");
WinBorder *wb = NULL;
2004-01-13 01:03:29 +00:00
for (int32 i=0; i<fList.CountItems(); i++){
wb = (WinBorder*)fList.ItemAt(i);
printf("\t%s", wb->GetName());
2004-01-13 01:03:29 +00:00
if (wb->Window()->Feel() == B_FLOATING_SUBSET_WINDOW_FEEL)
printf("\t%s\n", "B_FLOATING_SUBSET_WINDOW_FEEL");
2004-01-13 01:03:29 +00:00
if (wb->Window()->Feel() == B_FLOATING_APP_WINDOW_FEEL)
printf("\t%s\n", "B_FLOATING_APP_WINDOW_FEEL");
2004-01-13 01:03:29 +00:00
if (wb->Window()->Feel() == B_FLOATING_ALL_WINDOW_FEEL)
printf("\t%s\n", "B_FLOATING_ALL_WINDOW_FEEL");
2004-01-13 01:03:29 +00:00
if (wb->Window()->Feel() == B_MODAL_SUBSET_WINDOW_FEEL)
printf("\t%s\n", "B_MODAL_SUBSET_WINDOW_FEEL");
2004-01-13 01:03:29 +00:00
if (wb->Window()->Feel() == B_MODAL_APP_WINDOW_FEEL)
printf("\t%s\n", "B_MODAL_APP_WINDOW_FEEL");
2004-01-13 01:03:29 +00:00
if (wb->Window()->Feel() == B_MODAL_ALL_WINDOW_FEEL)
printf("\t%s\n", "B_MODAL_ALL_WINDOW_FEEL");
// this should NOT happen
2004-01-13 01:03:29 +00:00
if (wb->Window()->Feel() == B_NORMAL_WINDOW_FEEL)
printf("\t%s\n", "B_NORMAL_WINDOW_FEEL");
}
}