Tweaked AccelerantDriver to utilize recent DisplayDriver changes
Added a number of new files to server app_server now included in the build git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2524 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
be21660d1c
commit
a3d04b0ebc
|
@ -1,4 +1,4 @@
|
|||
SubDir OBOS_TOP src servers app ;
|
||||
|
||||
SubInclude OBOS_TOP src servers app proto7 ;
|
||||
SubInclude OBOS_TOP src servers app server ;
|
||||
|
||||
|
|
|
@ -345,7 +345,7 @@ void AccelerantDriver::FillTriangle(BPoint *pts, BRect r, LayerData *d, int8 *pa
|
|||
*/
|
||||
void AccelerantDriver::HideCursor(void)
|
||||
{
|
||||
_SetCursorHidden(true);
|
||||
// _SetCursorHidden(true);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -377,7 +377,7 @@ void AccelerantDriver::InvertRect(BRect r)
|
|||
*/
|
||||
void AccelerantDriver::ShowCursor(void)
|
||||
{
|
||||
_SetCursorHidden(false);
|
||||
//_SetCursorHidden(false);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -389,7 +389,7 @@ void AccelerantDriver::ShowCursor(void)
|
|||
*/
|
||||
void AccelerantDriver::ObscureCursor(void)
|
||||
{
|
||||
_SetCursorObscured(true);
|
||||
//_SetCursorObscured(true);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// 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: AppServer.cpp
|
||||
// Author: DarkWyrm <bpmagic@columbus.rr.com>
|
||||
// Description: main manager object for the app_server
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
#include "AppServer.h"
|
||||
#include "ServerConfig.h"
|
||||
|
||||
AppServer::AppServer(void)
|
||||
{
|
||||
}
|
||||
|
||||
AppServer::~AppServer(void)
|
||||
{
|
||||
}
|
||||
|
||||
int32 AppServer::PollerThread(void *data)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32 AppServer::PicassoThread(void *data)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
thread_id AppServer::Run(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void AppServer::MainLoop(void)
|
||||
{
|
||||
}
|
||||
|
||||
bool AppServer::LoadDecorator(const char *path)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void AppServer::DispatchMessage(int32 code, int8 *buffer)
|
||||
{
|
||||
}
|
||||
|
||||
void AppServer::Broadcast(int32 code)
|
||||
{
|
||||
}
|
||||
|
||||
void AppServer::HandleKeyMessage(int32 code, int8 *buffer)
|
||||
{
|
||||
}
|
||||
|
||||
int main( int argc, char** argv )
|
||||
{
|
||||
// There can be only one....
|
||||
if(find_port(SERVER_PORT_NAME)!=B_NAME_NOT_FOUND)
|
||||
return -1;
|
||||
|
||||
AppServer *app_server = new AppServer();
|
||||
app_server->Run();
|
||||
delete app_server;
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
#ifndef _OPENBEOS_APP_SERVER_H_
|
||||
#define _OPENBEOS_APP_SERVER_H_
|
||||
|
||||
#include <OS.h>
|
||||
#include <Locker.h>
|
||||
#include <List.h>
|
||||
#include <Window.h>
|
||||
#include "Decorator.h"
|
||||
|
||||
class Layer;
|
||||
class BMessage;
|
||||
class ServerApp;
|
||||
class DisplayDriver;
|
||||
|
||||
/*!
|
||||
\class AppServer AppServer.h
|
||||
\brief main manager object for the app_server
|
||||
|
||||
File for the main app_server thread. This particular thread monitors for
|
||||
application start and quit messages. It also starts the housekeeping threads
|
||||
and initializes most of the server's globals.
|
||||
*/
|
||||
class AppServer
|
||||
{
|
||||
public:
|
||||
AppServer(void);
|
||||
~AppServer(void);
|
||||
static int32 PollerThread(void *data);
|
||||
static int32 PicassoThread(void *data);
|
||||
thread_id Run(void);
|
||||
void MainLoop(void);
|
||||
bool LoadDecorator(const char *path);
|
||||
void DispatchMessage(int32 code, int8 *buffer);
|
||||
void Broadcast(int32 code);
|
||||
void HandleKeyMessage(int32 code, int8 *buffer);
|
||||
|
||||
create_decorator *make_decorator; // global function pointer
|
||||
private:
|
||||
friend Decorator *instantiate_decorator(Layer *lay, const char *title, uint32 dflags, uint32 wlook);
|
||||
|
||||
port_id messageport,mouseport;
|
||||
image_id decorator_id;
|
||||
bool quitting_server;
|
||||
BList *applist;
|
||||
int32 active_app;
|
||||
// ServerApp *p_active_app;
|
||||
thread_id poller_id, picasso_id;
|
||||
|
||||
BLocker *active_lock, *applist_lock, *decor_lock;
|
||||
bool exit_poller;
|
||||
DisplayDriver *driver;
|
||||
};
|
||||
|
||||
Decorator *instantiate_decorator(BRect rect, const char *title, int32 wlook, int32 wfeel,
|
||||
int32 wflags, DisplayDriver *ddriver);
|
||||
#endif
|
|
@ -1,3 +1,30 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// 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: ColorSet.cpp
|
||||
// Author: DarkWyrm <bpmagic@columbus.rr.com>
|
||||
// Description: Class for encapsulating GUI system colors
|
||||
//
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
#include <stdio.h>
|
||||
#include "ColorSet.h"
|
||||
|
||||
|
|
|
@ -0,0 +1,210 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// 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: ColorUtils.cc
|
||||
// Author: DarkWyrm <bpmagic@columbus.rr.com>
|
||||
// Description: Miscellaneous useful functions for working with colors
|
||||
//
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
#include "ColorUtils.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
/*!
|
||||
\brief An approximation of 31/255, which is needed for converting from 32-bit
|
||||
colors to 16-bit.
|
||||
*/
|
||||
#define RATIO_32_TO_16_BIT .121568627451
|
||||
|
||||
/*!
|
||||
\brief An approximation of 255/31, which is needed for converting from 16-bit
|
||||
colors to 32-bit.
|
||||
*/
|
||||
#define RATIO_16_TO_32_BIT 8.225806451613
|
||||
|
||||
/*!
|
||||
\brief Function for easy assignment of values to rgb_color objects
|
||||
\param Pointer to an rgb_color
|
||||
\param red value
|
||||
\param green value
|
||||
\param blue value
|
||||
\param alpha value, defaults to 255
|
||||
|
||||
This function will do nothing if given a NULL color pointer.
|
||||
*/
|
||||
void SetRGBColor(rgb_color *col,uint8 r, uint8 g, uint8 b, uint8 a)
|
||||
{
|
||||
if(col)
|
||||
{
|
||||
col->red=r;
|
||||
col->green=g;
|
||||
col->blue=b;
|
||||
col->alpha=a;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Function for easy conversion of 16-bit colors to 32-bit
|
||||
\param Pointer to an rgb_color.
|
||||
\param RGBA16 color
|
||||
|
||||
This function will do nothing if passed a NULL 32-bit color.
|
||||
*/
|
||||
void SetRGBColor(rgb_color *col,uint16 color)
|
||||
{
|
||||
if(!col)
|
||||
return;
|
||||
|
||||
uint16 r16,g16,b16;
|
||||
|
||||
// alpha's the easy part
|
||||
col->alpha=(color & 0x8000)?255:0;
|
||||
|
||||
r16= (color >> 15) & 31;
|
||||
g16= (color >> 10) & 31;
|
||||
b16= color & 31;
|
||||
|
||||
col->red=uint8(r16 * RATIO_16_TO_32_BIT);
|
||||
col->green=uint8(g16 * RATIO_16_TO_32_BIT);
|
||||
col->blue=uint8(b16 * RATIO_16_TO_32_BIT);
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Finds the index of the closest matching color in a rgb_color palette array
|
||||
\param Array of 256 rgb_color objects
|
||||
\param Color to match
|
||||
\return Index of the closest matching color
|
||||
|
||||
Note that passing a NULL palette will always return 0 and passing an array of less
|
||||
than 256 rgb_colors will cause a crash.
|
||||
*/
|
||||
uint8 FindClosestColor(rgb_color *palette, rgb_color color)
|
||||
{
|
||||
if(!palette)
|
||||
return 0;
|
||||
|
||||
uint16 cindex=0,cdelta=765,delta=765;
|
||||
rgb_color *c;
|
||||
|
||||
for(uint16 i=0;i<256;i++)
|
||||
{
|
||||
c=&(palette[i]);
|
||||
delta=abs(c->red-color.red)+abs(c->green-color.green)+
|
||||
abs(c->blue-color.blue);
|
||||
|
||||
if(delta==0)
|
||||
{
|
||||
cindex=i;
|
||||
break;
|
||||
}
|
||||
|
||||
if(delta<cdelta)
|
||||
{
|
||||
cindex=i;
|
||||
cdelta=delta;
|
||||
}
|
||||
}
|
||||
|
||||
return (uint8)cindex;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Constructs a RGBA15 color which best matches a given 32-bit color
|
||||
\param Color to match
|
||||
\return The closest matching color's value
|
||||
|
||||
Format is ARGB, 1:5:5:5
|
||||
*/
|
||||
uint16 FindClosestColor16(rgb_color color)
|
||||
{
|
||||
uint16 r16,g16,b16;
|
||||
uint16 color16;
|
||||
|
||||
r16=uint16(color.red * RATIO_32_TO_16_BIT);
|
||||
g16=uint16(color.green * RATIO_32_TO_16_BIT);
|
||||
b16=uint16(color.blue * RATIO_32_TO_16_BIT);
|
||||
|
||||
// start with alpha value
|
||||
color16=(color.alpha>127)?0x8000:0;
|
||||
|
||||
color16 |= r16 << 15;
|
||||
color16 |= g16 << 10;
|
||||
color16 |= b16;
|
||||
|
||||
return color16;
|
||||
}
|
||||
|
||||
// Function which could be used to . Position is
|
||||
// Any number outside
|
||||
// this range will cause the function to fail and return the color (0,0,0,0)
|
||||
// Alpha components are included in the calculations. 0 yields color #1
|
||||
// and 1 yields color #2.
|
||||
|
||||
/*!
|
||||
\brief Function mostly for calculating gradient colors
|
||||
\param Start color
|
||||
\param End color
|
||||
\param A floating point number such that 0.0 <= position <= 1.0. 0.0 results in the
|
||||
start color and 1.0 results in the end color.
|
||||
\return The blended color. If an invalid position was given, {0,0,0,0} is returned.
|
||||
*/
|
||||
rgb_color MakeBlendColor(rgb_color col, rgb_color col2, float position)
|
||||
{
|
||||
rgb_color newcol={0,0,0,0};
|
||||
float mod=0;
|
||||
int16 delta;
|
||||
if(position<0 || position>1)
|
||||
return newcol;
|
||||
|
||||
delta=int16(col2.red)-int16(col.red);
|
||||
mod=col.red + (position * delta);
|
||||
newcol.red=uint8(mod);
|
||||
if(mod>255 )
|
||||
newcol.red=255;
|
||||
if(mod<0 )
|
||||
newcol.red=0;
|
||||
|
||||
delta=int16(col2.green)-int16(col.green);
|
||||
mod=col.green + (position * delta);
|
||||
newcol.green=uint8(mod);
|
||||
if(mod>255 )
|
||||
newcol.green=255;
|
||||
if(mod<0 )
|
||||
newcol.green=0;
|
||||
|
||||
delta=int16(col2.blue)-int16(col.blue);
|
||||
mod=col.blue + (position * delta);
|
||||
newcol.blue=uint8(mod);
|
||||
if(mod>255 )
|
||||
newcol.blue=255;
|
||||
if(mod<0 )
|
||||
newcol.blue=0;
|
||||
|
||||
delta=int8(col2.alpha)-int8(col.alpha);
|
||||
mod=col.alpha + (position * delta);
|
||||
newcol.alpha=uint8(mod);
|
||||
if(mod>255 )
|
||||
newcol.alpha=255;
|
||||
if(mod<0 )
|
||||
newcol.alpha=0;
|
||||
|
||||
return newcol;
|
||||
}
|
|
@ -0,0 +1,540 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// 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: Decorator.cpp
|
||||
// Author: DarkWyrm <bpmagic@columbus.rr.com>
|
||||
// Description: Base class for window decorators
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
#include <Region.h>
|
||||
#include "ColorSet.h"
|
||||
#include "Decorator.h"
|
||||
#include "DisplayDriver.h"
|
||||
|
||||
/*!
|
||||
\brief Constructor
|
||||
\param rect Size of client area
|
||||
\param wlook style of window look. See Window.h
|
||||
\param wfeel style of window feel. See Window.h
|
||||
\param wflags various window flags. See Window.h
|
||||
|
||||
Does general initialization of internal data members and creates a colorset
|
||||
object.
|
||||
*/
|
||||
Decorator::Decorator(BRect rect, int32 wlook, int32 wfeel, int32 wflags)
|
||||
{
|
||||
_close_state=false;
|
||||
_minimize_state=false;
|
||||
_zoom_state=false;
|
||||
_title_string=new BString;
|
||||
_driver=NULL;
|
||||
|
||||
_closerect.Set(0,0,1,1);
|
||||
_zoomrect.Set(0,0,1,1);
|
||||
_minimizerect.Set(0,0,1,1);
|
||||
_resizerect.Set(0,0,1,1);
|
||||
_frame=rect;
|
||||
_tabrect.Set(rect.left,rect.top,rect.right, rect.top+((rect.bottom-rect.top)/4));
|
||||
|
||||
_look=wlook;
|
||||
_feel=wfeel;
|
||||
_flags=wflags;
|
||||
|
||||
_colors=new ColorSet();
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Destructor
|
||||
|
||||
Frees the color set and the title string
|
||||
*/
|
||||
Decorator::~Decorator(void)
|
||||
{
|
||||
if(_colors!=NULL)
|
||||
{
|
||||
delete _colors;
|
||||
_colors=NULL;
|
||||
}
|
||||
if(_title_string)
|
||||
delete _title_string;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Updates the decorator's color set
|
||||
\param cset The color set to update from
|
||||
*/
|
||||
void Decorator::SetColors(const ColorSet &cset)
|
||||
{
|
||||
_colors->SetColors(cset);
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Assigns a display driver to the decorator
|
||||
\param driver A valid DisplayDriver object
|
||||
*/
|
||||
void Decorator::SetDriver(DisplayDriver *driver)
|
||||
{
|
||||
// lots of subclasses will depend on the driver for text support, so call
|
||||
// _DoLayout() after this
|
||||
_driver=driver;
|
||||
_DoLayout();
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Sets the close button's value.
|
||||
\param is_down Whether the button is down or not
|
||||
|
||||
Note that this does not update the button's look - it just updates the
|
||||
internal button value
|
||||
*/
|
||||
void Decorator::SetClose(bool is_down)
|
||||
{
|
||||
_close_state=is_down;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Sets the minimize button's value.
|
||||
\param is_down Whether the button is down or not
|
||||
|
||||
Note that this does not update the button's look - it just updates the
|
||||
internal button value
|
||||
*/
|
||||
void Decorator::SetMinimize(bool is_down)
|
||||
{
|
||||
_zoom_state=is_down;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Sets the zoom button's value.
|
||||
\param is_down Whether the button is down or not
|
||||
|
||||
Note that this does not update the button's look - it just updates the
|
||||
internal button value
|
||||
*/
|
||||
void Decorator::SetZoom(bool is_down)
|
||||
{
|
||||
_minimize_state=is_down;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Sets the decorator's window flags
|
||||
\param wflags New value for the flags
|
||||
|
||||
While this call will not update the screen, it will affect how future
|
||||
updates work and immediately affects input handling.
|
||||
*/
|
||||
void Decorator::SetFlags(int32 wflags)
|
||||
{
|
||||
_flags=wflags;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Sets the decorator's window feel
|
||||
\param wflags New value for the feel
|
||||
|
||||
While this call will not update the screen, it will affect how future
|
||||
updates work and immediately affects input handling.
|
||||
*/
|
||||
void Decorator::SetFeel(int32 wfeel)
|
||||
{
|
||||
_feel=wfeel;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Sets the decorator's window look
|
||||
\param wflags New value for the look
|
||||
|
||||
While this call will not update the screen, it will affect how future
|
||||
updates work and immediately affects input handling.
|
||||
*/
|
||||
void Decorator::SetLook(int32 wlook)
|
||||
{
|
||||
_look=wlook;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Returns the value of the close button
|
||||
\return true if down, false if up
|
||||
*/
|
||||
bool Decorator::GetClose(void)
|
||||
{
|
||||
return _close_state;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Returns the value of the minimize button
|
||||
\return true if down, false if up
|
||||
*/
|
||||
bool Decorator::GetMinimize(void)
|
||||
{
|
||||
return _minimize_state;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Returns the value of the zoom button
|
||||
\return true if down, false if up
|
||||
*/
|
||||
bool Decorator::GetZoom(void)
|
||||
{
|
||||
return _zoom_state;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Returns the decorator's window look
|
||||
\return the decorator's window look
|
||||
*/
|
||||
int32 Decorator::GetLook(void)
|
||||
{
|
||||
return _look;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Returns the decorator's window feel
|
||||
\return the decorator's window feel
|
||||
*/
|
||||
int32 Decorator::GetFeel(void)
|
||||
{
|
||||
return _feel;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Returns the decorator's window flags
|
||||
\return the decorator's window flags
|
||||
*/
|
||||
int32 Decorator::GetFlags(void)
|
||||
{
|
||||
return _flags;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Updates the value of the decorator title
|
||||
\param string New title value
|
||||
*/
|
||||
void Decorator::SetTitle(const char *string)
|
||||
{
|
||||
_title_string->SetTo(string);
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Returns the decorator's title
|
||||
\return the decorator's title
|
||||
*/
|
||||
const char *Decorator::GetTitle(void)
|
||||
{
|
||||
return _title_string->String();
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Changes the focus value of the decorator
|
||||
\param is_active True if active, false if not
|
||||
|
||||
While this call will not update the screen, it will affect how future
|
||||
updates work.
|
||||
*/
|
||||
void Decorator::SetFocus(bool is_active)
|
||||
{
|
||||
_has_focus=is_active;
|
||||
_SetFocus();
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Provides the number of characters that will fit in the given width
|
||||
\param width Maximum number of pixels the title can be
|
||||
\return the number of characters that will fit in the given width
|
||||
*/
|
||||
int32 Decorator::_ClipTitle(float width)
|
||||
{
|
||||
if(_driver)
|
||||
{
|
||||
int32 strlength=_title_string->CountChars();
|
||||
float pixwidth=_driver->StringWidth(_title_string->String(),strlength,&_layerdata);
|
||||
|
||||
while(strlength>=0)
|
||||
{
|
||||
if(pixwidth<width)
|
||||
break;
|
||||
strlength--;
|
||||
pixwidth=_driver->StringWidth(_title_string->String(),strlength,&_layerdata);
|
||||
}
|
||||
|
||||
return strlength;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Virtual Methods
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
/*!
|
||||
\brief Moves the decorator frame and all default rectangles
|
||||
\param x X Offset
|
||||
\param y y Offset
|
||||
|
||||
If a subclass implements this method, be sure to call Decorator::MoveBy
|
||||
to ensure that internal members are also updated. All members of the Decorator
|
||||
class are automatically moved in this method
|
||||
*/
|
||||
void Decorator::MoveBy(float x, float y)
|
||||
{
|
||||
_zoomrect.OffsetBy(x,y);
|
||||
_closerect.OffsetBy(x,y);
|
||||
_minimizerect.OffsetBy(x,y);
|
||||
_minimizerect.OffsetBy(x,y);
|
||||
_tabrect.OffsetBy(x,y);
|
||||
_frame.OffsetBy(x,y);
|
||||
_resizerect.OffsetBy(x,y);
|
||||
_borderrect.OffsetBy(x,y);
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Moves the decorator frame and all default rectangles
|
||||
\param pt Point containing the offsets
|
||||
|
||||
If a subclass implements this method, be sure to call Decorator::MoveBy
|
||||
to ensure that internal members are also updated. All members of the Decorator
|
||||
class are automatically moved in this method
|
||||
*/
|
||||
void Decorator::MoveBy(BPoint pt)
|
||||
{
|
||||
MoveBy(pt.x,pt.y);
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Moves the tab by the specified amount
|
||||
\param dx x offset
|
||||
\param dy y offset
|
||||
\return The new tab rectangle.
|
||||
|
||||
Slides the tab by the x or y value. This function is not required to be
|
||||
implemented by subclasses. Note that the tab rectangle returned does not
|
||||
necessarily reflect _tabrect offset by the amount given - few people want to
|
||||
slide a tab right off the window - that would be a Bad Thing (TM).
|
||||
*/
|
||||
BRect Decorator::SlideTab(float dx, float dy=0)
|
||||
{
|
||||
return BRect(0,0,0,0);
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Resizes the decorator frame
|
||||
\param dx x offset
|
||||
\param dy y offset
|
||||
|
||||
This is a required function for subclasses to implement - the default does nothing.
|
||||
Note that window resize flags should be followed and _frame should be resized
|
||||
accordingly. It would also be a wise idea to ensure that the window's rectangles
|
||||
are not inverted.
|
||||
*/
|
||||
void Decorator::ResizeBy(float x, float y)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Resizes the decorator frame
|
||||
\param pt Point containing the offsets
|
||||
|
||||
This is a required function for subclasses to implement - the default does nothing.
|
||||
Note that window resize flags should be followed and _frame should be resized
|
||||
accordingly. It would also be a wise idea to ensure that the window's rectangles
|
||||
are not inverted.
|
||||
*/
|
||||
void Decorator::ResizeBy(BPoint pt)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Updates the decorator's look in the area r
|
||||
\param r The area to update.
|
||||
|
||||
The default version updates all areas which intersect the frame and tab.
|
||||
*/
|
||||
void Decorator::Draw(BRect r)
|
||||
{
|
||||
_DrawTab(r & _tabrect);
|
||||
_DrawFrame(r & _frame);
|
||||
}
|
||||
|
||||
//! Forces a complete decorator update
|
||||
void Decorator::Draw(void)
|
||||
{
|
||||
_DrawTab(_tabrect);
|
||||
_DrawFrame(_frame);
|
||||
}
|
||||
|
||||
//! Draws the close button
|
||||
void Decorator::DrawClose(void)
|
||||
{
|
||||
_DrawClose(_closerect);
|
||||
}
|
||||
|
||||
//! draws the frame
|
||||
void Decorator::DrawFrame(void)
|
||||
{
|
||||
_DrawFrame(_frame);
|
||||
}
|
||||
|
||||
//! draws the minimize button
|
||||
void Decorator::DrawMinimize(void)
|
||||
{
|
||||
_DrawTab(_minimizerect);
|
||||
}
|
||||
|
||||
//! draws the tab, title, and buttons
|
||||
void Decorator::DrawTab(void)
|
||||
{
|
||||
_DrawTab(_tabrect);
|
||||
_DrawZoom(_zoomrect);
|
||||
_DrawMinimize(_minimizerect);
|
||||
_DrawTitle(_tabrect);
|
||||
_DrawClose(_closerect);
|
||||
}
|
||||
|
||||
// draws the title
|
||||
void Decorator::DrawTitle(void)
|
||||
{
|
||||
_DrawTitle(_tabrect);
|
||||
}
|
||||
|
||||
//! draws the zoom button
|
||||
void Decorator::DrawZoom(void)
|
||||
{
|
||||
_DrawZoom(_zoomrect);
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Actually draws the close button
|
||||
\param r Area of the button to update
|
||||
|
||||
Unless a subclass has a particularly large button, it is probably unnecessary
|
||||
to check the update rectangle.
|
||||
*/
|
||||
void Decorator::_DrawClose(BRect r)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Actually draws the frame
|
||||
\param r Area of the frame to update
|
||||
*/
|
||||
void Decorator::_DrawFrame(BRect r)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Actually draws the minimize button
|
||||
\param r Area of the button to update
|
||||
|
||||
Unless a subclass has a particularly large button, it is probably unnecessary
|
||||
to check the update rectangle.
|
||||
*/
|
||||
void Decorator::_DrawMinimize(BRect r)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Actually draws the tab
|
||||
\param r Area of the tab to update
|
||||
|
||||
This function is called when the tab itself needs drawn. Other items, like the
|
||||
window title or buttons, should not be drawn here.
|
||||
*/
|
||||
void Decorator::_DrawTab(BRect r)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Actually draws the title
|
||||
\param r area of the title to update
|
||||
|
||||
The main tasks for this function are to ensure that the decorator draws the title
|
||||
only in its own area and drawing the title itself. Using B_OP_COPY for drawing
|
||||
the title is recommended because of the marked performance hit of the other
|
||||
drawing modes, but it is not a requirement.
|
||||
*/
|
||||
void Decorator::_DrawTitle(BRect r)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Actually draws the zoom button
|
||||
\param r Area of the button to update
|
||||
|
||||
Unless a subclass has a particularly large button, it is probably unnecessary
|
||||
to check the update rectangle.
|
||||
*/
|
||||
void Decorator::_DrawZoom(BRect r)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Returns the "footprint" of the entire window, including decorator
|
||||
\return Region representing the window's screen footprint
|
||||
|
||||
This function should generate a new BRegion allocated on the heap which represents
|
||||
the entire area occupied by the window decorator on the screen. For example, a BeOS
|
||||
decorator would return _tabrect + _borderrect.
|
||||
|
||||
This function is required by all subclasses.
|
||||
*/
|
||||
BRegion *Decorator::GetFootprint(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Performs hit-testing for the decorator
|
||||
\return The type of area clicked
|
||||
|
||||
Clicked is called whenever it has been determined that the window has received a
|
||||
mouse click. The default version returns CLICK_NONE. A subclass may use any or all
|
||||
of them.
|
||||
|
||||
Click type : Action taken by the server
|
||||
|
||||
- \c CLICK_NONE : Do nothing
|
||||
- \c CLICK_ZOOM : Handles the zoom button (setting states, etc)
|
||||
- \c CLICK_CLOSE : Handles the close button (setting states, etc)
|
||||
- \c CLICK_MINIMIZE : Handles the minimize button (setting states, etc)
|
||||
- \c CLICK_TAB : Currently unused
|
||||
- \c CLICK_DRAG : Moves the window to the front and prepares to move the window
|
||||
- \c CLICK_MOVETOBACK : Moves the window to the back of the stack
|
||||
- \c CLICK_MOVETOFRONT : Moves the window to the front of the stack
|
||||
- \c CLICK_SLIDETAB : Initiates tab-sliding, including calling SlideTab()
|
||||
|
||||
- \c CLICK_RESIZE : Handle window resizing as appropriate
|
||||
- \c CLICK_RESIZE_L
|
||||
- \c CLICK_RESIZE_T
|
||||
- \c CLICK_RESIZE_R
|
||||
- \c CLICK_RESIZE_B
|
||||
- \c CLICK_RESIZE_LT
|
||||
- \c CLICK_RESIZE_RT
|
||||
- \c CLICK_RESIZE_LB
|
||||
- \c CLICK_RESIZE_RB
|
||||
|
||||
This function is required by all subclasses.
|
||||
|
||||
*/
|
||||
click_type Decorator::Clicked(BPoint pt, int32 buttons, int32 modifiers)
|
||||
{
|
||||
return CLICK_NONE;
|
||||
}
|
||||
|
|
@ -0,0 +1,124 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// 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: Decorator.h
|
||||
// Author: DarkWyrm <bpmagic@columbus.rr.com>
|
||||
// Description: Base class for window decorators
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
#ifndef _DECORATOR_H_
|
||||
#define _DECORATOR_H_
|
||||
|
||||
#include <SupportDefs.h>
|
||||
#include <Rect.h>
|
||||
#include <String.h>
|
||||
#include <Window.h>
|
||||
#include "LayerData.h"
|
||||
#include "ColorSet.h"
|
||||
|
||||
class DisplayDriver;
|
||||
|
||||
typedef enum { CLICK_NONE=0, CLICK_ZOOM, CLICK_CLOSE, CLICK_MINIMIZE,
|
||||
CLICK_TAB, CLICK_DRAG, CLICK_MOVETOBACK, CLICK_MOVETOFRONT, CLICK_SLIDETAB,
|
||||
|
||||
CLICK_RESIZE, CLICK_RESIZE_L, CLICK_RESIZE_T,
|
||||
CLICK_RESIZE_R, CLICK_RESIZE_B, CLICK_RESIZE_LT, CLICK_RESIZE_RT,
|
||||
CLICK_RESIZE_LB, CLICK_RESIZE_RB } click_type;
|
||||
|
||||
class Decorator
|
||||
{
|
||||
public:
|
||||
Decorator(BRect rect, int32 wlook, int32 wfeel, int32 wflags);
|
||||
virtual ~Decorator(void);
|
||||
|
||||
void SetColors(const ColorSet &cset);
|
||||
void SetDriver(DisplayDriver *driver);
|
||||
void SetFlags(int32 wflags);
|
||||
void SetFeel(int32 wfeel);
|
||||
void SetLook(int32 wlook);
|
||||
|
||||
void SetClose(bool is_down);
|
||||
void SetMinimize(bool is_down);
|
||||
void SetZoom(bool is_down);
|
||||
virtual void SetTitle(const char *string);
|
||||
|
||||
int32 GetLook(void);
|
||||
int32 GetFeel(void);
|
||||
int32 GetFlags(void);
|
||||
const char *GetTitle(void);
|
||||
|
||||
bool GetClose(void);
|
||||
bool GetMinimize(void);
|
||||
bool GetZoom(void);
|
||||
|
||||
|
||||
void SetFocus(bool is_active);
|
||||
bool GetFocus(void) { return _has_focus; };
|
||||
ColorSet GetColors(void) { return (_colors)?*_colors:ColorSet(); }
|
||||
|
||||
virtual BRect SlideTab(float dx, float dy=0);
|
||||
virtual BRegion *GetFootprint(void);
|
||||
virtual click_type Clicked(BPoint pt, int32 buttons, int32 modifiers);
|
||||
|
||||
virtual void MoveBy(float x, float y);
|
||||
virtual void MoveBy(BPoint pt);
|
||||
virtual void ResizeBy(float x, float y);
|
||||
virtual void ResizeBy(BPoint pt);
|
||||
|
||||
virtual void Draw(BRect r);
|
||||
virtual void Draw(void);
|
||||
virtual void DrawClose(void);
|
||||
virtual void DrawFrame(void);
|
||||
virtual void DrawMinimize(void);
|
||||
virtual void DrawTab(void);
|
||||
virtual void DrawTitle(void);
|
||||
virtual void DrawZoom(void);
|
||||
|
||||
protected:
|
||||
int32 _ClipTitle(float width);
|
||||
int32 _TitleWidth(void) { return (_title_string)?_title_string->CountChars():0; }
|
||||
|
||||
virtual void _DrawClose(BRect r);
|
||||
virtual void _DrawFrame(BRect r);
|
||||
virtual void _DrawMinimize(BRect r);
|
||||
virtual void _DrawTab(BRect r);
|
||||
virtual void _DrawTitle(BRect r);
|
||||
virtual void _DrawZoom(BRect r);
|
||||
virtual void _SetFocus(void)=0;
|
||||
virtual void _DoLayout(void)=0;
|
||||
|
||||
ColorSet *_colors;
|
||||
DisplayDriver *_driver;
|
||||
LayerData _layerdata;
|
||||
int32 _look, _feel, _flags;
|
||||
BRect _zoomrect,_closerect,_minimizerect,_tabrect,_frame,
|
||||
_resizerect,_borderrect;
|
||||
|
||||
private:
|
||||
bool _close_state, _zoom_state, _minimize_state;
|
||||
bool _has_focus;
|
||||
BString *_title_string;
|
||||
};
|
||||
|
||||
typedef float get_version(void);
|
||||
typedef Decorator *create_decorator(BRect rect, int32 wlook, int32 wfeel, int32 wflags);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,35 @@
|
|||
SubDir OBOS_TOP src servers app server ;
|
||||
|
||||
AddResources app_server : app_server.rsrc ;
|
||||
|
||||
UseFreeTypeHeaders ;
|
||||
|
||||
Server app_server :
|
||||
# Misc. Sources
|
||||
Angle.cpp
|
||||
# ColorUtils will disappear as soon as I can figure out how to link the server
|
||||
# against libopenbeos
|
||||
ColorUtils.cc
|
||||
ColorSet.cpp
|
||||
Decorator.cpp
|
||||
SystemPalette.cpp
|
||||
RGBColor.cpp
|
||||
RectUtils.cpp
|
||||
|
||||
# Operating Classes
|
||||
AppServer.cpp
|
||||
ServerBitmap.cpp
|
||||
ServerCursor.cpp
|
||||
|
||||
# Font Classes
|
||||
FontFamily.cpp
|
||||
FontServer.cpp
|
||||
ServerFont.cpp
|
||||
|
||||
# Display Modules
|
||||
DisplayDriver.cpp
|
||||
AccelerantDriver.cpp
|
||||
;
|
||||
LinkSharedOSLibs app_server : be root game translation
|
||||
<boot!home!config!lib>libfreetype.so ;
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
#ifndef LAYERDATA_H_
|
||||
#define LAYERDATA_H_
|
||||
|
||||
#include <Point.h>
|
||||
#include <Font.h>
|
||||
#include "RGBColor.h"
|
||||
#include "FontServer.h"
|
||||
#include "ServerFont.h"
|
||||
|
||||
class ServerBitmap;
|
||||
|
||||
class LayerData
|
||||
{
|
||||
public:
|
||||
LayerData(void)
|
||||
{
|
||||
pensize=1.0;
|
||||
penlocation.Set(0,0);
|
||||
draw_mode=B_OP_COPY;
|
||||
blending_mode=B_ALPHA_OVERLAY;
|
||||
alpha_mode=B_CONSTANT_ALPHA;
|
||||
background=NULL;
|
||||
overlay=NULL;
|
||||
highcolor.SetColor(0,0,0,255);
|
||||
lowcolor.SetColor(255,255,255,255);
|
||||
font=fontserver->GetSystemPlain();
|
||||
scale=1.0;
|
||||
edelta.space=0;
|
||||
edelta.nonspace=0;
|
||||
}
|
||||
~LayerData(void)
|
||||
{
|
||||
if(font)
|
||||
{
|
||||
delete font;
|
||||
font=NULL;
|
||||
}
|
||||
}
|
||||
|
||||
float pensize;
|
||||
BPoint penlocation;
|
||||
drawing_mode draw_mode;
|
||||
source_alpha alpha_mode;
|
||||
alpha_function blending_mode;
|
||||
ServerBitmap *background;
|
||||
ServerBitmap *overlay;
|
||||
RGBColor highcolor, lowcolor;
|
||||
ServerFont *font;
|
||||
float scale;
|
||||
escapement_delta edelta;
|
||||
};
|
||||
#endif
|
|
@ -0,0 +1,63 @@
|
|||
#include "RectUtils.h"
|
||||
|
||||
bool TestRectIntersection(const BRect &r,const BRect &r2)
|
||||
{
|
||||
return TestLineIntersection(r, r2.left, r2.top, r2.left, r2.bottom) ||
|
||||
TestLineIntersection(r, r2.left, r2.top, r2.right, r2.top, false) ||
|
||||
TestLineIntersection(r, r2.right, r2.top, r2.right, r2.bottom) ||
|
||||
TestLineIntersection(r, r2.left, r2.bottom, r2.right, r2.bottom, false) ||
|
||||
r.Contains(r2) ||
|
||||
r2.Contains(r);
|
||||
}
|
||||
|
||||
bool TestRegionIntersection(BRegion *r,const BRect &r2)
|
||||
{
|
||||
for(int32 i=0; i<r->CountRects(); i++)
|
||||
if(TestRectIntersection(r->RectAt(i),r2));
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void IntersectRegionWith(BRegion *r,const BRect &r2)
|
||||
{
|
||||
// We have three conditions:
|
||||
// 1) Region frame contains rect. Action: call Include()
|
||||
// 2) Rect intersects region frame. Action: call IntersectWith
|
||||
// 3) Region frame does not intersect rectangle. Make the region empty
|
||||
if(r->Frame().Contains(r2))
|
||||
r->Include(r2);
|
||||
if(r->Frame().Intersects(r2))
|
||||
{
|
||||
BRegion reg(r2);
|
||||
r->IntersectWith(®);
|
||||
}
|
||||
else
|
||||
r->MakeEmpty();
|
||||
}
|
||||
|
||||
bool TestLineIntersection(const BRect& r, float x1, float y1, float x2, float y2,
|
||||
bool vertical)
|
||||
{
|
||||
if (vertical)
|
||||
{
|
||||
return (x1 >= r.left && x1 <= r.right) &&
|
||||
((y1 >= r.top && y1 <= r.bottom) ||
|
||||
(y2 >= r.top && y2 <= r.bottom));
|
||||
}
|
||||
else
|
||||
{
|
||||
return (y1 >= r.top && y1 <= r.bottom) &&
|
||||
((x1 >= r.left && x1 <= r.right) ||
|
||||
(x2 >= r.left && x2 <= r.right));
|
||||
}
|
||||
}
|
||||
|
||||
void ValidateRect(BRect *rect)
|
||||
{
|
||||
float l,r,t,b;
|
||||
l=(rect->left<rect->right)?rect->left:rect->right;
|
||||
r=(rect->left>rect->right)?rect->left:rect->right;
|
||||
t=(rect->top<rect->bottom)?rect->top:rect->bottom;
|
||||
b=(rect->top>rect->bottom)?rect->top:rect->bottom;
|
||||
rect->Set(l,t,r,b);
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef RECTUTILS_H_
|
||||
#define RECTUTILS_H_
|
||||
|
||||
#include <Rect.h>
|
||||
#include <Region.h>
|
||||
|
||||
bool TestLineIntersection(const BRect&r, float x1, float y1, float x2, float y2,bool vertical=true);
|
||||
bool TestRectIntersection(const BRect &r,const BRect &r2);
|
||||
bool TestRegionIntersection(BRegion *r,const BRect &r2);
|
||||
void IntersectRegionWith(BRegion *r,const BRect &r2);
|
||||
void ValidateRect(BRect *r);
|
||||
#endif
|
Binary file not shown.
Loading…
Reference in New Issue