haiku/headers/private/app/LinkReceiver.h
Stephan Aßmus 991547ef6c Patch by Artur Wyszynski:
* Implemented BGradient, BGradientLinear, BGradientRadial,
  BGradientDiamond, BGradientConic and BGradientRadialFocus
  new Interface Kit classes.
* Implemented all the (AGG-based) backend necessary in
  the app_server to render gradients (Painter, DrawingEngine)
* app_server/View can convert a BGradient layout to screen
  coordinates.
* Added BGradient methods of the Fill* methods in BView.
* Implemented a test app and added it to the image as a
  demo.
* Adopted Icon-O-Matic and libs/icon in order to avoid
  clashing with the new BGradient class. Re-use some
  parts where possible.

Awesome work, Artur! Thanks a lot. Now a more modern
looking GUI has just become much easier to implement! :-)

TODO:
* Remove the need to have gradient type twice in the
  app_server protocol.
* Refactor some parts of the patch to remove duplicated
  code (Painter, DrawingEngine).
* Adopt the BPicture protocol to know about BGradients.
* Review some parts of the BArchivable implementation.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28109 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-14 21:27:42 +00:00

67 lines
1.6 KiB
C++

/*
* Copyright 2001-2006, Haiku.
* Distributed under the terms of the MIT License.
*
* Authors:
* DarkWyrm <bpmagic@columbus.rr.com>
* Pahtz <pahtz@yahoo.com.au>
* Axel Dörfler, axeld@pinc-software.de
*/
#ifndef _LINK_RECEIVER_H
#define _LINK_RECEIVER_H
#include <OS.h>
class BString;
class BRegion;
class BGradient;
namespace BPrivate {
class LinkReceiver {
public:
LinkReceiver(port_id port);
virtual ~LinkReceiver(void);
void SetPort(port_id port);
port_id Port(void) { return fReceivePort; }
status_t GetNextMessage(int32& code, bigtime_t timeout = B_INFINITE_TIMEOUT);
bool HasMessages() const;
bool NeedsReply() const;
int32 Code() const;
virtual status_t Read(void* data, ssize_t size);
status_t ReadString(char** _string, size_t* _length = NULL);
status_t ReadString(BString& string, size_t* _length = NULL);
status_t ReadString(char* buffer, size_t bufferSize);
status_t ReadRegion(BRegion* region);
status_t ReadGradient(BGradient *gradient);
template <class Type> status_t Read(Type *data)
{ return Read(data, sizeof(Type)); }
protected:
virtual status_t ReadFromPort(bigtime_t timeout);
virtual status_t AdjustReplyBuffer(bigtime_t timeout);
void ResetBuffer();
port_id fReceivePort;
char* fRecvBuffer;
int32 fRecvPosition; //current read position
int32 fRecvStart; //start of current message
int32 fRecvBufferSize;
int32 fDataSize; //size of data in recv buffer
int32 fReplySize; //size of current reply message
status_t fReadError; //Read failed for current message
};
} // namespace BPrivate
#endif // _LINK_RECEIVER_H