2004-01-14 03:54:45 +03:00
|
|
|
//------------------------------------------------------------------------------
|
2005-01-25 23:44:09 +03:00
|
|
|
// Copyright (c) 2001-2005, Haiku, Inc.
|
2004-01-14 03:54:45 +03:00
|
|
|
//
|
|
|
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
// copy of this software and associated documentation files (the "Software"),
|
|
|
|
// to deal in the Software without restriction, including without limitation
|
|
|
|
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
// and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
// Software is furnished to do so, subject to the following conditions:
|
|
|
|
//
|
|
|
|
// The above copyright notice and this permission notice shall be included in
|
|
|
|
// all copies or substantial portions of the Software.
|
|
|
|
//
|
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
// DEALINGS IN THE SOFTWARE.
|
|
|
|
//
|
|
|
|
// File Name: FMWList.cpp
|
2005-01-24 20:34:47 +03:00
|
|
|
// Author: Adi Oanca <adioanca@haikumail.com>
|
2004-01-17 21:37:57 +03:00
|
|
|
// Description: List class for tracking floating and modal windows
|
2004-01-14 03:54:45 +03:00
|
|
|
//
|
|
|
|
//------------------------------------------------------------------------------
|
2004-01-12 01:12:55 +03:00
|
|
|
#include <stdio.h>
|
2004-01-13 04:03:29 +03:00
|
|
|
#include <List.h>
|
2004-01-12 01:12:55 +03:00
|
|
|
|
|
|
|
#include "FMWList.h"
|
|
|
|
#include "WinBorder.h"
|
|
|
|
#include "ServerWindow.h"
|
|
|
|
|
2004-01-14 03:54:45 +03:00
|
|
|
FMWList::FMWList(void)
|
2005-01-24 20:34:47 +03:00
|
|
|
: BList()
|
2004-01-14 03:54:45 +03:00
|
|
|
{
|
2004-01-12 01:12:55 +03:00
|
|
|
}
|
|
|
|
|
2004-01-14 03:54:45 +03:00
|
|
|
FMWList::~FMWList(void)
|
|
|
|
{
|
2004-01-12 01:12:55 +03:00
|
|
|
}
|
|
|
|
|
2005-01-24 20:34:47 +03:00
|
|
|
void FMWList::AddWinBorder(void *item)
|
2004-01-14 03:54:45 +03:00
|
|
|
{
|
2005-01-24 20:34:47 +03:00
|
|
|
if(HasItem(item))
|
|
|
|
return;
|
|
|
|
|
2004-01-14 03:54:45 +03:00
|
|
|
int32 feelItem = ((WinBorder*)item)->Window()->Feel();;
|
|
|
|
int32 feelTemp = 0;
|
|
|
|
int32 location = 0;
|
2004-01-12 01:12:55 +03:00
|
|
|
|
2005-01-24 20:34:47 +03:00
|
|
|
for(int32 i=0; i<CountItems(); i++)
|
2004-01-14 03:54:45 +03:00
|
|
|
{
|
2004-01-12 01:12:55 +03:00
|
|
|
location = i + 1;
|
2005-01-24 20:34:47 +03:00
|
|
|
feelTemp = ((WinBorder*)ItemAt(i))->Window()->Feel();
|
2004-01-14 03:54:45 +03:00
|
|
|
|
|
|
|
// in short: if 'item' is a floating window
|
2004-01-12 01:12:55 +03:00
|
|
|
if( (feelItem == B_FLOATING_SUBSET_WINDOW_FEEL ||
|
|
|
|
feelItem == B_FLOATING_APP_WINDOW_FEEL ||
|
|
|
|
feelItem == B_FLOATING_ALL_WINDOW_FEEL)
|
2004-01-13 04:03:29 +03:00
|
|
|
&& // and 'temp' a modal one
|
2004-01-12 01:12:55 +03:00
|
|
|
(feelTemp == B_MODAL_SUBSET_WINDOW_FEEL ||
|
|
|
|
feelTemp == B_MODAL_APP_WINDOW_FEEL ||
|
|
|
|
feelTemp == B_MODAL_ALL_WINDOW_FEEL)
|
|
|
|
)
|
2004-01-14 03:54:45 +03:00
|
|
|
// means we found the place for our window('wb')
|
|
|
|
{
|
|
|
|
location--;
|
|
|
|
break;
|
|
|
|
}
|
2004-01-12 01:12:55 +03:00
|
|
|
}
|
2005-01-24 20:34:47 +03:00
|
|
|
AddItem(item, location);
|
2004-01-12 01:12:55 +03:00
|
|
|
}
|
|
|
|
|
2004-01-14 03:54:45 +03:00
|
|
|
void FMWList::AddFMWList(FMWList *list)
|
|
|
|
{
|
|
|
|
int32 i=0;
|
2005-01-24 20:34:47 +03:00
|
|
|
for(i=0; i<CountItems(); i++)
|
2004-01-14 03:54:45 +03:00
|
|
|
{
|
2005-01-24 20:34:47 +03:00
|
|
|
int32 feel = ((WinBorder*)ItemAt(i))->Window()->Feel();
|
2004-01-12 01:12:55 +03:00
|
|
|
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-14 03:54:45 +03:00
|
|
|
for(j=0; j<list->CountItems(); j++)
|
|
|
|
{
|
|
|
|
void *item = list->ItemAt(j);
|
|
|
|
int32 feel = ((WinBorder*)item)->Window()->Feel();
|
2004-01-12 01:12:55 +03:00
|
|
|
if(feel == B_MODAL_SUBSET_WINDOW_FEEL ||
|
|
|
|
feel == B_MODAL_APP_WINDOW_FEEL ||
|
|
|
|
feel == B_MODAL_ALL_WINDOW_FEEL)
|
|
|
|
{
|
2005-01-24 20:34:47 +03:00
|
|
|
AddItem(item, CountItems());
|
2004-01-12 01:12:55 +03:00
|
|
|
}
|
2004-01-14 03:54:45 +03:00
|
|
|
else
|
|
|
|
{
|
2005-01-24 20:34:47 +03:00
|
|
|
AddItem(item, i);
|
2004-01-12 01:12:55 +03:00
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-01-14 03:54:45 +03:00
|
|
|
void FMWList::PrintToStream() const
|
|
|
|
{
|
2004-01-12 01:12:55 +03:00
|
|
|
printf("Floating and modal windows list:\n");
|
|
|
|
WinBorder *wb = NULL;
|
2005-01-24 20:34:47 +03:00
|
|
|
for (int32 i=0; i<CountItems(); i++)
|
2004-01-14 03:54:45 +03:00
|
|
|
{
|
2005-01-24 20:34:47 +03:00
|
|
|
wb=(WinBorder*)ItemAt(i);
|
2004-01-14 03:54:45 +03:00
|
|
|
|
2004-01-12 01:12:55 +03:00
|
|
|
printf("\t%s", wb->GetName());
|
2004-01-14 03:54:45 +03:00
|
|
|
|
2004-01-13 04:03:29 +03:00
|
|
|
if (wb->Window()->Feel() == B_FLOATING_SUBSET_WINDOW_FEEL)
|
2004-01-12 01:12:55 +03:00
|
|
|
printf("\t%s\n", "B_FLOATING_SUBSET_WINDOW_FEEL");
|
2004-01-14 03:54:45 +03:00
|
|
|
|
2004-01-13 04:03:29 +03:00
|
|
|
if (wb->Window()->Feel() == B_FLOATING_APP_WINDOW_FEEL)
|
2004-01-12 01:12:55 +03:00
|
|
|
printf("\t%s\n", "B_FLOATING_APP_WINDOW_FEEL");
|
2004-01-14 03:54:45 +03:00
|
|
|
|
2004-01-13 04:03:29 +03:00
|
|
|
if (wb->Window()->Feel() == B_FLOATING_ALL_WINDOW_FEEL)
|
2004-01-12 01:12:55 +03:00
|
|
|
printf("\t%s\n", "B_FLOATING_ALL_WINDOW_FEEL");
|
2004-01-14 03:54:45 +03:00
|
|
|
|
2004-01-13 04:03:29 +03:00
|
|
|
if (wb->Window()->Feel() == B_MODAL_SUBSET_WINDOW_FEEL)
|
2004-01-12 01:12:55 +03:00
|
|
|
printf("\t%s\n", "B_MODAL_SUBSET_WINDOW_FEEL");
|
2004-01-14 03:54:45 +03:00
|
|
|
|
2004-01-13 04:03:29 +03:00
|
|
|
if (wb->Window()->Feel() == B_MODAL_APP_WINDOW_FEEL)
|
2004-01-12 01:12:55 +03:00
|
|
|
printf("\t%s\n", "B_MODAL_APP_WINDOW_FEEL");
|
2004-01-14 03:54:45 +03:00
|
|
|
|
2004-01-13 04:03:29 +03:00
|
|
|
if (wb->Window()->Feel() == B_MODAL_ALL_WINDOW_FEEL)
|
2004-01-12 01:12:55 +03:00
|
|
|
printf("\t%s\n", "B_MODAL_ALL_WINDOW_FEEL");
|
|
|
|
|
2004-01-14 03:54:45 +03:00
|
|
|
// this should NOT happen
|
2004-01-13 04:03:29 +03:00
|
|
|
if (wb->Window()->Feel() == B_NORMAL_WINDOW_FEEL)
|
2004-01-12 01:12:55 +03:00
|
|
|
printf("\t%s\n", "B_NORMAL_WINDOW_FEEL");
|
|
|
|
}
|
|
|
|
}
|