From 57dab374cd9259f53138f36df5d2d9c7c1470a18 Mon Sep 17 00:00:00 2001 From: ocoursiere Date: Sun, 30 Mar 2003 15:01:44 +0000 Subject: [PATCH] ListView, OutlineListView, and Alert support by baldur --- bepascal/bepascal/be/interface/Alert.cpp | 534 +++++++++ bepascal/bepascal/be/interface/ListItem.cpp | 503 ++++++++ bepascal/bepascal/be/interface/ListView.cpp | 1031 +++++++++++++++++ .../bepascal/be/interface/OutlineListView.cpp | 755 ++++++++++++ bepascal/bepascal/be/interface/alert.pp | 320 +++++ bepascal/bepascal/be/interface/listitem.pp | 352 ++++++ bepascal/bepascal/be/interface/listview.h | 79 ++ bepascal/bepascal/be/interface/listview.pp | 548 +++++++++ .../bepascal/be/interface/outlinelistview.pp | 357 ++++++ 9 files changed, 4479 insertions(+) create mode 100644 bepascal/bepascal/be/interface/Alert.cpp create mode 100644 bepascal/bepascal/be/interface/ListItem.cpp create mode 100644 bepascal/bepascal/be/interface/ListView.cpp create mode 100644 bepascal/bepascal/be/interface/OutlineListView.cpp create mode 100644 bepascal/bepascal/be/interface/alert.pp create mode 100644 bepascal/bepascal/be/interface/listitem.pp create mode 100644 bepascal/bepascal/be/interface/listview.h create mode 100644 bepascal/bepascal/be/interface/listview.pp create mode 100644 bepascal/bepascal/be/interface/outlinelistview.pp diff --git a/bepascal/bepascal/be/interface/Alert.cpp b/bepascal/bepascal/be/interface/Alert.cpp new file mode 100644 index 0000000..27bb834 --- /dev/null +++ b/bepascal/bepascal/be/interface/Alert.cpp @@ -0,0 +1,534 @@ +/* BePascal - A pascal wrapper around the BeOS API + Copyright (C) 2003 Olivier Coursiere + Eric Jourde + Oscar Lesta + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +#ifndef _ALERT_CPP_ +#define _ALERT_CPP_ + +#include +#include "window.h" +#include "looper.h" +#include + +/*----------------------------------------------------------------*/ +/*----- BAlert class ---------------------------------------------*/ + +class BPAlert : public BAlert, public virtual BPWindow // Is this OK? or should be public virtual? +{ +public: + BPAlert(TPasObject PasObject, + const char *title, + const char *text, + const char *button1, + const char *button2 = NULL, + const char *button3 = NULL, + button_width width = B_WIDTH_AS_USUAL, + alert_type type = B_INFO_ALERT); + BPAlert(TPasObject PasObject, + const char *title, + const char *text, + const char *button1, + const char *button2, + const char *button3, + button_width width, + button_spacing spacing, + alert_type type = B_INFO_ALERT); + BPAlert(TPasObject PasObject, BMessage *data); + +//virtual ~BAlert(); + +/* Archiving */ +static BArchivable *Instantiate(BMessage *data); +//virtual status_t Archive(BMessage *data, bool deep = true) const; + +/* BAlert guts */ + void SetShortcut(int32 button_index, char key); + char Shortcut(int32 button_index) const; + + int32 Go(); + status_t Go(BInvoker *invoker); + +virtual void MessageReceived(BMessage *an_event); +virtual void FrameResized(float new_width, float new_height); + BButton *ButtonAt(int32 index) const; + BTextView *TextView() const; +/* +virtual BHandler *ResolveSpecifier(BMessage *msg, + int32 index, + BMessage *specifier, + int32 form, + const char *property); +virtual status_t GetSupportedSuites(BMessage *data); +*/ +virtual void DispatchMessage(BMessage *msg, BHandler *handler); +virtual void Quit(); +virtual bool QuitRequested(); + +static BPoint AlertPosition(float width, float height); + +/*----- Private or reserved -----------------------------------------*/ +//virtual status_t Perform(perform_code d, void *arg); + +private: +/* +friend class _BAlertFilter_; + +virtual void _ReservedAlert1(); +virtual void _ReservedAlert2(); +virtual void _ReservedAlert3(); + + void InitObject(const char *text, + const char *button1, + const char *button2 = NULL, + const char *button3 = NULL, + button_width width = B_WIDTH_AS_USUAL, + button_spacing spacing = B_EVEN_SPACING, + alert_type type = B_INFO_ALERT); + BBitmap *InitIcon(); + + sem_id fAlertSem; + int32 fAlertVal; + BButton *fButtons[3]; + BTextView *fTextView; + char fKeys[3]; + alert_type fMsgType; + button_width fButtonWidth; + BInvoker *fInvoker; + uint32 _reserved[4]; +*/ +}; +/*-------------------------------------------------------------*/ +/*-------------------------------------------------------------*/ + +BPAlert::BPAlert(TPasObject PasObject, + const char *title, + const char *text, + const char *button1, + const char *button2 = NULL, + const char *button3 = NULL, + button_width width = B_WIDTH_AS_USUAL, + alert_type type = B_INFO_ALERT) + : BAlert(title, text, button1, button2, button3, width, type), + BPWindow(PasObject, BRect(), title, B_UNTYPED_WINDOW, 0, 0), + +// oco or Baldur : +// why this doesn't work? compiler says: +// BPWindow doesn't have a BPLooper member. The same with BPArchivable. + +// BPLooper(PasObject), + BPHandler(PasObject, title), +// BPArchivable(PasObject), + BPasObject(PasObject) +{ + +} + +BPAlert::BPAlert(TPasObject PasObject, + const char *title, + const char *text, + const char *button1, + const char *button2, + const char *button3, + button_width width, + button_spacing spacing, + alert_type type = B_INFO_ALERT) + : BAlert(title, text, button1, button2, button3, width, spacing, type), + BPWindow(PasObject, BRect(), title, B_UNTYPED_WINDOW, 0, 0), +// BPLooper(PasObject), + BPHandler(PasObject, title), +// BPArchivable(PasObject), + BPasObject(PasObject) +{ + +} + +BPAlert::BPAlert(TPasObject PasObject, BMessage *data) + : BAlert(data), +// UGLY HACK!!! FIX ME!!! (should be "BPWindow(PasObject, data)" ) + BPWindow(PasObject, BRect(), "Ugly_Hack!", B_UNTYPED_WINDOW, 0, 0), +// BPLooper(PasObject), + BPHandler(PasObject), +// BPArchivable(PasObject), + BPasObject(PasObject) +{ + +} + +void +BPAlert::SetShortcut(int32 button_index, char key) +{ + BAlert::SetShortcut(button_index, key); +} + + +char +BPAlert::Shortcut(int32 button_index) const +{ + return BAlert::Shortcut(button_index); +} + + +int32 +BPAlert::Go(void) +{ + return BAlert::Go(); +} + +status_t +BPAlert::Go(BInvoker *invoker) +{ + return BAlert::Go(invoker); +} + +void +BPAlert::MessageReceived(BMessage *an_event) +{ + BAlert::MessageReceived(an_event); +} + +void +BPAlert::FrameResized(float new_width, float new_height) +{ + BAlert::FrameResized(new_width, new_height); +} + +void +BPAlert::DispatchMessage(BMessage *msg, BHandler *handler) +{ + BAlert::DispatchMessage(msg, handler); +} + +void +BPAlert::Quit(void) +{ + BAlert::Quit(); +} + +bool +BPAlert::QuitRequested(void) +{ + BAlert::QuitRequested(); +} + + +/*-------------------------------------------------------------*/ + +#if defined(__cplusplus) +extern "C" { +#endif + +/*----------------------------------------------------------------*/ + +/* + * Method: BAlert::BAlert() + * Descr: + */ +TCPlusObject BAlert_Create(TPasObject PasObject, const char *title, const char *text, const char *button1, const char *button2, const char *button3, button_width width, alert_type type) +{ + return new BPAlert(PasObject, title, text, button1, button2, button3, width, type); +} + + +/* + * Method: BAlert::BAlert() + * Descr: + */ +TCPlusObject BAlert_Create_1 +(TPasObject PasObject, const char *title, const char *text, const char *button1, const char *button2, const char *button3, button_width width, button_spacing spacing, alert_type type) +{ + return new BPAlert(PasObject, title, text, button1, button2, button3, width, spacing, type); +} + +/* + * Method: BAlert::BAlert() + * Descr: + */ +TCPlusObject BAlert_Create_2(TPasObject PasObject, BMessage *data) +{ + return new BPAlert(PasObject, data); +} + + +/* + * Method: BAlert::~BAlert() + * Descr: + */ +TCPlusObject BAlert_Free(BAlert *Alert) +{ + delete Alert; +} + + +/* + * Method: BAlert::Instantiate() + * Descr: + */ +BArchivable * +BAlert_Instantiate(BAlert *Alert, BMessage *data) +{ + return Alert->Instantiate(data); +} + + +/* + * Method: BAlert::Archive() + * Descr: + */ +status_t +BAlert_Archive(BAlert *Alert, BMessage *data, bool deep) +{ + return Alert->Archive(data, deep); +} + + +/* + * Method: BAlert::SetShortcut() + * Descr: + */ +void +BAlert_SetShortcut(BAlert *Alert, int32 button_index, char key) +{ + Alert->SetShortcut(button_index, key); +} + + +/* + * Method: BAlert::Shortcut() + * Descr: + */ +char +BAlert_Shortcut(BAlert *Alert, int32 button_index) +{ + return Alert->Shortcut(button_index); +} + + +/* + * Method: BAlert::Go() + * Descr: + */ +int32 +BAlert_Go(BAlert *Alert) +{ + return Alert->Go(); +} + + +/* + * Method: BAlert::Go() + * Descr: + */ +status_t +BAlert_Go_1 +(BAlert *Alert, BInvoker *invoker) +{ + return Alert->Go(invoker); +} + + +/* + * Method: BAlert::MessageReceived() + * Descr: + */ +void +BAlert_MessageReceived(BAlert *Alert, BMessage *an_event) +{ + Alert->MessageReceived(an_event); +} + + +/* + * Method: BAlert::FrameResized() + * Descr: + */ +void +BAlert_FrameResized(BAlert *Alert, float new_width, float new_height) +{ + Alert->FrameResized(new_width, new_height); +} + + +/* + * Method: BAlert::ButtonAt() + * Descr: + */ +BButton * +BAlert_ButtonAt(BAlert *Alert, int32 index) +{ + return Alert->ButtonAt(index); +} + + +/* + * Method: BAlert::TextView() + * Descr: + */ +BTextView * +BAlert_TextView(BAlert *Alert) +{ + return Alert->TextView(); +} + + +/* + * Method: BAlert::ResolveSpecifier() + * Descr: + */ +BHandler * +BAlert_ResolveSpecifier(BAlert *Alert, BMessage *msg, int32 index, BMessage *specifier, int32 form, const char *property) +{ + return Alert->ResolveSpecifier(msg, index, specifier, form, property); +} + + +/* + * Method: BAlert::GetSupportedSuites() + * Descr: + */ +status_t +BAlert_GetSupportedSuites(BAlert *Alert, BMessage *data) +{ + return Alert->GetSupportedSuites(data); +} + + +/* + * Method: BAlert::DispatchMessage() + * Descr: + */ +void +BAlert_DispatchMessage(BAlert *Alert, BMessage *msg, BHandler *handler) +{ + Alert->DispatchMessage(msg, handler); +} + + +/* + * Method: BAlert::Quit() + * Descr: + */ +void +BAlert_Quit(BAlert *Alert) +{ + Alert->Quit(); +} + + +/* + * Method: BAlert::QuitRequested() + * Descr: + */ +bool +BAlert_QuitRequested(BAlert *Alert) +{ + return Alert->QuitRequested(); +} + + +/* + * Method: BAlert::AlertPosition() + * Descr: + */ +BPoint +BAlert_AlertPosition(BAlert *Alert, float width, float height) +{ + return Alert->AlertPosition(width, height); +} + + +/* + * Method: BAlert::Perform() + * Descr: + */ +/* +status_t +BAlert_Perform(BAlert *Alert, perform_code d, void *arg) +{ + return Alert->Perform(d, arg); +} +*/ + +/* + * Method: BAlert::_ReservedAlert1() + * Descr: + */ +/* +void +BAlert__ReservedAlert1(BAlert *Alert) +{ + Alert->_ReservedAlert1(); +} +*/ + +/* + * Method: BAlert::_ReservedAlert2() + * Descr: + */ +/* +void +BAlert__ReservedAlert2(BAlert *Alert) +{ + Alert->_ReservedAlert2(); +} +*/ + +/* + * Method: BAlert::_ReservedAlert3() + * Descr: + */ +/* +void +BAlert__ReservedAlert3(BAlert *Alert) +{ + Alert->_ReservedAlert3(); +} +*/ + +/* + * Method: BAlert::InitObject() + * Descr: + */ +/* +void +BAlert_InitObject(BAlert *Alert, const char *text, const char *button1, const char *button2, const char *button3, button_width width, button_spacing spacing, alert_type type) +{ + Alert->InitObject(text, button1, button2, button3, width, spacing, type); +} +*/ + +/* + * Method: BAlert::InitIcon() + * Descr: + */ +/* +BBitmap * +BAlert_InitIcon(BAlert *Alert) +{ + return Alert->InitIcon(); +} +*/ + +/*----------------------------------------------------------------*/ + +#if defined(__cplusplus) +} +#endif + +/*----------------------------------------------------------------*/ + +#endif /* _ALERT_CPP_ */ diff --git a/bepascal/bepascal/be/interface/ListItem.cpp b/bepascal/bepascal/be/interface/ListItem.cpp new file mode 100644 index 0000000..53a5743 --- /dev/null +++ b/bepascal/bepascal/be/interface/ListItem.cpp @@ -0,0 +1,503 @@ +/* BePascal - A pascal wrapper around the BeOS API + Copyright (C) 2002 Olivier Coursiere + Eric Jourde + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef _LISTITEM_CPP_ +#define _LISTITEM_CPP_ +/*********************************************************************** + * AUTHOR: nobody + * FILE: StringView.cpp + * DATE: Mon Jan 13 21:52:29 2003 + * DESCR: + ***********************************************************************/ +#include "ListItem.h" +#include + + + +typedef void (*BListItem_DrawItem_hook) (TPasObject PasObject, TCPlusObject owner, TCPlusObject frame, bool complete ); +typedef void (*BListString_DrawItem_hook) (TPasObject PasObject, TCPlusObject owner, TCPlusObject frame, bool complete ); + +typedef void (*BListItem_Update_hook) (TPasObject PasObject, TCPlusObject owner, TCPlusObject font); +typedef void (*BListString_Update_hook) (TPasObject PasObject, TCPlusObject owner, TCPlusObject font); + + +#if defined(__cplusplus) +extern "C" { +#endif + +BListItem_DrawItem_hook ListItem_DrawItem_hook; +BListString_DrawItem_hook ListString_DrawItem_hook; +BListItem_Update_hook ListItem_Update_hook; +BListString_Update_hook ListString_Update_hook; + +#if defined(__cplusplus) +} +#endif +//////////////////////////////////////// +// BPListItem +//////////////////////////////////////// +class BPListItem : public BListItem, virtual public BPasObject +{ + public: + BPListItem(TPasObject PasObject,BMessage *data); + BPListItem(TPasObject PasObject,uint32 outlineLevel = 0, bool expanded = true); + + virtual void DrawItem(BView *owner, BRect frame, bool complete = false); + virtual void Update(BView *owner, const BFont *font); + private: +}; + + + +BPListItem::BPListItem(TPasObject PasObject,BMessage *data) + :BListItem(data), + BPasObject(PasObject) + +{ +} + +BPListItem::BPListItem(TPasObject PasObject, uint32 outlineLevel = 0, bool expanded = true) + :BListItem(outlineLevel,expanded), + BPasObject(PasObject) +{ +} + +void BPListItem::Update(BView *owner, const BFont *font) +{ + ListItem_Update_hook(GetPasObject(), &owner, &font); +} + +void BPListItem::DrawItem(BView *owner, BRect frame, bool complete = false) +{ + //BListItem::DrawItem(owner, frame, complete); + ListItem_DrawItem_hook(GetPasObject(), &owner, &frame, complete); +} + + +//////////////////////////////////////// +// BPStringItem +//////////////////////////////////////// + +class BPStringItem : public BStringItem , virtual public BPasObject +{ + public: + BPStringItem(TPasObject PasObject,const char *text,uint32 outlineLevel = 0, bool expanded = true); + BPStringItem(TPasObject PasObject,BMessage *data); + virtual void DrawItem(BView *owner, BRect frame, bool complete = false); + virtual void Update(BView *owner, const BFont *font); + private: +}; + +BPStringItem::BPStringItem(TPasObject PasObject,const char *text,uint32 outlineLevel = 0, bool expanded = true) + :BStringItem(text,outlineLevel,expanded), + //BPListItem(PasObject,outlineLevel,expanded), + BPasObject(PasObject) +{ +} + +BPStringItem::BPStringItem(TPasObject PasObject,BMessage *data) + :BStringItem(data), + //BPListItem(PasObject), + BPasObject(PasObject) +{ +} + +void BPStringItem::DrawItem(BView *owner, BRect frame, bool complete = false) +{ + BStringItem::DrawItem(owner, frame, complete); + ListString_DrawItem_hook(GetPasObject(), &owner, &frame, complete); + +} + +void BPStringItem::Update(BView *owner, const BFont *font) +{ + BStringItem::Update(owner, font); + ListString_Update_hook(GetPasObject(), &owner, &font); +} + +#if defined(__cplusplus) +extern "C" { +#endif + + + +/*********************************************************************** + * AUTHOR: nobody + * FILE: ListItem.cpp + * DATE: Mon Feb 3 20:25:49 2003 + * DESCR: + ***********************************************************************/ + + + + +TCPlusObject BListItem_Create(TPasObject PasObject, uint32 outlineLevel, bool expanded) +{ + return new BPListItem(PasObject, outlineLevel, expanded); +} + + +/*********************************************************************** + * Method: BListItem::BListItem + * Params: BMessage *data + * Effects: + ***********************************************************************/ +TCPlusObject BListItem_Create_1(TPasObject PasObject, BMessage *data) +{ + return new BPListItem(PasObject, data); +} + + +/*********************************************************************** + * Method: BListItem::~BListItem + * Params: + * Effects: + ***********************************************************************/ +void BListItem_Free(BListItem *ListItem) +{ + delete ListItem; +} + + +/*********************************************************************** + * Method: BListItem::Archive + * Params: BMessage *data, bool deep + * Returns: status_t + * Effects: + ***********************************************************************/ +status_t +BListItem_Archive(BListItem *ListItem, BMessage *data, bool deep) +{ + return ListItem->Archive(data, deep); +} + + +/*********************************************************************** + * Method: BListItem::Height + * Params: + * Returns: float + * Effects: + ***********************************************************************/ +float +BListItem_Height(BListItem *ListItem) +{ + return ListItem->Height(); +} + + +/*********************************************************************** + * Method: BListItem::Width + * Params: + * Returns: float + * Effects: + ***********************************************************************/ +float +BListItem_Width(BListItem *ListItem) +{ + return ListItem->Width(); +} + + +/*********************************************************************** + * Method: BListItem::IsSelected + * Params: + * Returns: bool + * Effects: + ***********************************************************************/ +bool +BListItem_IsSelected(BListItem *ListItem) +{ + return ListItem->IsSelected(); +} + + +/*********************************************************************** + * Method: BListItem::Select + * Params: + * Returns: void + * Effects: + ***********************************************************************/ +void +BListItem_Select(BListItem *ListItem) +{ + ListItem->Select(); +} + + +/*********************************************************************** + * Method: BListItem::Deselect + * Params: + * Returns: void + * Effects: + ***********************************************************************/ +void +BListItem_Deselect(BListItem *ListItem) +{ + ListItem->Deselect(); +} + + +/*********************************************************************** + * Method: BListItem::SetEnabled + * Params: bool on + * Returns: void + * Effects: + ***********************************************************************/ +void +BListItem_SetEnabled(BListItem *ListItem, bool on) +{ + ListItem->SetEnabled(on); +} + + +/*********************************************************************** + * Method: BListItem::IsEnabled + * Params: + * Returns: bool + * Effects: + ***********************************************************************/ +bool +BListItem_IsEnabled(BListItem *ListItem) +{ + return ListItem->IsEnabled(); +} + + +/*********************************************************************** + * Method: BListItem::SetHeight + * Params: float height + * Returns: void + * Effects: + ***********************************************************************/ +void +BListItem_SetHeight(BListItem *ListItem, float height) +{ + ListItem->SetHeight(height); +} + + +/*********************************************************************** + * Method: BListItem::SetWidth + * Params: float width + * Returns: void + * Effects: + ***********************************************************************/ +void +BListItem_SetWidth(BListItem *ListItem, float width) +{ + ListItem->SetWidth(width); +} + + +/*********************************************************************** + * Method: BListItem::Update + * Params: BView *owner, const BFont *font + * Returns: void + * Effects: + ***********************************************************************/ +void +BListItem_Update(BListItem *ListItem, BView *owner, const BFont *font) +{ + ListItem->Update(owner, font); +} + + +/*********************************************************************** + * Method: BListItem::Perform + * Params: perform_code d, void *arg + * Returns: status_t + * Effects: + ***********************************************************************/ +status_t +BListItem_Perform(BListItem *ListItem, perform_code d, void *arg) +{ + return ListItem->Perform(d, arg); +} + + +/*********************************************************************** + * Method: BListItem::IsExpanded + * Params: + * Returns: bool + * Effects: + ***********************************************************************/ +bool +BListItem_IsExpanded(BListItem *ListItem) +{ + return ListItem->IsExpanded(); +} + + +/*********************************************************************** + * Method: BListItem::SetExpanded + * Params: bool expanded + * Returns: void + * Effects: + ***********************************************************************/ +void +BListItem_SetExpanded(BListItem *ListItem, bool expanded) +{ + ListItem->SetExpanded(expanded); +} + + +/*********************************************************************** + * Method: BListItem::OutlineLevel + * Params: + * Returns: uint32 + * Effects: + ***********************************************************************/ +uint32 +BListItem_OutlineLevel(BListItem *ListItem) +{ + return ListItem->OutlineLevel(); +} + + +void BListItem_DrawItem(BListItem *ListItem, BView *owner, BRect frame, bool complete) +{ + ListItem->DrawItem(owner, frame, complete); +} + +TCPlusObject BStringItem_Create(TPasObject PasObject, const char *text, uint32 outlineLevel, bool expanded) +{ + return new BPStringItem(PasObject, text, outlineLevel, expanded); +} + + +/*********************************************************************** + * Method: BStringItem::~BStringItem + * Params: + * Effects: + ***********************************************************************/ +void BStringItem_Free(BStringItem *StringItem) +{ + return StringItem->~BStringItem(); +} + + +/*********************************************************************** + * Method: BStringItem::BStringItem + * Params: BMessage *data + * Effects: + ***********************************************************************/ +TCPlusObject BStringItem_Create_1(TPasObject PasObject, BMessage *data) +{ + return new BPStringItem(PasObject, data); +} + + +/*********************************************************************** + * Method: BStringItem::Instantiate + * Params: BMessage *data + * Returns: BArchivable * + * Effects: + ***********************************************************************/ +BArchivable * +BStringItem_Instantiate(BStringItem *StringItem, BMessage *data) +{ + return StringItem->Instantiate(data); +} + + +/*********************************************************************** + * Method: BStringItem::Archive + * Params: BMessage *data, bool deep + * Returns: status_t + * Effects: + ***********************************************************************/ +status_t +BStringItem_Archive(BStringItem *StringItem, BMessage *data, bool deep) +{ + return StringItem->Archive(data, deep); +} + + +/*********************************************************************** + * Method: BStringItem::DrawItem + * Params: BView *owner, BRect frame, bool complete + * Returns: void + * Effects: + ***********************************************************************/ +void +BStringItem_DrawItem(BStringItem *StringItem, BView *owner, BRect frame, bool complete) +{ + StringItem->DrawItem(owner, frame, complete); +} + + +/*********************************************************************** + * Method: BStringItem::SetText + * Params: const char *text + * Returns: void + * Effects: + ***********************************************************************/ +void +BStringItem_SetText(BStringItem *StringItem, const char *text) +{ + StringItem->SetText(text); +} + + +/*********************************************************************** + * Method: BStringItem::Text + * Params: + * Returns: const char * + * Effects: + ***********************************************************************/ +const char * +BStringItem_Text(BStringItem *StringItem) +{ + return StringItem->Text(); +} + + +/*********************************************************************** + * Method: BStringItem::Update + * Params: BView *owner, const BFont *font + * Returns: void + * Effects: + ***********************************************************************/ +void +BStringItem_Update(BStringItem *StringItem, BView *owner, const BFont *font) +{ + StringItem->Update(owner, font); +} + + +/*********************************************************************** + * Method: BStringItem::Perform + * Params: perform_code d, void *arg + * Returns: status_t + * Effects: + ***********************************************************************/ +status_t +BStringItem_Perform(BStringItem *StringItem, perform_code d, void *arg) +{ + return StringItem->Perform(d, arg); +} + + + +#if defined(__cplusplus) +} +#endif + +#endif /* _LISTITEM_CPP_ */ + diff --git a/bepascal/bepascal/be/interface/ListView.cpp b/bepascal/bepascal/be/interface/ListView.cpp new file mode 100644 index 0000000..3fe59df --- /dev/null +++ b/bepascal/bepascal/be/interface/ListView.cpp @@ -0,0 +1,1031 @@ +/* BePascal - A pascal wrapper around the BeOS API + Copyright (C) 2002 Olivier Coursiere + Eric Jourde + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef _LISTVIEW_CPP_ +#define _LISTVIEW_CPP_ + +#include "ListView.h" +#include "view.h" +#include +#include + + +typedef void (*BListItem_SelectionChanged_hook) (TPasObject PasObject); +typedef void (*BListString_InitiateDrag_hook) (TPasObject PasObject, TCPlusObject pt, int32 itemIndex, bool initialySelected ); + + +#if defined(__cplusplus) +extern "C" { +#endif + +BListItem_SelectionChanged_hook ListItem_SelectionChanged_hook; +BListString_InitiateDrag_hook ListString_InitiateDrag_hook; +#if defined(__cplusplus) +} +#endif + + +BPListView::BPListView(TPasObject PasObject,BMessage *data) + :BListView(data), + BPView(PasObject, data), + BPHandler(PasObject, data), + BPasObject(PasObject) +{ +} + +BPListView::BPListView(TPasObject PasObject,BRect frame, + const char *name, + list_view_type type = B_SINGLE_SELECTION_LIST, + uint32 resizeMask = B_FOLLOW_LEFT | + B_FOLLOW_TOP, + uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS | + B_NAVIGABLE) + :BListView(frame,name,type,resizeMask,flags), + BPView(PasObject, BRect(0,0,0,0), name, 0, flags), + BPHandler(PasObject, name), + BPasObject(PasObject) +{ +} + + +void BPListView::MessageReceived(BMessage *message) +{ + MessageReceived_hookCall(message); + BListView::MessageReceived(message); +} + +void BPListView::Draw(BRect updateRect) +{ + BListView::Draw(updateRect); + Draw_hookCall(updateRect); +} + +void BPListView::AttachedToWindow(void) +{ + //BTextView::AttachedToWindow(); + AttachedToWindow_hookCall(); +} + + + +void BPListView::AllAttached(void) +{ + //AllAttached_hookCall(); + BListView::AllAttached(); +} + +void BPListView::AllDetached(void) +{ + //AllDetached_hookCall(); + BListView::AllDetached(); +} + + +void BPListView::WindowActivated(bool active) +{ + BListView::WindowActivated(active); +} + +void BPListView::KeyDown(const char *bytes, int32 numBytes) +{ + BListView::KeyDown(bytes, numBytes); +} + + +void BPListView::FrameResized(float width, float height) +{ + FrameResized_hookCall(width, height); + BListView::FrameResized(width, height); +} + +void BPListView::DetachedFromWindow(void) +{ + BListView::DetachedFromWindow(); +} + + + +void BPListView::MouseDown(BPoint point) +{ + BListView::MouseDown(point); +} + +void BPListView::MouseMoved(BPoint point, uint32 transit, const BMessage *message) +{ + BListView::MouseMoved(point, transit, message); +} + +void BPListView::MouseUp(BPoint point) +{ + BListView::MouseUp(point); +} + +bool BPListView::InitiateDrag(BPoint pt, int32 itemIndex,bool initialySelected) +{ + ListString_InitiateDrag_hook(GetPasObject(), &pt, itemIndex, initialySelected); +} + +void BPListView::SelectionChanged() +{ + BListView::SelectionChanged(); + ListItem_SelectionChanged_hook(GetPasObject()); +} + + + + +#if defined(__cplusplus) +extern "C" { +#endif + +TCPlusObject BListView_Create(TPasObject PasObject,BRect frame, + const char *name, + list_view_type type = B_SINGLE_SELECTION_LIST, + uint32 resizeMask = B_FOLLOW_LEFT | + B_FOLLOW_TOP, + uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS | + B_NAVIGABLE) +{ + return new BPListView(PasObject,frame,name,type,resizeMask,flags); +} + +/*********************************************************************** + * Method: BListView::BListView + * Params: BMessage *data + * Effects: + ***********************************************************************/ +TCPlusObject BListView_Create_1(TPasObject PasObject, BMessage *data) +{ + return new BPListView(PasObject, data); +} + + +/*********************************************************************** + * Method: BListView::~BListView + * Params: + * Effects: + ***********************************************************************/ +void BListView_Free(BListView *ListView) +{ + delete ListView; +} + + +/*********************************************************************** + * Method: BListView::Instantiate + * Params: BMessage *data + * Returns: BArchivable * + * Effects: + ***********************************************************************/ +BArchivable * +BListView_Instantiate(BListView *ListView, BMessage *data) +{ + return ListView->Instantiate(data); +} + + +/*********************************************************************** + * Method: BListView::Archive + * Params: BMessage *data, bool deep + * Returns: status_t + * Effects: + ***********************************************************************/ +status_t +BListView_Archive(BListView *ListView, BMessage *data, bool deep) +{ + return ListView->Archive(data, deep); +} + + +/*********************************************************************** + * Method: BListView::Draw + * Params: BRect updateRect + * Returns: void + * Effects: + ***********************************************************************/ +void +BListView_Draw(BListView *ListView, BRect updateRect) +{ + ListView->Draw(updateRect); +} + + +/*********************************************************************** + * Method: BListView::MessageReceived + * Params: BMessage *msg + * Returns: void + * Effects: + ***********************************************************************/ +void +BListView_MessageReceived(BListView *ListView, BMessage *msg) +{ + ListView->MessageReceived(msg); +} + + +/*********************************************************************** + * Method: BListView::MouseDown + * Params: BPoint where + * Returns: void + * Effects: + ***********************************************************************/ +void +BListView_MouseDown(BListView *ListView, BPoint where) +{ + ListView->MouseDown(where); +} + + +/*********************************************************************** + * Method: BListView::KeyDown + * Params: const char *bytes, int32 numBytes + * Returns: void + * Effects: + ***********************************************************************/ +void +BListView_KeyDown(BListView *ListView, const char *bytes, int32 numBytes) +{ + ListView->KeyDown(bytes, numBytes); +} + + +/*********************************************************************** + * Method: BListView::MakeFocus + * Params: bool state + * Returns: void + * Effects: + ***********************************************************************/ +void +BListView_MakeFocus(BListView *ListView, bool state) +{ + ListView->MakeFocus(state); +} + + +/*********************************************************************** + * Method: BListView::FrameResized + * Params: float newWidth, float newHeight + * Returns: void + * Effects: + ***********************************************************************/ +void +BListView_FrameResized(BListView *ListView, float newWidth, float newHeight) +{ + ListView->FrameResized(newWidth, newHeight); +} + + +/*********************************************************************** + * Method: BListView::TargetedByScrollView + * Params: BScrollView *scroller + * Returns: void + * Effects: + ***********************************************************************/ +void +BListView_TargetedByScrollView(BListView *ListView, BScrollView *scroller) +{ + ListView->TargetedByScrollView(scroller); +} + + +/*********************************************************************** + * Method: BListView::ScrollTo + * Params: BPoint where + * Returns: void + * Effects: + ***********************************************************************/ +void +BListView_ScrollTo(BListView *ListView, BPoint where) +{ + ListView->ScrollTo(where); +} + + +/*********************************************************************** + * Method: BListView::AddItem + * Params: BListItem *item + * Returns: bool + * Effects: + ***********************************************************************/ +bool +BListView_AddItem(BListView *ListView, BListItem *item) +{ + return ListView->AddItem(item); +} + + +/*********************************************************************** + * Method: BListView::AddItem + * Params: BListItem *item, int32 atIndex + * Returns: bool + * Effects: + ***********************************************************************/ +bool +BListView_AddItem_1 +(BListView *ListView, BListItem *item, int32 atIndex) +{ + return ListView->AddItem(item, atIndex); +} + + +/*********************************************************************** + * Method: BListView::AddList + * Params: BList *newItems + * Returns: bool + * Effects: + ***********************************************************************/ +bool +BListView_AddList(BListView *ListView, BList *newItems) +{ + return ListView->AddList(newItems); +} + + +/*********************************************************************** + * Method: BListView::AddList + * Params: BList *newItems, int32 atIndex + * Returns: bool + * Effects: + ***********************************************************************/ +bool +BListView_AddList_1 +(BListView *ListView, BList *newItems, int32 atIndex) +{ + return ListView->AddList(newItems, atIndex); +} + + +/*********************************************************************** + * Method: BListView::RemoveItem + * Params: BListItem *item + * Returns: bool + * Effects: + ***********************************************************************/ +bool +BListView_RemoveItem(BListView *ListView, BListItem *item) +{ + return ListView->RemoveItem(item); +} + + +/*********************************************************************** + * Method: BListView::RemoveItem + * Params: int32 index + * Returns: BListItem * + * Effects: + ***********************************************************************/ +BListItem * +BListView_RemoveItem_1 +(BListView *ListView, int32 index) +{ + return ListView->RemoveItem(index); +} + + +/*********************************************************************** + * Method: BListView::RemoveItems + * Params: int32 index, int32 count + * Returns: bool + * Effects: + ***********************************************************************/ +bool +BListView_RemoveItems_2 +(BListView *ListView, int32 index, int32 count) +{ + return ListView->RemoveItems(index, count); +} + + +/*********************************************************************** + * Method: BListView::SetSelectionMessage + * Params: BMessage *message + * Returns: void + * Effects: + ***********************************************************************/ +void +BListView_SetSelectionMessage(BListView *ListView, BMessage *message) +{ + ListView->SetSelectionMessage(message); +} + + +/*********************************************************************** + * Method: BListView::SetInvocationMessage + * Params: BMessage *message + * Returns: void + * Effects: + ***********************************************************************/ +void +BListView_SetInvocationMessage(BListView *ListView, BMessage *message) +{ + ListView->SetInvocationMessage(message); +} + + +/*********************************************************************** + * Method: BListView::SelectionMessage + * Params: + * Returns: BMessage * + * Effects: + ***********************************************************************/ +BMessage * +BListView_SelectionMessage(BListView *ListView) +{ + return ListView->SelectionMessage(); +} + + +/*********************************************************************** + * Method: BListView::SelectionCommand + * Params: + * Returns: uint32 + * Effects: + ***********************************************************************/ +uint32 +BListView_SelectionCommand(BListView *ListView) +{ + return ListView->SelectionCommand(); +} + + +/*********************************************************************** + * Method: BListView::InvocationMessage + * Params: + * Returns: BMessage * + * Effects: + ***********************************************************************/ +BMessage * +BListView_InvocationMessage(BListView *ListView) +{ + return ListView->InvocationMessage(); +} + + +/*********************************************************************** + * Method: BListView::InvocationCommand + * Params: + * Returns: uint32 + * Effects: + ***********************************************************************/ +uint32 +BListView_InvocationCommand(BListView *ListView) +{ + return ListView->InvocationCommand(); +} + + +/*********************************************************************** + * Method: BListView::SetListType + * Params: list_view_type type + * Returns: void + * Effects: + ***********************************************************************/ +void +BListView_SetListType(BListView *ListView, list_view_type type) +{ + ListView->SetListType(type); +} + + +/*********************************************************************** + * Method: BListView::ListType + * Params: + * Returns: list_view_type + * Effects: + ***********************************************************************/ +list_view_type +BListView_ListType(BListView *ListView) +{ + return ListView->ListType(); +} + + +/*********************************************************************** + * Method: BListView::ItemAt + * Params: int32 index + * Returns: BListItem * + * Effects: + ***********************************************************************/ +BListItem * +BListView_ItemAt(BListView *ListView, int32 index) +{ + return ListView->ItemAt(index); +} + + +/*********************************************************************** + * Method: BListView::IndexOf + * Params: BPoint point + * Returns: int32 + * Effects: + ***********************************************************************/ +int32 +BListView_IndexOf(BListView *ListView, BPoint point) +{ + return ListView->IndexOf(point); +} + + +/*********************************************************************** + * Method: BListView::IndexOf + * Params: BListItem *item + * Returns: int32 + * Effects: + ***********************************************************************/ +int32 +BListView_IndexOf_1 +(BListView *ListView, BListItem *item) +{ + return ListView->IndexOf(item); +} + + +/*********************************************************************** + * Method: BListView::FirstItem + * Params: + * Returns: BListItem * + * Effects: + ***********************************************************************/ +BListItem * +BListView_FirstItem(BListView *ListView) +{ + return ListView->FirstItem(); +} + + +/*********************************************************************** + * Method: BListView::LastItem + * Params: + * Returns: BListItem * + * Effects: + ***********************************************************************/ +BListItem * +BListView_LastItem(BListView *ListView) +{ + return ListView->LastItem(); +} + + +/*********************************************************************** + * Method: BListView::HasItem + * Params: BListItem *item + * Returns: bool + * Effects: + ***********************************************************************/ +bool +BListView_HasItem(BListView *ListView, BListItem *item) +{ + return ListView->HasItem(item); +} + + +/*********************************************************************** + * Method: BListView::CountItems + * Params: + * Returns: int32 + * Effects: + ***********************************************************************/ +int32 +BListView_CountItems(BListView *ListView) +{ + return ListView->CountItems(); +} + + +/*********************************************************************** + * Method: BListView::MakeEmpty + * Params: + * Returns: void + * Effects: + ***********************************************************************/ +void +BListView_MakeEmpty(BListView *ListView) +{ + ListView->MakeEmpty(); +} + + +/*********************************************************************** + * Method: BListView::IsEmpty + * Params: + * Returns: bool + * Effects: + ***********************************************************************/ +bool +BListView_IsEmpty(BListView *ListView) +{ + return ListView->IsEmpty(); +} + + +/*********************************************************************** + * Method: BListView::Items + * Params: + * Returns: const BListItem ** + * Effects: + ***********************************************************************/ +const BListItem ** +BListView_Items(BListView *ListView) +{ + return ListView->Items(); +} + + +/*********************************************************************** + * Method: BListView::InvalidateItem + * Params: int32 index + * Returns: void + * Effects: + ***********************************************************************/ +void +BListView_InvalidateItem(BListView *ListView, int32 index) +{ + ListView->InvalidateItem(index); +} + + +/*********************************************************************** + * Method: BListView::ScrollToSelection + * Params: + * Returns: void + * Effects: + ***********************************************************************/ +void +BListView_ScrollToSelection(BListView *ListView) +{ + ListView->ScrollToSelection(); +} + + +/*********************************************************************** + * Method: BListView::Select + * Params: int32 index, bool extend + * Returns: void + * Effects: + ***********************************************************************/ +void +BListView_Select(BListView *ListView, int32 index, bool extend) +{ + ListView->Select(index, extend); +} + + +/*********************************************************************** + * Method: BListView::Select + * Params: int32 from, int32 to, bool extend + * Returns: void + * Effects: + ***********************************************************************/ +void +BListView_Select_1 +(BListView *ListView, int32 from, int32 to, bool extend) +{ + ListView->Select(from, to, extend); +} + + +/*********************************************************************** + * Method: BListView::IsItemSelected + * Params: int32 index + * Returns: bool + * Effects: + ***********************************************************************/ +bool +BListView_IsItemSelected(BListView *ListView, int32 index) +{ + return ListView->IsItemSelected(index); +} + + +/*********************************************************************** + * Method: BListView::CurrentSelection + * Params: int32 index + * Returns: int32 + * Effects: + ***********************************************************************/ +int32 +BListView_CurrentSelection(BListView *ListView, int32 index) +{ + return ListView->CurrentSelection(index); +} + + +/*********************************************************************** + * Method: BListView::Invoke + * Params: BMessage *msg + * Returns: status_t + * Effects: + ***********************************************************************/ +status_t +BListView_Invoke(BListView *ListView, BMessage *msg) +{ + return ListView->Invoke(msg); +} + + +/*********************************************************************** + * Method: BListView::DeselectAll + * Params: + * Returns: void + * Effects: + ***********************************************************************/ +void +BListView_DeselectAll(BListView *ListView) +{ + ListView->DeselectAll(); +} + + +/*********************************************************************** + * Method: BListView::DeselectExcept + * Params: int32 except_from, int32 except_to + * Returns: void + * Effects: + ***********************************************************************/ +void +BListView_DeselectExcept(BListView *ListView, int32 except_from, int32 except_to) +{ + ListView->DeselectExcept(except_from, except_to); +} + + +/*********************************************************************** + * Method: BListView::Deselect + * Params: int32 index + * Returns: void + * Effects: + ***********************************************************************/ +void +BListView_Deselect(BListView *ListView, int32 index) +{ + ListView->Deselect(index); +} + + +/*********************************************************************** + * Method: BListView::SelectionChanged + * Params: + * Returns: void + * Effects: + ***********************************************************************/ +void +BListView_SelectionChanged(BListView *ListView) +{ + ListView->SelectionChanged(); +} + + +/*********************************************************************** + * Method: BListView::SwapItems + * Params: int32 a, int32 b + * Returns: bool + * Effects: + ***********************************************************************/ +bool +BListView_SwapItems(BListView *ListView, int32 a, int32 b) +{ + return ListView->SwapItems(a, b); +} + + +/*********************************************************************** + * Method: BListView::MoveItem + * Params: int32 from, int32 to + * Returns: bool + * Effects: + ***********************************************************************/ +bool +BListView_MoveItem(BListView *ListView, int32 from, int32 to) +{ + return ListView->MoveItem(from, to); +} + + +/*********************************************************************** + * Method: BListView::ReplaceItem + * Params: int32 index, BListItem *item + * Returns: bool + * Effects: + ***********************************************************************/ +bool +BListView_ReplaceItem(BListView *ListView, int32 index, BListItem *item) +{ + return ListView->ReplaceItem(index, item); +} + + +/*********************************************************************** + * Method: BListView::AttachedToWindow + * Params: + * Returns: void + * Effects: + ***********************************************************************/ +void +BListView_AttachedToWindow(BListView *ListView) +{ + ListView->AttachedToWindow(); +} + + +/*********************************************************************** + * Method: BListView::FrameMoved + * Params: BPoint new_position + * Returns: void + * Effects: + ***********************************************************************/ +void +BListView_FrameMoved(BListView *ListView, BPoint new_position) +{ + ListView->FrameMoved(new_position); +} + + +/*********************************************************************** + * Method: BListView::ItemFrame + * Params: int32 index + * Returns: BRect + * Effects: + ***********************************************************************/ +BRect +BListView_ItemFrame(BListView *ListView, int32 index) +{ + return ListView->ItemFrame(index); +} + + +/*********************************************************************** + * Method: BListView::ResolveSpecifier + * Params: BMessage *msg, int32 index, BMessage *specifier, int32 form, const char *property + * Returns: BHandler * + * Effects: + ***********************************************************************/ +BHandler * +BListView_ResolveSpecifier(BListView *ListView, BMessage *msg, int32 index, BMessage *specifier, int32 form, const char *property) +{ + return ListView->ResolveSpecifier(msg, index, specifier, form, property); +} + + +/*********************************************************************** + * Method: BListView::GetSupportedSuites + * Params: BMessage *data + * Returns: status_t + * Effects: + ***********************************************************************/ +status_t +BListView_GetSupportedSuites(BListView *ListView, BMessage *data) +{ + return ListView->GetSupportedSuites(data); +} + + +/*********************************************************************** + * Method: BListView::Perform + * Params: perform_code d, void *arg + * Returns: status_t + * Effects: + ***********************************************************************/ +status_t +BListView_Perform(BListView *ListView, perform_code d, void *arg) +{ + return ListView->Perform(d, arg); +} + + +/*********************************************************************** + * Method: BListView::WindowActivated + * Params: bool state + * Returns: void + * Effects: + ***********************************************************************/ +void +BListView_WindowActivated(BListView *ListView, bool state) +{ + ListView->WindowActivated(state); +} + + +/*********************************************************************** + * Method: BListView::MouseUp + * Params: BPoint pt + * Returns: void + * Effects: + ***********************************************************************/ +void +BListView_MouseUp(BListView *ListView, BPoint pt) +{ + ListView->MouseUp(pt); +} + + +/*********************************************************************** + * Method: BListView::MouseMoved + * Params: BPoint pt, uint32 code, const BMessage *msg + * Returns: void + * Effects: + ***********************************************************************/ +void +BListView_MouseMoved(BListView *ListView, BPoint pt, uint32 code, const BMessage *msg) +{ + ListView->MouseMoved(pt, code, msg); +} + + +/*********************************************************************** + * Method: BListView::DetachedFromWindow + * Params: + * Returns: void + * Effects: + ***********************************************************************/ +void +BListView_DetachedFromWindow(BListView *ListView) +{ + ListView->DetachedFromWindow(); +} + + +/*********************************************************************** + * Method: BListView::InitiateDrag + * Params: BPoint pt, int32 itemIndex, bool initialySelected + * Returns: bool + * Effects: + ***********************************************************************/ +bool +BListView_InitiateDrag(BListView *ListView, BPoint pt, int32 itemIndex, bool initialySelected) +{ + return ListView->InitiateDrag(pt, itemIndex, initialySelected); +} + + +/*********************************************************************** + * Method: BListView::ResizeToPreferred + * Params: + * Returns: void + * Effects: + ***********************************************************************/ +void +BListView_ResizeToPreferred(BListView *ListView) +{ + ListView->ResizeToPreferred(); +} + + +/*********************************************************************** + * Method: BListView::GetPreferredSize + * Params: float *width, float *height + * Returns: void + * Effects: + ***********************************************************************/ +void +BListView_GetPreferredSize(BListView *ListView, float *width, float *height) +{ + ListView->GetPreferredSize(width, height); +} + + +/*********************************************************************** + * Method: BListView::AllAttached + * Params: + * Returns: void + * Effects: + ***********************************************************************/ +void +BListView_AllAttached(BListView *ListView) +{ + ListView->AllAttached(); +} + + +/*********************************************************************** + * Method: BListView::AllDetached + * Params: + * Returns: void + * Effects: + ***********************************************************************/ +void +BListView_AllDetached(BListView *ListView) +{ + ListView->AllDetached(); +} + +#if defined(__cplusplus) +} +#endif + +#endif /* _LISTVIEW_CPP_ */ diff --git a/bepascal/bepascal/be/interface/OutlineListView.cpp b/bepascal/bepascal/be/interface/OutlineListView.cpp new file mode 100644 index 0000000..fb2e931 --- /dev/null +++ b/bepascal/bepascal/be/interface/OutlineListView.cpp @@ -0,0 +1,755 @@ +/* BePascal - A pascal wrapper around the BeOS API + Copyright (C) 2002 Olivier Coursiere + Eric Jourde + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef _OUTLINELISTVIEW_CPP_ +#define _OUTLINELISTVIEW_CPP_ + +#include "OutlineListView.h" +#include "view.h" +#include +#include "listview.h" + + + + +#if defined(__cplusplus) +extern "C" { +#endif + +#if defined(__cplusplus) +} +#endif + +class BPOutlineListView : public BOutlineListView, virtual public BPListView +{ +public: + BPOutlineListView(TPasObject PasObject,BRect frame, + const char * name, + list_view_type type = B_SINGLE_SELECTION_LIST, + uint32 resizeMask = B_FOLLOW_LEFT | B_FOLLOW_TOP, + uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS + | B_NAVIGABLE); + BPOutlineListView(TPasObject PasObject,BMessage *data); + +static BArchivable *Instantiate(BMessage *data); +//virtual status_t Archive(BMessage *data, bool deep = true) const; + +virtual void MouseDown(BPoint where); +virtual void KeyDown(const char *bytes, int32 numBytes); +//virtual void FrameMoved(BPoint new_position); +virtual void FrameResized(float new_width, float new_height); +virtual void MouseUp(BPoint where); + + +//virtual void ResizeToPreferred(); +//virtual void GetPreferredSize(float *width, float *height); +//virtual void MakeFocus(bool state = true); +virtual void AllAttached(); +virtual void AllDetached(); +virtual void DetachedFromWindow(); + + + +//virtual bool DoMiscellaneous(MiscCode code, MiscData * data); +virtual void MessageReceived(BMessage *); +}; + + +BPOutlineListView::BPOutlineListView(TPasObject PasObject,BMessage *data) + :BOutlineListView(data), + BPListView(PasObject, data), + BPView(PasObject, data), + BPHandler(PasObject, data), + BPasObject(PasObject) +{ +} + +BPOutlineListView::BPOutlineListView(TPasObject PasObject,BRect frame, + const char * name, + list_view_type type = B_SINGLE_SELECTION_LIST, + uint32 resizeMask = B_FOLLOW_LEFT | B_FOLLOW_TOP, + uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS + | B_NAVIGABLE) + :BOutlineListView(frame,name,type,resizeMask,flags), + BPListView(PasObject, frame,name,type,resizeMask,flags), + BPView(PasObject, frame,name,resizeMask,flags), + BPHandler(PasObject, name), + BPasObject(PasObject) +{ +} + + +void BPOutlineListView::MessageReceived(BMessage *message) +{ + MessageReceived_hookCall(message); + BOutlineListView::MessageReceived(message); +} + + + + +void BPOutlineListView::AllAttached(void) +{ + //AllAttached_hookCall(); + BOutlineListView::AllAttached(); +} + +void BPOutlineListView::AllDetached(void) +{ + //AllDetached_hookCall(); + BOutlineListView::AllDetached(); +} + + + +void BPOutlineListView::KeyDown(const char *bytes, int32 numBytes) +{ + BOutlineListView::KeyDown(bytes, numBytes); +} + + +void BPOutlineListView::FrameResized(float width, float height) +{ + FrameResized_hookCall(width, height); + BOutlineListView::FrameResized(width, height); +} + +void BPOutlineListView::DetachedFromWindow(void) +{ + BOutlineListView::DetachedFromWindow(); +} + + + +void BPOutlineListView::MouseDown(BPoint point) +{ + BOutlineListView::MouseDown(point); +} + + +void BPOutlineListView::MouseUp(BPoint point) +{ + BOutlineListView::MouseUp(point); +} + + + + +#if defined(__cplusplus) +extern "C" { +#endif + +/*********************************************************************** + * AUTHOR: nobody + * FILE: OutlineListView.cpp + * DATE: Tue Mar 4 20:12:11 2003 + * DESCR: + ***********************************************************************/ + +/*********************************************************************** + * Method: BOutlineListView::BOutlineListView + * Params: BMessage *data + * Effects: + ***********************************************************************/ +TCPlusObject BOutlineListView_Create(TPasObject PasObject,BRect frame, + const char * name, + list_view_type type = B_SINGLE_SELECTION_LIST, + uint32 resizeMask = B_FOLLOW_LEFT | B_FOLLOW_TOP, + uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS + | B_NAVIGABLE) +{ + return new BPOutlineListView(PasObject, frame,name,type,resizeMask,flags); +} + +TCPlusObject BOutlineListView_Create_1(TPasObject PasObject, BMessage *data) +{ + return new BPOutlineListView(PasObject, data); +} + + +/*********************************************************************** + * Method: BOutlineListView::~BOutlineListView + * Params: + * Effects: + ***********************************************************************/ +void BOutlineListView_Free(BOutlineListView *OutlineListView) +{ + delete OutlineListView; +} + + +/*********************************************************************** + * Method: BOutlineListView::Instantiate + * Params: BMessage *data + * Returns: BArchivable * + * Effects: + ***********************************************************************/ +BArchivable * +BOutlineListView_Instantiate(BOutlineListView *OutlineListView, BMessage *data) +{ + return OutlineListView->Instantiate(data); +} + + +/*********************************************************************** + * Method: BOutlineListView::Archive + * Params: BMessage *data, bool deep + * Returns: status_t + * Effects: + ***********************************************************************/ +status_t +BOutlineListView_Archive(BOutlineListView *OutlineListView, BMessage *data, bool deep) +{ + return OutlineListView->Archive(data, deep); +} + + +/*********************************************************************** + * Method: BOutlineListView::MouseDown + * Params: BPoint where + * Returns: void + * Effects: + ***********************************************************************/ +void +BOutlineListView_MouseDown(BOutlineListView *OutlineListView, BPoint where) +{ + OutlineListView->MouseDown(where); +} + + +/*********************************************************************** + * Method: BOutlineListView::KeyDown + * Params: const char *bytes, int32 numBytes + * Returns: void + * Effects: + ***********************************************************************/ +void +BOutlineListView_KeyDown(BOutlineListView *OutlineListView, const char *bytes, int32 numBytes) +{ + OutlineListView->KeyDown(bytes, numBytes); +} + + +/*********************************************************************** + * Method: BOutlineListView::FrameMoved + * Params: BPoint new_position + * Returns: void + * Effects: + ***********************************************************************/ +void +BOutlineListView_FrameMoved(BOutlineListView *OutlineListView, BPoint new_position) +{ + OutlineListView->FrameMoved(new_position); +} + + +/*********************************************************************** + * Method: BOutlineListView::FrameResized + * Params: float new_width, float new_height + * Returns: void + * Effects: + ***********************************************************************/ +void +BOutlineListView_FrameResized(BOutlineListView *OutlineListView, float new_width, float new_height) +{ + OutlineListView->FrameResized(new_width, new_height); +} + + +/*********************************************************************** + * Method: BOutlineListView::MouseUp + * Params: BPoint where + * Returns: void + * Effects: + ***********************************************************************/ +void +BOutlineListView_MouseUp(BOutlineListView *OutlineListView, BPoint where) +{ + OutlineListView->MouseUp(where); +} + + +/*********************************************************************** + * Method: BOutlineListView::AddUnder + * Params: BListItem *item, BListItem *underItem + * Returns: bool + * Effects: + ***********************************************************************/ +bool +BOutlineListView_AddUnder(BOutlineListView *OutlineListView, BListItem *item, BListItem *underItem) +{ + return OutlineListView->AddUnder(item, underItem); +} + + +/*********************************************************************** + * Method: BOutlineListView::AddItem + * Params: BListItem *item + * Returns: bool + * Effects: + ***********************************************************************/ +bool +BOutlineListView_AddItem(BOutlineListView *OutlineListView, BListItem *item) +{ + return OutlineListView->AddItem(item); +} + + +/*********************************************************************** + * Method: BOutlineListView::AddItem + * Params: BListItem *item, int32 fullListIndex + * Returns: bool + * Effects: + ***********************************************************************/ +bool +BOutlineListView_AddItem_1 +(BOutlineListView *OutlineListView, BListItem *item, int32 fullListIndex) +{ + return OutlineListView->AddItem(item, fullListIndex); +} + + +/*********************************************************************** + * Method: BOutlineListView::AddList + * Params: BList *newItems + * Returns: bool + * Effects: + ***********************************************************************/ +bool +BOutlineListView_AddList(BOutlineListView *OutlineListView, BList *newItems) +{ + return OutlineListView->AddList(newItems); +} + + +/*********************************************************************** + * Method: BOutlineListView::AddList + * Params: BList *newItems, int32 fullListIndex + * Returns: bool + * Effects: + ***********************************************************************/ +bool +BOutlineListView_AddList_1 +(BOutlineListView *OutlineListView, BList *newItems, int32 fullListIndex) +{ + return OutlineListView->AddList(newItems, fullListIndex); +} + + +/*********************************************************************** + * Method: BOutlineListView::RemoveItem + * Params: BListItem *item + * Returns: bool + * Effects: + ***********************************************************************/ +bool +BOutlineListView_RemoveItem(BOutlineListView *OutlineListView, BListItem *item) +{ + return OutlineListView->RemoveItem(item); +} + + +/*********************************************************************** + * Method: BOutlineListView::RemoveItem + * Params: int32 fullListIndex + * Returns: BListItem * + * Effects: + ***********************************************************************/ +BListItem * +BOutlineListView_RemoveItem_1 +(BOutlineListView *OutlineListView, int32 fullListIndex) +{ + return OutlineListView->RemoveItem(fullListIndex); +} + + +/*********************************************************************** + * Method: BOutlineListView::RemoveItems + * Params: int32 fullListIndex, int32 count + * Returns: bool + * Effects: + ***********************************************************************/ +bool +BOutlineListView_RemoveItems +(BOutlineListView *OutlineListView, int32 fullListIndex, int32 count) +{ + return OutlineListView->RemoveItems(fullListIndex, count); +} + + +/*********************************************************************** + * Method: BOutlineListView::FullListItemAt + * Params: int32 fullListIndex + * Returns: BListItem * + * Effects: + ***********************************************************************/ +BListItem * +BOutlineListView_FullListItemAt(BOutlineListView *OutlineListView, int32 fullListIndex) +{ + return OutlineListView->FullListItemAt(fullListIndex); +} + + +/*********************************************************************** + * Method: BOutlineListView::FullListIndexOf + * Params: BPoint point + * Returns: int32 + * Effects: + ***********************************************************************/ +int32 +BOutlineListView_FullListIndexOf(BOutlineListView *OutlineListView, BPoint point) +{ + return OutlineListView->FullListIndexOf(point); +} + + +/*********************************************************************** + * Method: BOutlineListView::FullListIndexOf + * Params: BListItem *item + * Returns: int32 + * Effects: + ***********************************************************************/ +int32 +BOutlineListView_FullListIndexOf_1 +(BOutlineListView *OutlineListView, BListItem *item) +{ + return OutlineListView->FullListIndexOf(item); +} + + +/*********************************************************************** + * Method: BOutlineListView::FullListFirstItem + * Params: + * Returns: BListItem * + * Effects: + ***********************************************************************/ +BListItem * +BOutlineListView_FullListFirstItem(BOutlineListView *OutlineListView) +{ + return OutlineListView->FullListFirstItem(); +} + + +/*********************************************************************** + * Method: BOutlineListView::FullListLastItem + * Params: + * Returns: BListItem * + * Effects: + ***********************************************************************/ +BListItem * +BOutlineListView_FullListLastItem(BOutlineListView *OutlineListView) +{ + return OutlineListView->FullListLastItem(); +} + + +/*********************************************************************** + * Method: BOutlineListView::FullListHasItem + * Params: BListItem *item + * Returns: bool + * Effects: + ***********************************************************************/ +bool +BOutlineListView_FullListHasItem(BOutlineListView *OutlineListView, BListItem *item) +{ + return OutlineListView->FullListHasItem(item); +} + + +/*********************************************************************** + * Method: BOutlineListView::FullListCountItems + * Params: + * Returns: int32 + * Effects: + ***********************************************************************/ +int32 +BOutlineListView_FullListCountItems(BOutlineListView *OutlineListView) +{ + return OutlineListView->FullListCountItems(); +} + + +/*********************************************************************** + * Method: BOutlineListView::FullListCurrentSelection + * Params: int32 index + * Returns: int32 + * Effects: + ***********************************************************************/ +int32 +BOutlineListView_FullListCurrentSelection(BOutlineListView *OutlineListView, int32 index) +{ + return OutlineListView->FullListCurrentSelection(index); +} + + +/*********************************************************************** + * Method: BOutlineListView::MakeEmpty + * Params: + * Returns: void + * Effects: + ***********************************************************************/ +void +BOutlineListView_MakeEmpty(BOutlineListView *OutlineListView) +{ + OutlineListView->MakeEmpty(); +} + + +/*********************************************************************** + * Method: BOutlineListView::FullListIsEmpty + * Params: + * Returns: bool + * Effects: + ***********************************************************************/ +bool +BOutlineListView_FullListIsEmpty(BOutlineListView *OutlineListView) +{ + return OutlineListView->FullListIsEmpty(); +} + + +/*********************************************************************** + * Method: BOutlineListView::Superitem + * Params: const BListItem *item + * Returns: BListItem * + * Effects: + ***********************************************************************/ +BListItem * +BOutlineListView_Superitem(BOutlineListView *OutlineListView, const BListItem *item) +{ + return OutlineListView->Superitem(item); +} + + +/*********************************************************************** + * Method: BOutlineListView::Expand + * Params: BListItem *item + * Returns: void + * Effects: + ***********************************************************************/ +void +BOutlineListView_Expand(BOutlineListView *OutlineListView, BListItem *item) +{ + OutlineListView->Expand(item); +} + + +/*********************************************************************** + * Method: BOutlineListView::Collapse + * Params: BListItem *item + * Returns: void + * Effects: + ***********************************************************************/ +void +BOutlineListView_Collapse(BOutlineListView *OutlineListView, BListItem *item) +{ + OutlineListView->Collapse(item); +} + + +/*********************************************************************** + * Method: BOutlineListView::IsExpanded + * Params: int32 fullListIndex + * Returns: bool + * Effects: + ***********************************************************************/ +bool +BOutlineListView_IsExpanded(BOutlineListView *OutlineListView, int32 fullListIndex) +{ + return OutlineListView->IsExpanded(fullListIndex); +} + + +/*********************************************************************** + * Method: BOutlineListView::ResolveSpecifier + * Params: BMessage *msg, int32 index, BMessage *specifier, int32 form, const char *property + * Returns: BHandler * + * Effects: + ***********************************************************************/ +BHandler * +BOutlineListView_ResolveSpecifier(BOutlineListView *OutlineListView, BMessage *msg, int32 index, BMessage *specifier, int32 form, const char *property) +{ + return OutlineListView->ResolveSpecifier(msg, index, specifier, form, property); +} + + +/*********************************************************************** + * Method: BOutlineListView::GetSupportedSuites + * Params: BMessage *data + * Returns: status_t + * Effects: + ***********************************************************************/ +status_t +BOutlineListView_GetSupportedSuites(BOutlineListView *OutlineListView, BMessage *data) +{ + return OutlineListView->GetSupportedSuites(data); +} + + +/*********************************************************************** + * Method: BOutlineListView::Perform + * Params: perform_code d, void *arg + * Returns: status_t + * Effects: + ***********************************************************************/ +status_t +BOutlineListView_Perform(BOutlineListView *OutlineListView, perform_code d, void *arg) +{ + return OutlineListView->Perform(d, arg); +} + + +/*********************************************************************** + * Method: BOutlineListView::ResizeToPreferred + * Params: + * Returns: void + * Effects: + ***********************************************************************/ +void +BOutlineListView_ResizeToPreferred(BOutlineListView *OutlineListView) +{ + OutlineListView->ResizeToPreferred(); +} + + +/*********************************************************************** + * Method: BOutlineListView::GetPreferredSize + * Params: float *width, float *height + * Returns: void + * Effects: + ***********************************************************************/ +void +BOutlineListView_GetPreferredSize(BOutlineListView *OutlineListView, float *width, float *height) +{ + OutlineListView->GetPreferredSize(width, height); +} + + +/*********************************************************************** + * Method: BOutlineListView::MakeFocus + * Params: bool state + * Returns: void + * Effects: + ***********************************************************************/ +void +BOutlineListView_MakeFocus(BOutlineListView *OutlineListView, bool state) +{ + OutlineListView->MakeFocus(state); +} + + +/*********************************************************************** + * Method: BOutlineListView::AllAttached + * Params: + * Returns: void + * Effects: + ***********************************************************************/ +void +BOutlineListView_AllAttached(BOutlineListView *OutlineListView) +{ + OutlineListView->AllAttached(); +} + + +/*********************************************************************** + * Method: BOutlineListView::AllDetached + * Params: + * Returns: void + * Effects: + ***********************************************************************/ +void +BOutlineListView_AllDetached(BOutlineListView *OutlineListView) +{ + OutlineListView->AllDetached(); +} + + +/*********************************************************************** + * Method: BOutlineListView::DetachedFromWindow + * Params: + * Returns: void + * Effects: + ***********************************************************************/ +void +BOutlineListView_DetachedFromWindow(BOutlineListView *OutlineListView) +{ + OutlineListView->DetachedFromWindow(); +} + + +/*********************************************************************** + * Method: BOutlineListView::CountItemsUnder + * Params: BListItem *under, bool oneLevelOnly + * Returns: int32 + * Effects: + ***********************************************************************/ +int32 +BOutlineListView_CountItemsUnder(BOutlineListView *OutlineListView, BListItem *under, bool oneLevelOnly) +{ + return OutlineListView->CountItemsUnder(under, oneLevelOnly); +} + + +/*********************************************************************** + * Method: BOutlineListView::ItemUnderAt + * Params: BListItem *underItem, bool oneLevelOnly, int32 index + * Returns: BListItem * + * Effects: + ***********************************************************************/ +BListItem * +BOutlineListView_ItemUnderAt(BOutlineListView *OutlineListView, BListItem *underItem, bool oneLevelOnly, int32 index) +{ + return OutlineListView->ItemUnderAt(underItem, oneLevelOnly, index); +} + + +/*********************************************************************** + * Method: BOutlineListView::DoMiscellaneous + * Params: MiscCode code, MiscData *data + * Returns: bool + * Effects: + ***********************************************************************/ +/*bool +BOutlineListView_DoMiscellaneous(BOutlineListView *OutlineListView, MiscCode code, MiscData *data) +{ + return OutlineListView->DoMiscellaneous(code, data); +} +*/ + +/*********************************************************************** + * Method: BOutlineListView::MessageReceived + * Params: BMessage * + * Returns: void + * Effects: + ***********************************************************************/ +/*void +BOutlineListView_MessageReceived(BOutlineListView *OutlineListView, BMessage *) +{ + OutlineListView->MessageReceived(); +}*/ + + + + + +#if defined(__cplusplus) +} +#endif + +#endif /* _OUTLINELISTVIEW_CPP_ */ diff --git a/bepascal/bepascal/be/interface/alert.pp b/bepascal/bepascal/be/interface/alert.pp new file mode 100644 index 0000000..52cd369 --- /dev/null +++ b/bepascal/bepascal/be/interface/alert.pp @@ -0,0 +1,320 @@ +{ BePascal - A pascal wrapper around the BeOS API + Copyright (C) 2003 Olivier Coursiere + Eric Jourde + Oscar Lesta + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +} +unit Alert; + +interface + +uses + BeObj, Archivable, Button, {InterfaceDefs,} Invoker, Handler, + Message, Point, SupportDefs, TextView, Window; + +type + // This one belongs to InterfaceDefs unit! + TButton_Width = (B_WIDTH_AS_USUAL, B_WIDTH_FROM_WIDEST, B_WIDTH_FROM_LABEL); + +{ enum for flavors of alert } +// enum alert_type + TAlert_Type = (B_EMPTY_ALERT, B_INFO_ALERT, B_IDEA_ALERT, B_WARNING_ALERT, + B_STOP_ALERT); + +//enum button_spacing + TButton_Spacing = (B_EVEN_SPACING, B_OFFSET_SPACING); + + TAlert = class(TWindow) + private + public + // Here we have this name colition: type --> kind + constructor Create(title : PChar; text : PChar; button1 : PChar; + button2 : PChar; button3 : PChar; width : TButton_Width; + kind{type} : TAlert_Type); + constructor Create(title : PChar; text : PChar; button1 : PChar; + button2 : PChar; button3 : PChar; width : TButton_Width; + spacing : TButton_Spacing; kind{type} : TAlert_Type); + constructor Create(data : TMessage); + + destructor Destroy; override; + + function Instantiate(data : TMessage) : TArchivable; + function Archive(data : TMessage; deep : boolean) : TStatus_t; + procedure SetShortcut(button_index : integer; key : Char); + function Shortcut(button_index : integer) : Char; + function Go : integer; + function Go(invoker : TInvoker) : TStatus_t; + procedure MessageReceived(an_event : TMessage); override; + procedure FrameResized(new_width : double; new_height : double); + function ButtonAt(index : integer) : TButton; + function TextView : TTextView; + function ResolveSpecifier(msg : TMessage; index : integer; specifier : TMessage; form : integer; properti : PChar) : THandler; + function GetSupportedSuites(data : TMessage) : TStatus_t; + procedure DispatchMessage(msg : TMessage; handler : THandler); override; + procedure Quit; + function QuitRequested : boolean; override; + function AlertPosition(width : double; height : double) : TPoint; +{ + function Perform(d : TPerform_code; arg : Pointer) : TStatus_t; + + procedure _ReservedAlert1; + procedure _ReservedAlert2; + procedure _ReservedAlert3; + + procedure InitObject(text : PChar; button1 : PChar; button2 : PChar; button3 : PChar; width : TButton_Width; spacing : TButton_Spacing; type : TAlert_Type); + function InitIcon : TBitmap; + procedure sem_id fAlertSem; + procedure int32 fAlertVal; + procedure BButton *fButtons[3]; + procedure BTextView *fTextView; + procedure char fKeys[3]; + procedure alert_type fMsgType; + procedure button_width fButtonWidth; + procedure BInvoker *fInvoker; + procedure uint32 _reserved[4]; +} + end; + +function BAlert_Create(AObject : TBeObject; title : PChar; text : PChar; + button1 : PChar; button2 : PChar; button3 : PChar; width : TButton_Width; + kind{type} : TAlert_Type) : TCPlusObject; cdecl; + external BePascalLibName name 'BAlert_Create'; +function BAlert_Create_1(AObject : TBeObject; title : PChar; text : PChar; + button1 : PChar; button2 : PChar; button3 : PChar; width : TButton_Width; + spacing : TButton_Spacing; kind{type} : TAlert_Type) : TCPlusObject; cdecl; + external BePascalLibName name 'BAlert_Create_1'; +function BAlert_Create_2(AObject : TBeObject; data : TCPlusObject) + : TCPlusObject; cdecl; external BePascalLibName name 'BAlert_Create_2'; + +procedure BAlert_Free(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BAlert_Free'; + +function BAlert_Instantiate(AObject : TCPlusObject; data : TCPlusObject) : TArchivable; cdecl; external BePascalLibName name 'BAlert_Instantiate'; +function BAlert_Archive(AObject : TCPlusObject; data : TCPlusObject; deep : boolean) : TStatus_t; cdecl; external BePascalLibName name 'BAlert_Archive'; +procedure BAlert_SetShortcut(AObject : TCPlusObject; button_index : integer; key : Char); cdecl; external BePascalLibName name 'BAlert_SetShortcut'; +function BAlert_Shortcut(AObject : TCPlusObject; button_index : integer) : Char; cdecl; external BePascalLibName name 'BAlert_Shortcut'; +function BAlert_Go(AObject : TCPlusObject) : integer; cdecl; external BePascalLibName name 'BAlert_Go'; +function BAlert_Go(AObject : TCPlusObject; invoker : TCPlusObject) : TStatus_t; cdecl; external BePascalLibName name 'BAlert_Go'; +procedure BAlert_MessageReceived(AObject : TCPlusObject; an_event : TCPlusObject); cdecl; external BePascalLibName name 'BAlert_MessageReceived'; +procedure BAlert_FrameResized(AObject : TCPlusObject; new_width : double; new_height : double); cdecl; external BePascalLibName name 'BAlert_FrameResized'; +function BAlert_ButtonAt(AObject : TCPlusObject; index : integer) : TButton; cdecl; external BePascalLibName name 'BAlert_ButtonAt'; +function BAlert_TextView(AObject : TCPlusObject) : TTextView; cdecl; external BePascalLibName name 'BAlert_TextView'; +function BAlert_ResolveSpecifier(AObject : TCPlusObject; msg : TCPlusObject; index : integer; specifier : TCPlusObject; form : integer; properti : PChar) : THandler; cdecl; external BePascalLibName name 'BAlert_ResolveSpecifier'; +function BAlert_GetSupportedSuites(AObject : TCPlusObject; data : TCPlusObject) : TStatus_t; cdecl; external BePascalLibName name 'BAlert_GetSupportedSuites'; +procedure BAlert_DispatchMessage(AObject : TCPlusObject; msg : TCPlusObject; handler : TCPlusObject); cdecl; external BePascalLibName name 'BAlert_DispatchMessage'; +procedure BAlert_Quit(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BAlert_Quit'; +function BAlert_QuitRequested(AObject : TCPlusObject) : boolean; cdecl; external BePascalLibName name 'BAlert_QuitRequested'; +function BAlert_AlertPosition(AObject : TCPlusObject; width : double; height : double) : TPoint; cdecl; external BePascalLibName name 'BAlert_AlertPosition'; +{ +function BAlert_Perform(AObject : TCPlusObject; d : TPerform_code; arg : Pointer) : TStatus_t; cdecl; external BePascalLibName name 'BAlert_Perform'; +procedure BAlert__ReservedAlert1(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BAlert__ReservedAlert1'; +procedure BAlert__ReservedAlert2(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BAlert__ReservedAlert2'; +procedure BAlert__ReservedAlert3(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BAlert__ReservedAlert3'; +procedure BAlert_InitObject(AObject : TCPlusObject; text : PChar; button1 : PChar; button2 : PChar; button3 : PChar; width : TButton_Width; spacing : TButton_Spacing; type : TAlert_Type); cdecl; external BePascalLibName name 'BAlert_InitObject'; +function BAlert_InitIcon(AObject : TCPlusObject) : TBitmap; cdecl; external BePascalLibName name 'BAlert_InitIcon'; +procedure BAlert_sem_id fAlertSem(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BAlert_sem_id fAlertSem'; +procedure BAlert_int32 fAlertVal(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BAlert_int32 fAlertVal'; +procedure BAlert_BButton *fButtons[3](AObject : TCPlusObject); cdecl; external BePascalLibName name 'BAlert_BButton *fButtons[3]'; +procedure BAlert_BTextView *fTextView(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BAlert_BTextView *fTextView'; +procedure BAlert_char fKeys[3](AObject : TCPlusObject); cdecl; external BePascalLibName name 'BAlert_char fKeys[3]'; +procedure BAlert_alert_type fMsgType(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BAlert_alert_type fMsgType'; +procedure BAlert_button_width fButtonWidth(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BAlert_button_width fButtonWidth'; +procedure BAlert_BInvoker *fInvoker(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BAlert_BInvoker *fInvoker'; +procedure BAlert_uint32 _reserved[4](AObject : TCPlusObject); cdecl; external BePascalLibName name 'BAlert_uint32 _reserved[4]'; +} +implementation + +constructor TAlert.Create(title : PChar; text : PChar; button1 : PChar; + button2 : PChar; button3 : PChar; width : TButton_Width; + kind{type} : TAlert_Type); +begin + CPlusObject := BAlert_Create(Self, title, text, button1, button2, button3, + width, kind); +end; + +constructor TAlert.Create(title : PChar; text : PChar; button1 : PChar; button2 : PChar; button3 : PChar; width : TButton_Width; spacing : TButton_Spacing; kind{type} : TAlert_Type); +begin + CPlusObject := BAlert_Create_1(Self, title, text, button1, button2, button3, + width, spacing, kind{type}); +end; + +constructor TAlert.Create(data : TMessage); +begin + CPlusObject := BAlert_Create_2(Self, data{.CPlusObject}); +end; + +destructor TAlert.Destroy; +begin + BAlert_Free(CPlusObject); +end; + +function TAlert.Instantiate(data : TMessage) : TArchivable; +begin + Result := BAlert_Instantiate(CPlusObject, data{.CPlusObject}); +end; + +function TAlert.Archive(data : TMessage; deep : boolean) : TStatus_t; +begin + Result := BAlert_Archive(CPlusObject, data{.CPlusObject}, deep); +end; + +procedure TAlert.SetShortcut(button_index : integer; key : Char); +begin + BAlert_SetShortcut(CPlusObject, button_index, key); +end; + +function TAlert.Shortcut(button_index : integer) : Char; +begin + Result := BAlert_Shortcut(CPlusObject, button_index); +end; + +function TAlert.Go : integer; +begin + Result := BAlert_Go(CPlusObject); +end; + +function TAlert.Go(invoker : TInvoker) : TStatus_t; +begin + Result := BAlert_Go(CPlusObject, invoker{.CPlusObject}); +end; + +procedure TAlert.MessageReceived(an_event : TMessage); +begin + BAlert_MessageReceived(CPlusObject, an_event{.CPlusObject}); +end; + +procedure TAlert.FrameResized(new_width : double; new_height : double); +begin + BAlert_FrameResized(CPlusObject, new_width, new_height); +end; + +function TAlert.ButtonAt(index : integer) : TButton; +begin + Result := BAlert_ButtonAt(CPlusObject, index); +end; + +function TAlert.TextView : TTextView; +begin + Result := BAlert_TextView(CPlusObject); +end; + +function TAlert.ResolveSpecifier(msg : TMessage; index : integer; specifier : TMessage; form : integer; properti : PChar) : THandler; +begin + Result := BAlert_ResolveSpecifier(CPlusObject, msg{.CPlusObject}, index, specifier{.CPlusObject}, form, properti); +end; + +function TAlert.GetSupportedSuites(data : TMessage) : TStatus_t; +begin + Result := BAlert_GetSupportedSuites(CPlusObject, data{.CPlusObject}); +end; + +procedure TAlert.DispatchMessage(msg : TMessage; handler : THandler); +begin + BAlert_DispatchMessage(CPlusObject, msg{.CPlusObject}, handler{.CPlusObject}); +end; + +procedure TAlert.Quit; +begin + BAlert_Quit(CPlusObject); +end; + +function TAlert.QuitRequested : boolean; +begin + Result := BAlert_QuitRequested(CPlusObject); +end; + +function TAlert.AlertPosition(width : double; height : double) : TPoint; +begin + Result := BAlert_AlertPosition(CPlusObject, width, height); +end; + +{ +function TAlert.Perform(d : TPerform_code; arg : Pointer) : TStatus_t; +begin + Result := BAlert_Perform(CPlusObject, d, arg); +end; + +procedure TAlert._ReservedAlert1; +begin + BAlert__ReservedAlert1(CPlusObject); +end; + +procedure TAlert._ReservedAlert2; +begin + BAlert__ReservedAlert2(CPlusObject); +end; + +procedure TAlert._ReservedAlert3; +begin + BAlert__ReservedAlert3(CPlusObject); +end; + +procedure TAlert.InitObject(text : PChar; button1 : PChar; button2 : PChar; button3 : PChar; width : TButton_Width; spacing : TButton_Spacing; type : TAlert_Type); +begin + BAlert_InitObject(CPlusObject, text, button1, button2, button3, width, spacing, type); +end; + +function TAlert.InitIcon : TBitmap; +begin + Result := BAlert_InitIcon(CPlusObject); +end; + +procedure TAlert.sem_id fAlertSem; +begin + BAlert_sem_id fAlertSem(CPlusObject); +end; + +procedure TAlert.int32 fAlertVal; +begin + BAlert_int32 fAlertVal(CPlusObject); +end; + +procedure TAlert.BButton *fButtons[3]; +begin + BAlert_BButton *fButtons[3](CPlusObject); +end; + +procedure TAlert.BTextView *fTextView; +begin + BAlert_BTextView *fTextView(CPlusObject); +end; + +procedure TAlert.char fKeys[3]; +begin + BAlert_char fKeys[3](CPlusObject); +end; + +procedure TAlert.alert_type fMsgType; +begin + BAlert_alert_type fMsgType(CPlusObject); +end; + +procedure TAlert.button_width fButtonWidth; +begin + BAlert_button_width fButtonWidth(CPlusObject); +end; + +procedure TAlert.BInvoker *fInvoker; +begin + BAlert_BInvoker *fInvoker(CPlusObject); +end; + +procedure TAlert.uint32 _reserved[4]; +begin + BAlert_uint32 _reserved[4](CPlusObject); +end; +} + +end. \ No newline at end of file diff --git a/bepascal/bepascal/be/interface/listitem.pp b/bepascal/bepascal/be/interface/listitem.pp new file mode 100644 index 0000000..3d41dbb --- /dev/null +++ b/bepascal/bepascal/be/interface/listitem.pp @@ -0,0 +1,352 @@ +{ BePascal - A pascal wrapper around the BeOS API + Copyright (C) 2002 Olivier Coursiere + Eric Jourde + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +} +unit listitem; + +interface + +uses + beobj, interfacedefs,view,Message, Archivable, SupportDefs, Rect, Handler,font; + +type + TListItem = class(TBeObject) + private + public + constructor Create(aoutlineLevel : longint; expanded : boolean );virtual; + constructor Create(data : TMessage); + destructor Destroy;override; + function Archive(data : TMessage; deep : boolean) : TStatus_t; + function Height : double; + function Width : double; + function IsSelected : boolean; + procedure Select; + procedure Deselect; + procedure SetEnabled(aon : boolean); + function IsEnabled : boolean; + procedure SetHeight(aheight : double); + procedure SetWidth(awidth : double); + procedure DrawItem(owner : TView; bounds : TRect; complete : boolean); + procedure Update(owner : TView; font : TFont); + // function Perform(d : TPerform_code; var arg : Pointer) : TStatus_t; + function IsExpanded : boolean; + procedure SetExpanded(expanded : boolean); + function OutlineLevel : Cardinal; + function HasSubitems : boolean; + end; + +type + TStringItem = class(TListItem) + private + public + constructor Create( atext: pchar;aoutlineLevel : longint; expanded : boolean);virtual; + destructor Destroy;override; + constructor Create(data : TMessage); + function Instantiate(data : TMessage) : TArchivable; + function Archive(data : TMessage; deep : boolean) : TStatus_t; + procedure DrawItem(owner : TView; frame : TRect; complete : boolean); + procedure SetText( atext : PChar); + function Text : PChar; + procedure Update(owner : TView; font : TFont); +// function Perform(d : TPerform_code; arg : Pointer) : TStatus_t; + end; + +function BListItem_Create(AObject : TBeObject;outlineLevel : longint; expanded : boolean): TCPlusObject; cdecl; external BePascalLibName name 'BListItem_Create'; +function BListItem_Create(AObject : TBeObject; data : TCPlusObject): TCPlusObject; cdecl; external BePascalLibName name 'BListItem_Create_1'; +procedure BListItem_Free(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BListItem_Free'; +function BListItem_Archive(AObject : TCPlusObject; data : TCPlusObject; deep : boolean) : TStatus_t; cdecl; external BePascalLibName name 'BListItem_Archive'; +function BListItem_Height(AObject : TCPlusObject) : double; cdecl; external BePascalLibName name 'BListItem_Height'; +function BListItem_Width(AObject : TCPlusObject) : double; cdecl; external BePascalLibName name 'BListItem_Width'; +function BListItem_IsSelected(AObject : TCPlusObject) : boolean; cdecl; external BePascalLibName name 'BListItem_IsSelected'; +procedure BListItem_Select(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BListItem_Select'; +procedure BListItem_Deselect(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BListItem_Deselect'; +procedure BListItem_SetEnabled(AObject : TCPlusObject; aon : boolean); cdecl; external BePascalLibName name 'BListItem_SetEnabled'; +function BListItem_IsEnabled(AObject : TCPlusObject) : boolean; cdecl; external BePascalLibName name 'BListItem_IsEnabled'; +procedure BListItem_SetHeight(AObject : TCPlusObject; aheight : double); cdecl; external BePascalLibName name 'BListItem_SetHeight'; +procedure BListItem_SetWidth(AObject : TCPlusObject; awidth : double); cdecl; external BePascalLibName name 'BListItem_SetWidth'; +procedure BListItem_Update(AObject : TCPlusObject; owner : TCPlusObject; font : TCPlusObject); cdecl; external BePascalLibName name 'BListItem_Update'; +function BListItem_Perform(AObject : TCPlusObject; d : TCPlusObject; arg : Pointer) : TStatus_t; cdecl; external BePascalLibName name 'BListItem_Perform'; +function BListItem_IsExpanded(AObject : TCPlusObject) : boolean; cdecl; external BePascalLibName name 'BListItem_IsExpanded'; +procedure BListItem_SetExpanded(AObject : TCPlusObject; expanded : boolean); cdecl; external BePascalLibName name 'BListItem_SetExpanded'; +function BListItem_OutlineLevel(AObject : TCPlusObject) : Cardinal; cdecl; external BePascalLibName name 'BListItem_OutlineLevel'; + +//function BListItem_HasSubitems(AObject : TCPlusObject) : boolean; cdecl; external BePascalLibName name 'BListItem_HasSubitems'; +procedure BListItem_DrawItem(AObject : TCPlusObject; owner : TCPlusObject; bounds : TCPlusObject; complete : boolean); cdecl; external BePascalLibName name 'BListItem_DrawItem'; + +function BStringItem_Create(AObject : TBeObject ;text: pchar;lineLevel : longint; expanded : boolean): TCPlusObject; cdecl; external BePascalLibName name 'BStringItem_Create'; +procedure BStringItem_Free(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BStringItem_Free'; +function BStringItem_Create(AObject : TBeObject; data : TCPlusObject): TCPlusObject; cdecl; external BePascalLibName name 'BStringItem_Create'; +function BStringItem_Instantiate(AObject : TCPlusObject; data : TCPlusObject) : TArchivable; cdecl; external BePascalLibName name 'BStringItem_Instantiate'; +function BStringItem_Archive(AObject : TCPlusObject; data : TCPlusObject; deep : boolean) : TStatus_t; cdecl; external BePascalLibName name 'BStringItem_Archive'; +procedure BStringItem_DrawItem(AObject : TCPlusObject; owner : TCPlusObject; frame : TCPlusObject; complete : boolean); cdecl; external BePascalLibName name 'BStringItem_DrawItem'; +procedure BStringItem_SetText(AObject : TCPlusObject; text : PChar); cdecl; external BePascalLibName name 'BStringItem_SetText'; +function BStringItem_Text(AObject : TCPlusObject) : PChar; cdecl; external BePascalLibName name 'BStringItem_Text'; +procedure BStringItem_Update(AObject : TCPlusObject; owner : TCPlusObject; font : TCPlusObject); cdecl; external BePascalLibName name 'BStringItem_Update'; +function BStringItem_Perform(AObject : TCPlusObject; d : TPerform_code; arg : Pointer) : TStatus_t; cdecl; external BePascalLibName name 'BStringItem_Perform'; + +implementation + +var + + ListItem_DrawItem_hook : Pointer; cvar; external; + ListString_DrawItem_hook : Pointer; cvar; external; + ListItem_Update_hook : Pointer; cvar; external; + ListString_Update_hook : Pointer; cvar; external; + +constructor TListItem.Create(aoutlineLevel : longint; expanded : boolean ); +begin + CreatePas; + CPlusObject := BListItem_Create(Self,aoutlineLevel , expanded ); +end; + +constructor TListItem.Create(data : TMessage); +begin + CreatePas; + CPlusObject := BListItem_Create(Self, data.CPlusObject); +end; + +destructor TListItem.Destroy; +begin + BListItem_Free(CPlusObject); + inherited; +end; + +function TListItem.Archive(data : TMessage; deep : boolean) : TStatus_t; +begin + Result := BListItem_Archive(CPlusObject, data.CPlusObject, deep); +end; + +function TListItem.Height : double; +begin + Result := BListItem_Height(CPlusObject); +end; + +function TListItem.Width : double; +begin + Result := BListItem_Width(CPlusObject); +end; + +function TListItem.IsSelected : boolean; +begin + Result := BListItem_IsSelected(CPlusObject); +end; + +procedure TListItem.Select; +begin + BListItem_Select(CPlusObject); +end; + +procedure TListItem.Deselect; +begin + BListItem_Deselect(CPlusObject); +end; + +procedure TListItem.SetEnabled(aon : boolean); +begin + BListItem_SetEnabled(CPlusObject, aon); +end; + +function TListItem.IsEnabled : boolean; +begin + Result := BListItem_IsEnabled(CPlusObject); +end; + +procedure TListItem.SetHeight(aheight : double); +begin + BListItem_SetHeight(CPlusObject, aheight); +end; + +procedure TListItem.SetWidth(awidth : double); +begin + BListItem_SetWidth(CPlusObject, awidth); +end; + +procedure TListItem.DrawItem(owner : TView; bounds : TRect; complete : boolean); +begin + //BListItem_DrawItem(CPlusObject, owner.CPlusObject, bounds.CPlusObject, complete); +end; + +procedure TListItem.Update(owner : TView; font : TFont); +begin + // BListItem_Update(CPlusObject, owner.CPlusObject, font); +end; + +{function TListItem.Perform(d : TPerform_code; var arg : Pointer) : TStatus_t; +begin + Result := BListItem_Perform(CPlusObject, d, arg); +end; +} +function TListItem.IsExpanded : boolean; +begin + Result := BListItem_IsExpanded(CPlusObject); +end; + +procedure TListItem.SetExpanded(expanded : boolean); +begin + BListItem_SetExpanded(CPlusObject, expanded); +end; + +function TListItem.OutlineLevel : Cardinal; +begin + Result := BListItem_OutlineLevel(CPlusObject); +end; + +function TListItem.HasSubitems : boolean; +begin + // Result := BListItem_HasSubitems(CPlusObject); +end; + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// TStringItem +// +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +constructor TStringItem.Create( atext: pchar;aoutlineLevel : longint; expanded : boolean); +begin + CreatePas; + CPlusObject := BStringItem_Create(Self,atext,aoutlineLevel,expanded); +end; + +destructor TStringItem.Destroy; +begin + BStringItem_Free(CPlusObject); + inherited; +end; + +constructor TStringItem.Create(data : TMessage); +begin + CreatePas; + CPlusObject := BStringItem_Create(Self, data.CPlusObject); +end; + +function TStringItem.Instantiate(data : TMessage) : TArchivable; +begin + Result := BStringItem_Instantiate(CPlusObject, data.CPlusObject); +end; + +function TStringItem.Archive(data : TMessage; deep : boolean) : TStatus_t; +begin + //Result := BStringItem_Archive(CPlusObject, data.CPlusObject, deep); +end; + +procedure TStringItem.DrawItem(owner : TView; frame : TRect; complete : boolean); +begin + //BStringItem_DrawItem(CPlusObject, owner.CPlusObject, frame.CPlusObject, complete); +end; + +procedure TStringItem.SetText( atext : PChar); +begin + BStringItem_SetText(CPlusObject, atext); +end; + +function TStringItem.Text : PChar; +begin + Result := BStringItem_Text(CPlusObject); +end; + +procedure TStringItem.Update(owner : TView; font : TFont); +begin + //BStringItem_Update(CPlusObject, owner.CPlusObject, font); +end; + +{function TStringItem.Perform(d : TPerform_code; arg : Pointer) : TStatus_t; +begin + Result := BStringItem_Perform(CPlusObject, d, arg); +end; +} + +procedure ListItem_DrawItem_hook_func(Liste : TListItem;owner : TCPlusObject; bounds : TCPlusObject; complete : boolean); cdecl; +var Rect : TRect; + ow : TView; + +begin + Rect:=TRect.Wrap(bounds); + ow:=TView.Wrap(owner); + try + if Liste <> nil then + begin + Liste.DrawItem(ow ,Rect, complete ); + end; + finally + Rect.UnWrap; + ow.UnWrap; + end; +end; + +procedure ListString_DrawItem_hook_func(Liste : TStringItem;owner : TCPlusObject; bounds : TCPlusObject; complete : boolean); cdecl; +var Rect : TRect; + ow : TView; +begin + Rect:=TRect.Wrap(bounds); + ow:=TView.Wrap(owner); + try + if Liste <> nil then + begin + Liste.DrawItem(ow ,Rect, complete ); + end; + finally + Rect.UnWrap; + ow.UnWrap; + end; +end; + +procedure ListItem_Update_hook_func(Liste : TListItem;owner : TCPlusObject; font : TCPlusObject); cdecl; +var afont: TFont; + ow : TView; +begin + afont:=TFont.Wrap(font); + ow:=TView.Wrap(owner); + try + if Liste <> nil then + begin + + Liste.Update(ow ,afont ); + end; + finally + afont.UnWrap; + ow.UnWrap; + end; +end; + +procedure ListString_Update_hook_func(Liste : TStringItem;owner : TCPlusObject; font : TCPlusObject); cdecl; +var afont: TFont; + ow : TView; +begin + afont:=TFont.Wrap(font); + ow:=TView.Wrap(owner); + try + if Liste <> nil then + begin + Liste.Update(ow ,afont ); + end; + finally + afont.UnWrap; + ow.UnWrap; + end; +end; + + +initialization + + ListItem_DrawItem_hook := @ListItem_DrawItem_hook_func; + ListString_DrawItem_hook := @ListString_DrawItem_hook_func; + ListItem_Update_hook := @ListItem_Update_hook_func; + ListString_Update_hook := @ListString_Update_hook_func; + + +end. diff --git a/bepascal/bepascal/be/interface/listview.h b/bepascal/bepascal/be/interface/listview.h new file mode 100644 index 0000000..c56b20f --- /dev/null +++ b/bepascal/bepascal/be/interface/listview.h @@ -0,0 +1,79 @@ +/* BePascal - A pascal wrapper around the BeOS API + Copyright (C) 2002 Olivier Coursiere + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef _LISTVIEW_H_ +#define _LISTVIEW_H_ + +#include +#include + +#include +#include + +#include +#include + +class BPListView : public BListView, virtual public BPView +{ + +public: + BPListView(TPasObject PasObject,BRect frame, + const char *name, + list_view_type type = B_SINGLE_SELECTION_LIST, + uint32 resizeMask = B_FOLLOW_LEFT | + B_FOLLOW_TOP, + uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS | + B_NAVIGABLE); + BPListView(TPasObject PasObject,BMessage *data); +static BArchivable *Instantiate(BMessage *data); +//virtual status_t Archive(BMessage *data, bool deep = true) const; +virtual void Draw(BRect updateRect); +virtual void MessageReceived(BMessage *msg); +virtual void MouseDown(BPoint where); +virtual void KeyDown(const char *bytes, int32 numBytes); +//virtual void MakeFocus(bool state = true); +virtual void FrameResized(float newWidth, float newHeight); +virtual void AttachedToWindow(); +//virtual void FrameMoved(BPoint new_position); + +/*virtual BHandler *ResolveSpecifier(BMessage *msg, + int32 index, + BMessage *specifier, + int32 form, + const char *property);*/ + +//virtual status_t Perform(perform_code d, void *arg); + +virtual void WindowActivated(bool state); +virtual void MouseUp(BPoint pt); +virtual void MouseMoved(BPoint pt, uint32 code, const BMessage *msg); +virtual void DetachedFromWindow(); + +//virtual void ResizeToPreferred(); +//virtual void GetPreferredSize(float *width, float *height); +virtual void AllAttached(); +virtual void AllDetached(); + + bool InitiateDrag(BPoint pt, int32 itemIndex, + bool initialySelected); + void SelectionChanged(); + +protected: +}; + +#endif /* _LISTVIEW_H_ */ \ No newline at end of file diff --git a/bepascal/bepascal/be/interface/listview.pp b/bepascal/bepascal/be/interface/listview.pp new file mode 100644 index 0000000..5f0e0e1 --- /dev/null +++ b/bepascal/bepascal/be/interface/listview.pp @@ -0,0 +1,548 @@ +{ BePascal - A pascal wrapper around the BeOS API + Copyright (C) 2002 Olivier Coursiere + Eric Jourde + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +} +unit listview; + +interface + +uses + beobj, view, message, archivable, SupportDefs, rect, list, + handler, messenger,interfacedefs,font,graphicdefs,scrollview,listitem; + +type +Tlist_view_type =( + B_SINGLE_SELECTION_LIST, + B_MULTIPLE_SELECTION_LIST +); + + +type + TListView = class(TView) + private + public + constructor Create(frame : TRect; name : pchar; atype : Tlist_view_type; resizeMask: longint; flags : longint); virtual; + constructor Create(data : TMessage); + destructor Destroy;override; + function Instantiate(data : TMessage) : TArchivable; + function Archive(data : TMessage; deep : boolean) : TStatus_t; + procedure Draw(updateRect : TRect);override; + procedure MessageReceived(msg : TMessage);override; + procedure MouseDown(where : TPoint);override; + procedure KeyDown(bytes : PChar; numBytes : integer);override; + procedure MakeFocus(state : boolean); + procedure FrameResized(newWidth : double; newHeight : double);override; + procedure TargetedByScrollView(scroller : TScrollView); + procedure ScrollTo(x : double; y : double); + procedure ScrollTo(where : TPoint); + function AddItem(item : TListItem) : boolean; + function AddItem(item : TListItem; atIndex : integer) : boolean; + function AddList(newItems : TList) : boolean; + function AddList(newItems : TList; atIndex : integer) : boolean; + function RemoveItem(item : TListItem) : boolean; + function RemoveItem(index : integer) : TListItem; + function RemoveItems(index : integer; count : integer) : boolean; + procedure SetSelectionMessage(message : TMessage); + procedure SetInvocationMessage(message : TMessage); + function SelectionMessage : TMessage; + function SelectionCommand : Cardinal; + function InvocationMessage : TMessage; + function InvocationCommand : Cardinal; + procedure SetListType(atype : TList_view_type); + function ListType : TList_view_type; + function ItemAt(index : integer) : TListItem; + function IndexOf(point : TPoint) : integer; + function IndexOf(item : TListItem) : integer; + function FirstItem : TListItem; + function LastItem : TListItem; + function HasItem(item : TListItem) : boolean; + function CountItems : integer; + procedure MakeEmpty; + function IsEmpty : boolean; + function Items : TListView; + procedure InvalidateItem(index : integer); + procedure ScrollToSelection; + procedure Select(index : integer; extend : boolean); + procedure Select(from : integer; ato : integer; extend : boolean); + function IsItemSelected(index : integer) : boolean; + function CurrentSelection(index : integer) : integer; + function Invoke(msg : TMessage) : TStatus_t; + procedure DeselectAll; + procedure DeselectExcept(except_from : integer; except_to : integer); + procedure Deselect(index : integer); + procedure SelectionChanged; virtual; + function SwapItems(a : integer; b : integer) : boolean; + function MoveItem(from : integer; ato : integer) : boolean; + function ReplaceItem(index : integer; item : TListItem) : boolean; + procedure AttachedToWindow;override; + procedure FrameMoved(new_position : TPoint);override; + function ItemFrame(index : integer) : TRect; + function ResolveSpecifier(msg : TMessage; index : integer; specifier : TMessage; form : integer; properti : PChar) : THandler; + function GetSupportedSuites(data : TMessage) : TStatus_t; + function Perform(d : TPerform_code; arg : Pointer) : TStatus_t; + procedure WindowActivated(state : boolean);override; + procedure MouseUp(pt : TPoint);override; + procedure MouseMoved(pt : TPoint; code : Cardinal; msg : TMessage);override; + procedure DetachedFromWindow;override; + function InitiateDrag(pt : TPoint; itemIndex : integer; initialySelected : boolean) : boolean; + procedure ResizeToPreferred;override; + procedure GetPreferredSize(width : double; height : double); + procedure AllAttached;override; + procedure AllDetached;override; +// procedure enum MiscCode { B_NO_OP, B_REPLACE_OP, B_MOVE_OP, B_SWAP_OP }; + end; + + +function BListView_Create(AObject : TBeObject;frame : TCPlusObject; name : pchar; atype : Tlist_view_type; resizeMask: longint; flags : longint): TCPlusObject; cdecl; external BePascalLibName name 'BListView_Create'; +function BListView_Create(AObject : TBeObject;data : TCPlusObject): TCPlusObject; cdecl; external BePascalLibName name 'BListView_Create_1'; +procedure BListView_Free(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BListView_Free'; +function BListView_Instantiate(AObject : TCPlusObject; data : TCPlusObject) : TArchivable; cdecl; external BePascalLibName name 'BListView_Instantiate'; +function BListView_Archive(AObject : TCPlusObject; data : TCPlusObject; deep : boolean) : TStatus_t; cdecl; external BePascalLibName name 'BListView_Archive'; +procedure BListView_Draw(AObject : TCPlusObject; updateRect : TCPlusObject); cdecl; external BePascalLibName name 'BListView_Draw'; +procedure BListView_MessageReceived(AObject : TCPlusObject; msg : TCPlusObject); cdecl; external BePascalLibName name 'BListView_MessageReceived'; +procedure BListView_MouseDown(AObject : TCPlusObject; where : TCPlusObject); cdecl; external BePascalLibName name 'BListView_MouseDown'; +procedure BListView_KeyDown(AObject : TCPlusObject; bytes : PChar; numBytes : integer); cdecl; external BePascalLibName name 'BListView_KeyDown'; +procedure BListView_MakeFocus(AObject : TCPlusObject; state : boolean); cdecl; external BePascalLibName name 'BListView_MakeFocus'; +procedure BListView_FrameResized(AObject : TCPlusObject; newWidth : double; newHeight : double); cdecl; external BePascalLibName name 'BListView_FrameResized'; +procedure BListView_TargetedByScrollView(AObject : TCPlusObject; scroller : TCPlusObject); cdecl; external BePascalLibName name 'BListView_TargetedByScrollView'; +procedure BListView_ScrollTo(AObject : TCPlusObject; x : double; y : double); cdecl; external BePascalLibName name 'BListView_ScrollTo'; +procedure BListView_ScrollTo(AObject : TCPlusObject; where : TCPlusObject); cdecl; external BePascalLibName name 'BListView_ScrollTo'; +function BListView_AddItem(AObject : TCPlusObject; item : TCPlusObject) : boolean; cdecl; external BePascalLibName name 'BListView_AddItem'; +function BListView_AddItem(AObject : TCPlusObject; item : TCPlusObject; atIndex : integer) : boolean; cdecl; external BePascalLibName name 'BListView_AddItem'; +function BListView_AddList(AObject : TCPlusObject; newItems : TCPlusObject) : boolean; cdecl; external BePascalLibName name 'BListView_AddList'; +function BListView_AddList(AObject : TCPlusObject; newItems : TCPlusObject; atIndex : integer) : boolean; cdecl; external BePascalLibName name 'BListView_AddList'; +function BListView_RemoveItem(AObject : TCPlusObject; item : TCPlusObject) : boolean; cdecl; external BePascalLibName name 'BListView_RemoveItem'; +function BListView_RemoveItem(AObject : TCPlusObject; index : integer) : TListItem; cdecl; external BePascalLibName name 'BListView_RemoveItem_1'; +function BListView_RemoveItems(AObject : TCPlusObject; index : integer; count : integer) : boolean; cdecl; external BePascalLibName name 'BListView_RemoveItems_2'; +procedure BListView_SetSelectionMessage(AObject : TCPlusObject; message : TCPlusObject); cdecl; external BePascalLibName name 'BListView_SetSelectionMessage'; +procedure BListView_SetInvocationMessage(AObject : TCPlusObject; message : TCPlusObject); cdecl; external BePascalLibName name 'BListView_SetInvocationMessage'; +function BListView_SelectionMessage(AObject : TCPlusObject) : TMessage; cdecl; external BePascalLibName name 'BListView_SelectionMessage'; +function BListView_SelectionCommand(AObject : TCPlusObject) : Cardinal; cdecl; external BePascalLibName name 'BListView_SelectionCommand'; +function BListView_InvocationMessage(AObject : TCPlusObject) : TMessage; cdecl; external BePascalLibName name 'BListView_InvocationMessage'; +function BListView_InvocationCommand(AObject : TCPlusObject) : Cardinal; cdecl; external BePascalLibName name 'BListView_InvocationCommand'; +procedure BListView_SetListType(AObject : TCPlusObject; atype : TList_view_type); cdecl; external BePascalLibName name 'BListView_SetListType'; +function BListView_ListType(AObject : TCPlusObject) : TList_view_type; cdecl; external BePascalLibName name 'BListView_ListType'; +function BListView_ItemAt(AObject : TCPlusObject; index : integer) : TListItem; cdecl; external BePascalLibName name 'BListView_ItemAt'; +function BListView_IndexOf(AObject : TCPlusObject; point : TCPlusObject) : integer; cdecl; external BePascalLibName name 'BListView_IndexOf'; +function BListView_IndexOf_1(AObject : TCPlusObject; item : TCPlusObject) : integer; cdecl; external BePascalLibName name 'BListView_IndexOf'; +function BListView_FirstItem(AObject : TCPlusObject) : TListItem; cdecl; external BePascalLibName name 'BListView_FirstItem'; +function BListView_LastItem(AObject : TCPlusObject) : TListItem; cdecl; external BePascalLibName name 'BListView_LastItem'; +function BListView_HasItem(AObject : TCPlusObject; item : TCPlusObject) : boolean; cdecl; external BePascalLibName name 'BListView_HasItem'; +function BListView_CountItems(AObject : TCPlusObject) : integer; cdecl; external BePascalLibName name 'BListView_CountItems'; +procedure BListView_MakeEmpty(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BListView_MakeEmpty'; +function BListView_IsEmpty(AObject : TCPlusObject) : boolean; cdecl; external BePascalLibName name 'BListView_IsEmpty'; +function BListView_Items(AObject : TCPlusObject) : TListView; cdecl; external BePascalLibName name 'BListView_Items'; +procedure BListView_InvalidateItem(AObject : TCPlusObject; index : integer); cdecl; external BePascalLibName name 'BListView_InvalidateItem'; +procedure BListView_ScrollToSelection(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BListView_ScrollToSelection'; +procedure BListView_Select(AObject : TCPlusObject; index : integer; extend : boolean); cdecl; external BePascalLibName name 'BListView_Select'; +procedure BListView_Select(AObject : TCPlusObject; from : integer; ato : integer; extend : boolean); cdecl; external BePascalLibName name 'BListView_Select'; +function BListView_IsItemSelected(AObject : TCPlusObject; index : integer) : boolean; cdecl; external BePascalLibName name 'BListView_IsItemSelected'; +function BListView_CurrentSelection(AObject : TCPlusObject; index : integer) : integer; cdecl; external BePascalLibName name 'BListView_CurrentSelection'; +function BListView_Invoke(AObject : TCPlusObject; msg : TCPlusObject) : TStatus_t; cdecl; external BePascalLibName name 'BListView_Invoke'; +procedure BListView_DeselectAll(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BListView_DeselectAll'; +procedure BListView_DeselectExcept(AObject : TCPlusObject; except_from : integer; except_to : integer); cdecl; external BePascalLibName name 'BListView_DeselectExcept'; +procedure BListView_Deselect(AObject : TCPlusObject; index : integer); cdecl; external BePascalLibName name 'BListView_Deselect'; +procedure BListView_SelectionChanged(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BListView_SelectionChanged'; +function BListView_SwapItems(AObject : TCPlusObject; a : integer; b : integer) : boolean; cdecl; external BePascalLibName name 'BListView_SwapItems'; +function BListView_MoveItem(AObject : TCPlusObject; from : integer; ato : integer) : boolean; cdecl; external BePascalLibName name 'BListView_MoveItem'; +function BListView_ReplaceItem(AObject : TCPlusObject; index : integer; item : TCPlusObject) : boolean; cdecl; external BePascalLibName name 'BListView_ReplaceItem'; +procedure BListView_AttachedToWindow(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BListView_AttachedToWindow'; +procedure BListView_FrameMoved(AObject : TCPlusObject; new_position : TCPlusObject); cdecl; external BePascalLibName name 'BListView_FrameMoved'; +function BListView_ItemFrame(AObject : TCPlusObject; index : integer) : TRect; cdecl; external BePascalLibName name 'BListView_ItemFrame'; +function BListView_ResolveSpecifier(AObject : TCPlusObject; msg : TCPlusObject; index : integer; specifier : TCPlusObject; form : integer; properti : PChar) : THandler; cdecl; external BePascalLibName name 'BListView_ResolveSpecifier'; +function BListView_GetSupportedSuites(AObject : TCPlusObject; data : TCPlusObject) : TStatus_t; cdecl; external BePascalLibName name 'BListView_GetSupportedSuites'; +function BListView_Perform(AObject : TCPlusObject; d : TPerform_code; arg : Pointer) : TStatus_t; cdecl; external BePascalLibName name 'BListView_Perform'; +procedure BListView_WindowActivated(AObject : TCPlusObject; state : boolean); cdecl; external BePascalLibName name 'BListView_WindowActivated'; +procedure BListView_MouseUp(AObject : TCPlusObject; pt : TCPlusObject); cdecl; external BePascalLibName name 'BListView_MouseUp'; +procedure BListView_MouseMoved(AObject : TCPlusObject; pt : TCPlusObject; code : Cardinal; msg : TCPlusObject); cdecl; external BePascalLibName name 'BListView_MouseMoved'; +procedure BListView_DetachedFromWindow(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BListView_DetachedFromWindow'; +function BListView_InitiateDrag(AObject : TCPlusObject; pt : TCPlusObject; itemIndex : integer; initialySelected : boolean) : boolean; cdecl; external BePascalLibName name 'BListView_InitiateDrag'; +procedure BListView_ResizeToPreferred(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BListView_ResizeToPreferred'; +procedure BListView_GetPreferredSize(AObject : TCPlusObject; width : double; height : double); cdecl; external BePascalLibName name 'BListView_GetPreferredSize'; +procedure BListView_AllAttached(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BListView_AllAttached'; +procedure BListView_AllDetached(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BListView_AllDetached'; +//procedure BListView_enum MiscCode { B_NO_OP, B_REPLACE_OP, B_MOVE_OP, B_SWAP_OP }(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BListView_enum MiscCode { B_NO_OP, B_REPLACE_OP, B_MOVE_OP, B_SWAP_OP }'; +//procedure Replace_int32 index(AObject : TCPlusObject); cdecl; external BePascalLibName name 'Replace_int32 index'; +//procedure Replace_BListItem *item(AObject : TCPlusObject); cdecl; external BePascalLibName name 'Replace_BListItem *item'; +//procedure Move_int32 from(AObject : TCPlusObject); cdecl; external BePascalLibName name 'Move_int32 from'; +//procedure Move_int32 to(AObject : TCPlusObject); cdecl; external BePascalLibName name 'Move_int32 to'; +//procedure Swap_int32 a(AObject : TCPlusObject); cdecl; external BePascalLibName name 'Swap_int32 a'; +//procedure Swap_int32 b(AObject : TCPlusObject); cdecl; external BePascalLibName name 'Swap_int32 b'; + +implementation +var + ListItem_SelectionChanged_hook: Pointer; cvar; external; + ListString_InitiateDrag_hook: Pointer; cvar; external; + +constructor TListView.Create(frame : TRect; name : pchar; atype : Tlist_view_type; resizeMask: longint; flags : longint); +begin + CreatePas; + CPlusObject := BListView_Create(Self,frame.CPlusObject,name,atype,resizeMask,flags); +end; + +constructor TListView.Create(data : TMessage); +begin + CreatePas; + CPlusObject := BListView_Create(Self,data.CPlusObject); +end; + +destructor TListView.Destroy; +begin + BListView_Free(CPlusObject); + inherited; +end; + +function TListView.Instantiate(data : TMessage) : TArchivable; +begin + Result := BListView_Instantiate(CPlusObject, data.CPlusObject); +end; + +function TListView.Archive(data : TMessage; deep : boolean) : TStatus_t; +begin + Result := BListView_Archive(CPlusObject, data.CPlusObject, deep); +end; + +procedure TListView.Draw(updateRect : TRect); +begin + //BListView_Draw(CPlusObject, updateRect.CPlusObject); +end; + +procedure TListView.MessageReceived(msg : TMessage); +begin + //BListView_MessageReceived(CPlusObject, msg.CPlusObject); +end; + +procedure TListView.MouseDown(where : TPoint); +begin + //BListView_MouseDown(CPlusObject, where.CPlusObject); +end; + +procedure TListView.KeyDown(bytes : PChar; numBytes : integer); +begin + //BListView_KeyDown(CPlusObject, bytes, numBytes); +end; + +procedure TListView.MakeFocus(state : boolean); +begin + //BListView_MakeFocus(CPlusObject, state); +end; + +procedure TListView.FrameResized(newWidth : double; newHeight : double); +begin + //BListView_FrameResized(CPlusObject, newWidth, newHeight); +end; + +procedure TListView.TargetedByScrollView(scroller : TScrollView); +begin + BListView_TargetedByScrollView(CPlusObject, scroller.CPlusObject); +end; + +procedure TListView.ScrollTo(x : double; y : double); +begin + BListView_ScrollTo(CPlusObject, x, y); +end; + +procedure TListView.ScrollTo(where : TPoint); +begin + BListView_ScrollTo(CPlusObject, where.CPlusObject); +end; + +function TListView.AddItem(item : TListItem) : boolean; +begin + Result := BListView_AddItem(CPlusObject, item.CPlusObject); +end; + +function TListView.AddItem(item : TListItem; atIndex : integer) : boolean; +begin + Result := BListView_AddItem(CPlusObject, item.CPlusObject, atIndex); +end; + +function TListView.AddList(newItems : TList) : boolean; +begin + Result := BListView_AddList(CPlusObject, newItems.CPlusObject); +end; + +function TListView.AddList(newItems : TList; atIndex : integer) : boolean; +begin + Result := BListView_AddList(CPlusObject, newItems.CPlusObject, atIndex); +end; + +function TListView.RemoveItem(item : TListItem) : boolean; +begin + Result := BListView_RemoveItem(CPlusObject, item.CPlusObject); +end; + +function TListView.RemoveItem(index : integer) : TListItem; +begin + Result := BListView_RemoveItem(CPlusObject, index); +end; + +function TListView.RemoveItems(index : integer; count : integer) : boolean; +begin + Result := BListView_RemoveItems(CPlusObject, index, count); +end; + +procedure TListView.SetSelectionMessage(message : TMessage); +begin + BListView_SetSelectionMessage(CPlusObject, message.CPlusObject); +end; + +procedure TListView.SetInvocationMessage(message : TMessage); +begin + BListView_SetInvocationMessage(CPlusObject, message.CPlusObject); +end; + +function TListView.SelectionMessage : TMessage; +begin + Result := BListView_SelectionMessage(CPlusObject); +end; + +function TListView.SelectionCommand : Cardinal; +begin + Result := BListView_SelectionCommand(CPlusObject); +end; + +function TListView.InvocationMessage : TMessage; +begin + Result := BListView_InvocationMessage(CPlusObject); +end; + +function TListView.InvocationCommand : Cardinal; +begin + Result := BListView_InvocationCommand(CPlusObject); +end; + +procedure TListView.SetListType(atype : TList_view_type); +begin + BListView_SetListType(CPlusObject, atype); +end; + +function TListView.ListType : TList_view_type; +begin + Result := BListView_ListType(CPlusObject); +end; + +function TListView.ItemAt(index : integer) : TListItem; +begin + Result := BListView_ItemAt(CPlusObject, index); +end; + +function TListView.IndexOf(point : TPoint) : integer; +begin + Result := BListView_IndexOf(CPlusObject, point.CPlusObject); +end; + +function TListView.IndexOf(item : TListItem) : integer; +begin + Result := BListView_IndexOf(CPlusObject, item.CPlusObject); +end; + +function TListView.FirstItem : TListItem; +begin + Result := BListView_FirstItem(CPlusObject); +end; + +function TListView.LastItem : TListItem; +begin + Result := BListView_LastItem(CPlusObject); +end; + +function TListView.HasItem(item : TListItem) : boolean; +begin + Result := BListView_HasItem(CPlusObject, item.CPlusObject); +end; + +function TListView.CountItems : integer; +begin + Result := BListView_CountItems(CPlusObject); +end; + +procedure TListView.MakeEmpty; +begin + BListView_MakeEmpty(CPlusObject); +end; + +function TListView.IsEmpty : boolean; +begin + Result := BListView_IsEmpty(CPlusObject); +end; + +function TListView.Items : TListView; +begin + Result := BListView_Items(CPlusObject); +end; + +procedure TListView.InvalidateItem(index : integer); +begin + BListView_InvalidateItem(CPlusObject, index); +end; + +procedure TListView.ScrollToSelection; +begin + BListView_ScrollToSelection(CPlusObject); +end; + +procedure TListView.Select(index : integer; extend : boolean); +begin + BListView_Select(CPlusObject, index, extend); +end; + +procedure TListView.Select(from : integer; ato : integer; extend : boolean); +begin + BListView_Select(CPlusObject, from, ato, extend); +end; + +function TListView.IsItemSelected(index : integer) : boolean; +begin + Result := BListView_IsItemSelected(CPlusObject, index); +end; + +function TListView.CurrentSelection(index : integer) : integer; +begin + Result := BListView_CurrentSelection(CPlusObject, index); +end; + +function TListView.Invoke(msg : TMessage) : TStatus_t; +begin + Result := BListView_Invoke(CPlusObject, msg.CPlusObject); +end; + +procedure TListView.DeselectAll; +begin + BListView_DeselectAll(CPlusObject); +end; + +procedure TListView.DeselectExcept(except_from : integer; except_to : integer); +begin + BListView_DeselectExcept(CPlusObject, except_from, except_to); +end; + +procedure TListView.Deselect(index : integer); +begin + BListView_Deselect(CPlusObject, index); +end; + +procedure TListView.SelectionChanged; +begin + //BListView_SelectionChanged(CPlusObject); +end; + +function TListView.SwapItems(a : integer; b : integer) : boolean; +begin + Result := BListView_SwapItems(CPlusObject, a, b); +end; + +function TListView.MoveItem(from : integer; ato : integer) : boolean; +begin + Result := BListView_MoveItem(CPlusObject, from, ato); +end; + +function TListView.ReplaceItem(index : integer; item : TListItem) : boolean; +begin + Result := BListView_ReplaceItem(CPlusObject, index, item.CPlusObject); +end; + +procedure TListView.AttachedToWindow; +begin + //BListView_AttachedToWindow(CPlusObject); +end; + +procedure TListView.FrameMoved(new_position : TPoint); +begin + //BListView_FrameMoved(CPlusObject, new_position.CPlusObject); +end; + +function TListView.ItemFrame(index : integer) : TRect; +begin + Result := BListView_ItemFrame(CPlusObject, index); +end; + +function TListView.ResolveSpecifier(msg : TMessage; index : integer; specifier : TMessage; form : integer; properti : PChar) : THandler; +begin + Result := BListView_ResolveSpecifier(CPlusObject, msg.CPlusObject, index, specifier.CPlusObject, form, properti); +end; + +function TListView.GetSupportedSuites(data : TMessage) : TStatus_t; +begin + Result := BListView_GetSupportedSuites(CPlusObject, data.CPlusObject); +end; + +function TListView.Perform(d : TPerform_code; arg : Pointer) : TStatus_t; +begin + Result := BListView_Perform(CPlusObject, d, arg); +end; + +procedure TListView.WindowActivated(state : boolean); +begin + //BListView_WindowActivated(CPlusObject, state); +end; + +procedure TListView.MouseUp(pt : TPoint); +begin + //BListView_MouseUp(CPlusObject, pt.CPlusObject); +end; + +procedure TListView.MouseMoved(pt : TPoint; code : Cardinal; msg : TMessage); +begin + //BListView_MouseMoved(CPlusObject, pt.CPlusObject, code, msg); +end; + +procedure TListView.DetachedFromWindow; +begin + //BListView_DetachedFromWindow(CPlusObject); +end; + +function TListView.InitiateDrag(pt : TPoint; itemIndex : integer; initialySelected : boolean) : boolean; +begin + Result := BListView_InitiateDrag(CPlusObject, pt.CPlusObject, itemIndex, initialySelected); +end; + +procedure TListView.ResizeToPreferred; +begin + //BListView_ResizeToPreferred(CPlusObject); +end; + +procedure TListView.GetPreferredSize(width : double; height : double); +begin + // BListView_GetPreferredSize(CPlusObject, width, height); +end; + +procedure TListView.AllAttached; +begin + //BListView_AllAttached(CPlusObject); +end; + +procedure TListView.AllDetached; +begin + //BListView_AllDetached(CPlusObject); +end; + +procedure ListItem_SelectionChanged_hook_func(Liste : TListView); cdecl; + +begin + try + if Liste <> nil then + begin + Liste.SelectionChanged; + end; + finally + end; +end; + +initialization + ListItem_SelectionChanged_hook:=@ListItem_SelectionChanged_hook_func; +end. diff --git a/bepascal/bepascal/be/interface/outlinelistview.pp b/bepascal/bepascal/be/interface/outlinelistview.pp new file mode 100644 index 0000000..7c08e27 --- /dev/null +++ b/bepascal/bepascal/be/interface/outlinelistview.pp @@ -0,0 +1,357 @@ +{ BePascal - A pascal wrapper around the BeOS API + Copyright (C) 2002 Olivier Coursiere + Eric Jourde + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +} +unit outlinelistview; + +interface + +uses + beobj, view, message, archivable, SupportDefs, rect, list, + handler, messenger,interfacedefs,font,graphicdefs,scrollview,listitem,listview; + +type + TOutlineListView = class(TListView) + private + public + constructor Create(frame : TRect; name : pchar; atype : Tlist_view_type; resizeMask: longint; flags : longint); override; + constructor Create(data : TMessage); + destructor Destroy;override; + function Instantiate(data : TMessage) : TArchivable; + function Archive(data : TMessage; deep : boolean) : TStatus_t; + procedure MouseDown(where : TPoint);override; + procedure KeyDown(bytes : PChar; numBytes : integer);override; + procedure FrameMoved(new_position : TPoint);override; + procedure FrameResized(new_width : double; new_height : double);override; + procedure MouseUp(where : TPoint);override; + function AddUnder(item : TListItem; underItem : TListItem) : boolean; + function AddItem(item : TListItem) : boolean; + function AddItem(item : TListItem; fullListIndex : integer) : boolean; + function AddList(newItems : TList) : boolean; + function AddList(newItems : TList; fullListIndex : integer) : boolean; + function RemoveItem(item : TListItem) : boolean; + function RemoveItem(fullListIndex : integer) : TListItem; + function RemoveItems(fullListIndex : integer; count : integer) : boolean; + function FullListItemAt(fullListIndex : integer) : TListItem; + function FullListIndexOf(point : TPoint) : integer; + function FullListIndexOf(item : TListItem) : integer; + function FullListFirstItem : TListItem; + function FullListLastItem : TListItem; + function FullListHasItem(item : TListItem) : boolean; + function FullListCountItems : integer; + function FullListCurrentSelection(index : integer) : integer; + procedure MakeEmpty; + function FullListIsEmpty : boolean; + function Superitem(item : TListItem) : TListItem; + procedure Expand(item : TListItem); + procedure Collapse(item : TListItem); + function IsExpanded(fullListIndex : integer) : boolean; + function ResolveSpecifier(msg : TMessage; index : integer; specifier : TMessage; form : integer; properti : PChar) : THandler; + function GetSupportedSuites(data : TMessage) : TStatus_t; + function Perform(d : TPerform_code; arg : Pointer) : TStatus_t; + procedure ResizeToPreferred;override; + procedure GetPreferredSize(width : double; height : double); + procedure MakeFocus(state : boolean); + procedure AllAttached;override; + procedure AllDetached;override; + procedure DetachedFromWindow;override; + function CountItemsUnder(under : TListItem; oneLevelOnly : boolean) : integer; + function ItemUnderAt(underItem : TListItem; oneLevelOnly : boolean; index : integer) : TListItem; +// function DoMiscellaneous(code : ; data : ) : boolean; +// procedure MessageReceived( : TMessage); + end; + +function BOutlineListView_Create(AObject : TBeObject; frame : TCPlusObject; name : pchar; atype : Tlist_view_type; resizeMask: longint; flags : longint):TCPlusObject; cdecl; external BePascalLibName name 'BOutlineListView_Create'; +function BOutlineListView_Create_1(AObject : TBeObject;data : TCPlusObject):TCPlusObject; cdecl; external BePascalLibName name 'BOutlineListView_Create_1'; +procedure BOutlineListView_Free(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BOutlineListView_Free'; +function BOutlineListView_Instantiate(AObject : TCPlusObject; data : TCPlusObject) : TArchivable; cdecl; external BePascalLibName name 'BOutlineListView_Instantiate'; +function BOutlineListView_Archive(AObject : TCPlusObject; data : TCPlusObject; deep : boolean) : TStatus_t; cdecl; external BePascalLibName name 'BOutlineListView_Archive'; +procedure BOutlineListView_MouseDown(AObject : TCPlusObject; where : TCPlusObject); cdecl; external BePascalLibName name 'BOutlineListView_MouseDown'; +procedure BOutlineListView_KeyDown(AObject : TCPlusObject; bytes : PChar; numBytes : integer); cdecl; external BePascalLibName name 'BOutlineListView_KeyDown'; +procedure BOutlineListView_FrameMoved(AObject : TCPlusObject; new_position : TCPlusObject); cdecl; external BePascalLibName name 'BOutlineListView_FrameMoved'; +procedure BOutlineListView_FrameResized(AObject : TCPlusObject; new_width : double; new_height : double); cdecl; external BePascalLibName name 'BOutlineListView_FrameResized'; +procedure BOutlineListView_MouseUp(AObject : TCPlusObject; where : TCPlusObject); cdecl; external BePascalLibName name 'BOutlineListView_MouseUp'; +function BOutlineListView_AddUnder(AObject : TCPlusObject; item : TCPlusObject; underItem : TCPlusObject) : boolean; cdecl; external BePascalLibName name 'BOutlineListView_AddUnder'; +function BOutlineListView_AddItem(AObject : TCPlusObject; item : TCPlusObject) : boolean; cdecl; external BePascalLibName name 'BOutlineListView_AddItem'; +function BOutlineListView_AddItem(AObject : TCPlusObject; item : TCPlusObject; fullListIndex : integer) : boolean; cdecl; external BePascalLibName name 'BOutlineListView_AddItem'; +function BOutlineListView_AddList(AObject : TCPlusObject; newItems : TCPlusObject) : boolean; cdecl; external BePascalLibName name 'BOutlineListView_AddList'; +function BOutlineListView_AddList(AObject : TCPlusObject; newItems : TCPlusObject; fullListIndex : integer) : boolean; cdecl; external BePascalLibName name 'BOutlineListView_AddList'; +function BOutlineListView_RemoveItem(AObject : TCPlusObject; item : TCPlusObject) : boolean; cdecl; external BePascalLibName name 'BOutlineListView_RemoveItem'; +function BOutlineListView_RemoveItem_1(AObject : TCPlusObject; fullListIndex : integer) : TCPlusObject; cdecl; external BePascalLibName name 'BOutlineListView_RemoveItem_1'; +function BOutlineListView_RemoveItems(AObject : TCPlusObject; fullListIndex : integer; count : integer) : boolean; cdecl; external BePascalLibName name 'BOutlineListView_RemoveItems'; +function BOutlineListView_FullListItemAt(AObject : TCPlusObject; fullListIndex : integer) : TListItem; cdecl; external BePascalLibName name 'BOutlineListView_FullListItemAt'; +function BOutlineListView_FullListIndexOf(AObject : TCPlusObject; point : TCPlusObject) : integer; cdecl; external BePascalLibName name 'BOutlineListView_FullListIndexOf'; +function BOutlineListView_FullListIndexOf_1(AObject : TCPlusObject; item : TCPlusObject) : integer; cdecl; external BePascalLibName name 'BOutlineListView_FullListIndexOf_1'; +function BOutlineListView_FullListFirstItem(AObject : TCPlusObject) : TListItem; cdecl; external BePascalLibName name 'BOutlineListView_FullListFirstItem'; +function BOutlineListView_FullListLastItem(AObject : TCPlusObject) : TListItem; cdecl; external BePascalLibName name 'BOutlineListView_FullListLastItem'; +function BOutlineListView_FullListHasItem(AObject : TCPlusObject; item : TCPlusObject) : boolean; cdecl; external BePascalLibName name 'BOutlineListView_FullListHasItem'; +function BOutlineListView_FullListCountItems(AObject : TCPlusObject) : integer; cdecl; external BePascalLibName name 'BOutlineListView_FullListCountItems'; +function BOutlineListView_FullListCurrentSelection(AObject : TCPlusObject; index : integer) : integer; cdecl; external BePascalLibName name 'BOutlineListView_FullListCurrentSelection'; +procedure BOutlineListView_MakeEmpty(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BOutlineListView_MakeEmpty'; +function BOutlineListView_FullListIsEmpty(AObject : TCPlusObject) : boolean; cdecl; external BePascalLibName name 'BOutlineListView_FullListIsEmpty'; +function BOutlineListView_Superitem(AObject : TCPlusObject; item : TCPlusObject) : TListItem; cdecl; external BePascalLibName name 'BOutlineListView_Superitem'; +procedure BOutlineListView_Expand(AObject : TCPlusObject; item : TCPlusObject); cdecl; external BePascalLibName name 'BOutlineListView_Expand'; +procedure BOutlineListView_Collapse(AObject : TCPlusObject; item : TCPlusObject); cdecl; external BePascalLibName name 'BOutlineListView_Collapse'; +function BOutlineListView_IsExpanded(AObject : TCPlusObject; fullListIndex : integer) : boolean; cdecl; external BePascalLibName name 'BOutlineListView_IsExpanded'; +function BOutlineListView_ResolveSpecifier(AObject : TCPlusObject; msg : TCPlusObject; index : integer; specifier : TCPlusObject; form : integer; properti : PChar) : THandler; cdecl; external BePascalLibName name 'BOutlineListView_ResolveSpecifier'; +function BOutlineListView_GetSupportedSuites(AObject : TCPlusObject; data : TCPlusObject) : TStatus_t; cdecl; external BePascalLibName name 'BOutlineListView_GetSupportedSuites'; +function BOutlineListView_Perform(AObject : TCPlusObject; d : TPerform_code; arg : Pointer) : TStatus_t; cdecl; external BePascalLibName name 'BOutlineListView_Perform'; +procedure BOutlineListView_ResizeToPreferred(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BOutlineListView_ResizeToPreferred'; +procedure BOutlineListView_GetPreferredSize(AObject : TCPlusObject; width : double; height : double); cdecl; external BePascalLibName name 'BOutlineListView_GetPreferredSize'; +procedure BOutlineListView_MakeFocus(AObject : TCPlusObject; state : boolean); cdecl; external BePascalLibName name 'BOutlineListView_MakeFocus'; +procedure BOutlineListView_AllAttached(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BOutlineListView_AllAttached'; +procedure BOutlineListView_AllDetached(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BOutlineListView_AllDetached'; +procedure BOutlineListView_DetachedFromWindow(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BOutlineListView_DetachedFromWindow'; +function BOutlineListView_CountItemsUnder(AObject : TCPlusObject; under : TCPlusObject; oneLevelOnly : boolean) : integer; cdecl; external BePascalLibName name 'BOutlineListView_CountItemsUnder'; +function BOutlineListView_ItemUnderAt(AObject : TCPlusObject; underItem : TCPlusObject; oneLevelOnly : boolean; index : integer) : TListItem; cdecl; external BePascalLibName name 'BOutlineListView_ItemUnderAt'; +//function BOutlineListView_DoMiscellaneous(AObject : TCPlusObject; code : ; data : ) : boolean; cdecl; external BePascalLibName name 'BOutlineListView_DoMiscellaneous'; +//procedure BOutlineListView_MessageReceived(AObject : TCPlusObject; : TCPlusObject); cdecl; external BePascalLibName name 'BOutlineListView_MessageReceived'; + +implementation + + +constructor TOutlineListView.Create(frame : TRect; name : pchar; atype : Tlist_view_type; resizeMask: longint; flags : longint); +begin + CreatePas; + CPlusObject := BOutlineListView_Create(Self,frame.CPlusObject,name,atype,resizeMask,flags); +end; + +constructor TOutlineListView.Create(data : TMessage); +begin + CreatePas; + CPlusObject := BOutlineListView_Create_1(Self,data.CPlusObject); +end; + +destructor TOutlineListView.Destroy; +begin + BOutlineListView_Free(CPlusObject); + inherited; +end; + +function TOutlineListView.Instantiate(data : TMessage) : TArchivable; +begin + Result := BOutlineListView_Instantiate(CPlusObject, data.CPlusObject); +end; + +function TOutlineListView.Archive(data : TMessage; deep : boolean) : TStatus_t; +begin + Result := BOutlineListView_Archive(CPlusObject, data.CPlusObject, deep); +end; + +procedure TOutlineListView.MouseDown(where : TPoint); +begin +// BOutlineListView_MouseDown(CPlusObject, where.CPlusObject); +end; + +procedure TOutlineListView.KeyDown(bytes : PChar; numBytes : integer); +begin + // BOutlineListView_KeyDown(CPlusObject, bytes, numBytes); +end; + +procedure TOutlineListView.FrameMoved(new_position : TPoint); +begin +// BOutlineListView_FrameMoved(CPlusObject, new_position.CPlusObject); +end; + +procedure TOutlineListView.FrameResized(new_width : double; new_height : double); +begin +// BOutlineListView_FrameResized(CPlusObject, new_width, new_height); +end; + +procedure TOutlineListView.MouseUp(where : TPoint); +begin +// BOutlineListView_MouseUp(CPlusObject, where.CPlusObject); +end; + +function TOutlineListView.AddUnder(item : TListItem; underItem : TListItem) : boolean; +begin + Result := BOutlineListView_AddUnder(CPlusObject, item.CPlusObject, underItem.CPlusObject); +end; + +function TOutlineListView.AddItem(item : TListItem) : boolean; +begin + Result := BOutlineListView_AddItem(CPlusObject, item.CPlusObject); +end; + +function TOutlineListView.AddItem(item : TListItem; fullListIndex : integer) : boolean; +begin + Result := BOutlineListView_AddItem(CPlusObject, item.CPlusObject, fullListIndex); +end; + +function TOutlineListView.AddList(newItems : TList) : boolean; +begin + Result := BOutlineListView_AddList(CPlusObject, newItems.CPlusObject); +end; + +function TOutlineListView.AddList(newItems : TList; fullListIndex : integer) : boolean; +begin + Result := BOutlineListView_AddList(CPlusObject, newItems.CPlusObject, fullListIndex); +end; + +function TOutlineListView.RemoveItem(item : TListItem) : boolean; +begin + Result := BOutlineListView_RemoveItem(CPlusObject, item.CPlusObject); +end; + +function TOutlineListView.RemoveItem(fullListIndex : integer) : TListItem; +begin +// Result := BOutlineListView_RemoveItem_1(CPlusObject, fullListIndex); +end; + +function TOutlineListView.RemoveItems(fullListIndex : integer; count : integer) : boolean; +begin + Result := BOutlineListView_RemoveItems(CPlusObject, fullListIndex, count); +end; + +function TOutlineListView.FullListItemAt(fullListIndex : integer) : TListItem; +begin + Result := BOutlineListView_FullListItemAt(CPlusObject, fullListIndex); +end; + +function TOutlineListView.FullListIndexOf(point : TPoint) : integer; +begin + Result := BOutlineListView_FullListIndexOf(CPlusObject, point.CPlusObject); +end; + +function TOutlineListView.FullListIndexOf(item : TListItem) : integer; +begin + Result := BOutlineListView_FullListIndexOf(CPlusObject, item.CPlusObject); +end; + +function TOutlineListView.FullListFirstItem : TListItem; +begin + Result := BOutlineListView_FullListFirstItem(CPlusObject); +end; + +function TOutlineListView.FullListLastItem : TListItem; +begin + Result := BOutlineListView_FullListLastItem(CPlusObject); +end; + +function TOutlineListView.FullListHasItem(item : TListItem) : boolean; +begin + Result := BOutlineListView_FullListHasItem(CPlusObject, item.CPlusObject); +end; + +function TOutlineListView.FullListCountItems : integer; +begin + Result := BOutlineListView_FullListCountItems(CPlusObject); +end; + +function TOutlineListView.FullListCurrentSelection(index : integer) : integer; +begin + Result := BOutlineListView_FullListCurrentSelection(CPlusObject, index); +end; + +procedure TOutlineListView.MakeEmpty; +begin + BOutlineListView_MakeEmpty(CPlusObject); +end; + +function TOutlineListView.FullListIsEmpty : boolean; +begin + Result := BOutlineListView_FullListIsEmpty(CPlusObject); +end; + +function TOutlineListView.Superitem(item : TListItem) : TListItem; +begin + Result := BOutlineListView_Superitem(CPlusObject, item); +end; + +procedure TOutlineListView.Expand(item : TListItem); +begin + BOutlineListView_Expand(CPlusObject, item.CPlusObject); +end; + +procedure TOutlineListView.Collapse(item : TListItem); +begin + BOutlineListView_Collapse(CPlusObject, item.CPlusObject); +end; + +function TOutlineListView.IsExpanded(fullListIndex : integer) : boolean; +begin + Result := BOutlineListView_IsExpanded(CPlusObject, fullListIndex); +end; + +function TOutlineListView.ResolveSpecifier(msg : TMessage; index : integer; specifier : TMessage; form : integer; properti : PChar) : THandler; +begin + Result := BOutlineListView_ResolveSpecifier(CPlusObject, msg.CPlusObject, index, specifier.CPlusObject, form, properti); +end; + +function TOutlineListView.GetSupportedSuites(data : TMessage) : TStatus_t; +begin + Result := BOutlineListView_GetSupportedSuites(CPlusObject, data.CPlusObject); +end; + +function TOutlineListView.Perform(d : TPerform_code; arg : Pointer) : TStatus_t; +begin + Result := BOutlineListView_Perform(CPlusObject, d, arg); +end; + +procedure TOutlineListView.ResizeToPreferred; +begin + BOutlineListView_ResizeToPreferred(CPlusObject); +end; + +procedure TOutlineListView.GetPreferredSize(width : double; height : double); +begin + BOutlineListView_GetPreferredSize(CPlusObject, width, height); +end; + +procedure TOutlineListView.MakeFocus(state : boolean); +begin + BOutlineListView_MakeFocus(CPlusObject, state); +end; + +procedure TOutlineListView.AllAttached; +begin + BOutlineListView_AllAttached(CPlusObject); +end; + +procedure TOutlineListView.AllDetached; +begin + BOutlineListView_AllDetached(CPlusObject); +end; + +procedure TOutlineListView.DetachedFromWindow; +begin + BOutlineListView_DetachedFromWindow(CPlusObject); +end; + +function TOutlineListView.CountItemsUnder(under : TListItem; oneLevelOnly : boolean) : integer; +begin + Result := BOutlineListView_CountItemsUnder(CPlusObject, under.CPlusObject, oneLevelOnly); +end; + +function TOutlineListView.ItemUnderAt(underItem : TListItem; oneLevelOnly : boolean; index : integer) : TListItem; +begin + Result := BOutlineListView_ItemUnderAt(CPlusObject, underItem.CPlusObject, oneLevelOnly, index); +end; + +{function TOutlineListView.DoMiscellaneous(code : ; data : ) : boolean; +begin + Result := BOutlineListView_DoMiscellaneous(CPlusObject, code, data); +end; + +procedure TOutlineListView.MessageReceived( : TMessage); +begin + BOutlineListView_MessageReceived(CPlusObject, .CPlusObject); +end; +} + + +end.