/*
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include <boost/shared_ptr.hpp>

int main (int argc, char** argv);

namespace winBe {


void debugMessage (const std::string&);

// Timer functions
int setTimer (int milliseconds);
void deleteTimer (int id);
void sendPulse ();

// Window functions
void createWindow (BWindow* window, std::string title, int left, int top, int right, int bottom);
bool callWindowQuitRequested (BWindow* window);
void destroyWindow (BWindow* window);
std::list<BWindow*> getWindowList ();
void getClientRect (BWindow* window, int&, int&, int&, int&);
void getWindowFurnitureSize (BWindow*, int&, int&);
void getWindowSize (BWindow*, int&, int&);
void setWindowSize (BWindow*, int, int);
void updateWindow (BWindow*);

// View functions
void createView (BView* view, BWindow* parent, const char* name, int left, int top, int right, int bottom);
void createView (BView* view, BView* parent, const char* name, int left, int top, int right, int bottom);
void destroyView (BView* view);
void setViewColor (BView* view, int red, int green, int blue);
void sendViewMouseUpMessage (BView* view, int buttons, int xpos, int ypos, int modifiers);
void sendViewMouseDownMessage (BView* view, int buttons, int xpos, int ypos, int modifiers);
void sendViewMouseMovedMessage (BView* view, int xpos, int ypos);
void callViewDraw (BView*, int left, int right, int top, int bottom);
void invalidate (BView*, int left, int right, int top, int bottom);
void captureMouse (BView* view);
void captureKeyboard (BView* view);

// Font functions
void initFonts ();
void cleanupFonts ();
unsigned long createFont (std::string face, int size, bool bold, bool italic);
void deleteFont (unsigned long font);
void stringDimensions (unsigned long font, const char* string, int length, int& width, int& height);

// Graphics structures
struct LineArray {
	int pt0_x;
	int pt0_y;
	int pt1_x;
	int pt1_y;
	int red;
	int green;
	int blue;
};

// Graphics functions
void drawString (BView* view, const char* text, int length, int x, int y, int red, int green, int blue);
void drawLine (BView* view, int x1, int y1, int x2, int y2);
void setPen (BView* view, int width, int red, int green, int blue);
void selectFont (BView* view, unsigned long font);
void fillRect (BView* view, int left, int top, int right, int bottom, int red, int green, int blue);
void drawLineArray (BView* view, winBe::LineArray* lineArray, int size, int penSize);
void drawEllipse (BView* view, int left, int top, int right, int bottom);
void fillEllipse (BView* view, int left, int top, int right, int bottom, int red, int green, int blue);

// Semaphore functions
sem_id createSemaphore ();
void deleteSemaphore (sem_id sem);
bool lockSemaphore (sem_id sem);
void unlockSemaphore (sem_id sem);

// Message structures
class MessageData {
public:
	MessageData () : data (0) { ; };

	int data_type;
	void* data;
};

// Message functions
bool postMessage (thread_id threadId, BMessage* message, unsigned long what);
void postQuitMessage (thread_id threadId);
std::string getMessageChars (unsigned long what);
BMessage* getMessage ();

} // namespace winBe
