This commit is contained in:
memson
2002-04-27 08:29:51 +00:00
parent ea1f7b3b83
commit 132a7ca23e
8 changed files with 137 additions and 12 deletions

View File

@@ -0,0 +1,60 @@
program untitled;
uses
begui;
type
PTest = ^TTest;
TTest = object
handle: MButtonH;
owner: MFormH;
procedure test;
procedure AddToForm(Form: MFormH);
constructor init;
destructor done; virtual;
end;
constructor TTest.init;
begin
write('init');
handle := MButton_Create_int32(170,20,190,30, pchar('C'));
writeln('.. after button create');
end;
destructor TTest.done;
begin
write('done');
handle := nil;
writeln('.. after done');
end;
procedure TTest.test;
begin
writeln('test');
end;
procedure TTest.AddToForm(Form: MFormH);
begin
owner := Form;
MForm_AddChild(owner, handle);
end;
var
t: ptest;
MainForm: MFormH;
begin
new(t, init);
MainForm := MApplication_GetMainForm(Application);
t^.test;
t^.AddToForm(MainForm);
t^.test;
MApplication_Run(application);
dispose(t, done);
end.

View File

@@ -1,9 +1,12 @@
/* /*
$Header: /home/haiku/befpc/begui/begui/libbegui/BeGuiClasses.cpp,v 1.3 2002-04-23 18:37:29 memson Exp $ $Header: /home/haiku/befpc/begui/begui/libbegui/BeGuiClasses.cpp,v 1.4 2002-04-27 08:29:51 memson Exp $
$Revision: 1.3 $ $Revision: 1.4 $
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.3 2002/04/23 18:37:29 memson
*** empty log message ***
Revision 1.2 2002/04/12 23:32:56 memson Revision 1.2 2002/04/12 23:32:56 memson
Added quite a bit. Added quite a bit.
@@ -110,12 +113,13 @@
*/ */
#define BEGUI_EXPORTS 1 #define BEGUI_EXPORTS 1
#include "MList.h" #include "MList.h"
#include "MFile.h" #include "MFile.h"
#include "BeGuiClasses.h" #include "BeGuiClasses.h"
#include <stdio.h> #include <stdio.h>
#include <storage/Path.h> #include <storage/Path.h>
#include "debug.h"
//clik - control click //clik - control click
#define ClickMessage 'clik' #define ClickMessage 'clik'
@@ -904,6 +908,8 @@ thread_id MApplication::Run(void)
void MApplication::RefsReceived(BMessage *message) void MApplication::RefsReceived(BMessage *message)
{ {
SendText("MApplication::RefsReceived");
if (message->what == SAVE_PANEL_MESSAGE){ if (message->what == SAVE_PANEL_MESSAGE){
printf("\nSave\n"); printf("\nSave\n");
} }
@@ -927,7 +933,10 @@ void MApplication::MessageReceived(BMessage *message)
uint32 type; uint32 type;
int32 count; int32 count;
SendText("MApplication::MessageRecvd");
if (message->what == SAVE_PANEL_MESSAGE){ if (message->what == SAVE_PANEL_MESSAGE){
SendText("MApplication::MessageRecvd - save panel");
if ( (err = message->FindRef("directory", &ref)) != B_OK ) { if ( (err = message->FindRef("directory", &ref)) != B_OK ) {
//printf("failed to find dir, error %d\n", err); //printf("failed to find dir, error %d\n", err);
return; return;
@@ -956,33 +965,47 @@ void MApplication::MessageReceived(BMessage *message)
} }
} }
if (message->what == OPEN_PANEL_MESSAGE){ else if (message->what == OPEN_PANEL_MESSAGE){
printf("open\n"); SendText("MApplication::MessageRecvd - open panel");
message->GetInfo("refs", &type, &count); message->GetInfo("refs", &type, &count);
if (type != B_REF_TYPE) { if (type != B_REF_TYPE) {
printf("no refs found\n"); SendText("MApplication::MessageRecvd - no refs found");
return; return;
} }
for (int32 i = --count; i >= 0; --i) { for (int32 i = --count; i >= 0; --i) {
if ((err = message->FindRef("refs", i, &ref)) == B_OK) { if ((err = message->FindRef("refs", i, &ref)) == B_OK) {
if (message->FindPointer("source", &pointer) == B_OK){ if (message->FindPointer("source", &pointer) == B_OK){
printf("works1\n"); SendText("MApplication::MessageRecvd - works 1");
if ( (err = entry.SetTo(&ref)) != B_OK ){ if ( (err = entry.SetTo(&ref)) != B_OK ){
printf("failed to create entr from path, error %d\n", err); SendText("MApplication::MessageRecvd - failed to create entr from path, error");
return; return;
} }
entry.GetPath(&path); entry.GetPath(&path);
if ((filepanel = reinterpret_cast<MFilePanel*>(pointer)) != NULL){ if ((filepanel = reinterpret_cast<MFilePanel*>(pointer)) != NULL){
printf("works2\n"); SendText("MApplication::MessageRecvd - works2");
printf( "before event ... %s\n", path.Path() ); BString s;
filepanel->DoExecute( path ); s << "MApplication::MessageRecvd - " << "before event ... " << path.Path();
SendText( s.String() );
if ( LockLooper() ){
if (fMainForm->LockLooper()){
SendText("right befire call for file event");
filepanel->DoExecute( path );
SendText("just after call for file event");
fMainForm->UnlockLooper();
}
UnlockLooper();
}
} }
} }
BString s;
s.SetTo("MApplication::MessageRecvd - after file open event code");
SendText( s.String() );
} }
else { else {
printf("processing ref %d there was an error %d", i, err); printf("processing ref %d there was an error %d", i, err);
@@ -990,7 +1013,10 @@ void MApplication::MessageReceived(BMessage *message)
} }
} }
} }
else {
printf("MApplication::messagereceived\n");
BApplication::MessageReceived(message);
}
} }
void MApplication::Terminate(void) void MApplication::Terminate(void)
@@ -1061,6 +1087,7 @@ void MForm::MessageReceived(BMessage *message){
} }
else else
{ {
printf("MForm::messagereceived\n");
BWindow::MessageReceived(message); BWindow::MessageReceived(message);
} }
} }

View File

@@ -1,4 +1,5 @@
#include "MFile.h" #include "MFile.h"
#include "debug.h"
///////////////////////////////////////////////// /////////////////////////////////////////////////
// Class MFile // Class MFile
@@ -218,7 +219,9 @@ void MDialogPlugin::DoExecute(BPath path)
} }
if (fDialogMsg != NULL){ if (fDialogMsg != NULL){
SendText("before the code in MDialogPlugin calls event");
fDialogMsg( this, amsg, path.Path() ); fDialogMsg( this, amsg, path.Path() );
SendText("after the code in MDialogPlugin calls event");
} }
} }

View File

@@ -1,4 +1,5 @@
#include "MFont.h" #include "MFont.h"
#include "debug.h"
BFont* BFont_Create(){ BFont* BFont_Create(){
return new BFont(); return new BFont();

View File

@@ -1,6 +1,15 @@
#ifndef MFONT_H #ifndef MFONT_H
#define MFONT_H #define MFONT_H
/*
$Header: /home/haiku/befpc/begui/begui/libbegui/MFont.h,v 1.2 2002-04-27 08:29:51 memson Exp $
$Revision: 1.2 $
$Log: not supported by cvs2svn $
*/
#include <Font.h> #include <Font.h>
#ifdef __cplusplus #ifdef __cplusplus

View File

@@ -0,0 +1,19 @@
#include <Application.h>
#include <Message.h>
#include <String.h>
#include "debug.h"
void SendMessage(BMessage *message){
if (be_app != NULL){
BMessenger messenger("application/x-vnd.befpc-debugconsole");
if (messenger.IsValid()) messenger.SendMessage(message);
}
}
void SendText(const char *text){
BMessage *msg = new BMessage('dbug');
BString s;
s << "libbegui: " << text;
msg->AddString( "dbstring", s.String() );
SendMessage(msg);
}

View File

@@ -0,0 +1,6 @@
#ifndef _DEBUG_H
#define _DEBUG_H
void SendText(const char *text);
#endif

Binary file not shown.