Initial checkin for Gabe Yoder.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@739 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
ejakowatz
2002-08-13 14:02:00 +00:00
parent 854fc92a7c
commit 54831cd6f1
2 changed files with 264 additions and 82 deletions
+45 -22
View File
@@ -1,34 +1,58 @@
/******************************************************************************
/
/ File: Clipboard.h
/
/ Description: BClipboard class defines clipboard functionality.
/ The global be_clipboard represents the default clipboard.
/
/ Copyright 1995-98, Be Incorporated, All Rights Reserved.
/
*******************************************************************************/
//------------------------------------------------------------------------------
// 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: Clipboard.h
// Author: Gabe Yoder ([email protected])
// Description: BClipboard provides an interface to a system-wide clipboard
// storage area.
//------------------------------------------------------------------------------
#ifndef _CLIPBOARD_H
#define _CLIPBOARD_H
// Standard Includes -----------------------------------------------------------
// System Includes -------------------------------------------------------------
#include <BeBuild.h>
#include <Messenger.h>
#include <Locker.h>
// Project Includes ------------------------------------------------------------
// Local Includes --------------------------------------------------------------
// Local Defines ---------------------------------------------------------------
// Globals ---------------------------------------------------------------------
class BMessage;
enum {
B_CLIPBOARD_CHANGED = 'CLCH'
};
/*------------------------------------------------------------------*/
/*----- BClipboard class --------------------------------------------*/
// BClipboard class ---------------------------------------------------------------
class BClipboard {
public:
BClipboard(const char *name, bool transient = false);
virtual ~BClipboard();
virtual ~BClipboard();
const char *Name() const;
@@ -53,9 +77,9 @@ private:
BClipboard(const BClipboard &);
BClipboard &operator=(const BClipboard &);
virtual void _ReservedClipboard1();
virtual void _ReservedClipboard2();
virtual void _ReservedClipboard3();
virtual void _ReservedClipboard1();
virtual void _ReservedClipboard2();
virtual void _ReservedClipboard3();
bool AssertLocked() const;
status_t DownloadFromSystem(bool force = false);
@@ -71,12 +95,11 @@ virtual void _ReservedClipboard3();
uint32 _reserved[4];
};
/*----------------------------------------------------------------*/
/*----- Global Clipboard -----------------------------------------*/
//----- Global Clipboard -------------------------------------------------------
extern _IMPEXP_BE BClipboard *be_clipboard;
/*-------------------------------------------------------------*/
/*-------------------------------------------------------------*/
//------------------------------------------------------------------------------
#endif // _CLIPBOARD_H
#endif /* _CLIPBOARD_H */
+159
View File
@@ -0,0 +1,159 @@
//------------------------------------------------------------------------------
// 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: Clipboard.cpp
// Author: Gabe Yoder ([email protected])
// Description: BClipboard provides an interface to a system-wide clipboard
// storage area.
//------------------------------------------------------------------------------
// Standard Includes -----------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
// System Includes -------------------------------------------------------------
#include <Clipboard.h>
// Project Includes ------------------------------------------------------------
// Local Includes --------------------------------------------------------------
// Local Defines ---------------------------------------------------------------
// Globals ---------------------------------------------------------------------
//------------------------------------------------------------------------------
BClipboard::BClipboard(const char *name, bool transient = false)
{
/* Not complete yet */
fName = strdup(name);
fData = new BMessage();
}
//------------------------------------------------------------------------------
BClipboard::~BClipboard()
{
/* Not complete yet? */
free(fName);
delete fData;
}
//------------------------------------------------------------------------------
const char* BClipboard::Name() const
{
return (const char*)fName;
}
//------------------------------------------------------------------------------
uint32 BClipboard::LocalCount() const
{
return fCount;
}
//------------------------------------------------------------------------------
uint32 BClipboard::SystemCount() const
{
/* Need to upload count data from app server, and update fCount */
return fCount;
}
//------------------------------------------------------------------------------
status_t BClipboard::StartWatching(BMessenger target)
{
}
//------------------------------------------------------------------------------
status_t BClipboard::StopWatching(BMessenger target)
{
}
//------------------------------------------------------------------------------
bool BClipboard::Lock()
{
bool retVal;
retVal = fLock.Lock();
/* Still need to upload clipboard data to fData */
/* Involves something with DownloadFromSystem */
return retVal;
}
//------------------------------------------------------------------------------
void BClipboard::Unlock()
{
fLock.Unlock();
}
//------------------------------------------------------------------------------
bool BClipboard::IsLocked() const
{
return fLock.IsLocked();
}
//------------------------------------------------------------------------------
status_t BClipboard::Clear()
{
}
//------------------------------------------------------------------------------
status_t BClipboard::Commit()
{
}
//------------------------------------------------------------------------------
status_t BClipboard::Revert()
{
}
//------------------------------------------------------------------------------
BMessenger BClipboard::DataSource() const
{
}
//------------------------------------------------------------------------------
BMessage* BClipboard::Data() const
{
if ( IsLocked() )
return fData;
return NULL;
}
//------------------------------------------------------------------------------
BClipboard::BClipboard(const BClipboard &)
{
}
//------------------------------------------------------------------------------
BClipboard & BClipboard::operator=(const BClipboard &)
{
}
//------------------------------------------------------------------------------
void BClipboard::_ReservedClipboard1()
{
}
//------------------------------------------------------------------------------
void BClipboard::_ReservedClipboard2()
{
}
//------------------------------------------------------------------------------
void BClipboard::_ReservedClipboard3()
{
}
//------------------------------------------------------------------------------
bool BClipboard::AssertLocked() const
{
}
//------------------------------------------------------------------------------
status_t BClipboard::DownloadFromSystem(bool force=false)
{
}
//------------------------------------------------------------------------------
status_t BClipboard::UploadToSystem()
{
}
//------------------------------------------------------------------------------