added some files

This commit is contained in:
Santiago Lema 2024-09-29 17:58:05 -03:00
parent dbfee4dcdd
commit 6be1aad043
9 changed files with 390 additions and 0 deletions

BIN
.genio Normal file

Binary file not shown.

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
objects*/

52
App.cpp Normal file
View file

@ -0,0 +1,52 @@
/*
* Copyright 2024, Santiago Lema <santiago@lema.org>
* All rights reserved. Distributed under the terms of the MIT license.
*/
#include "App.h"
#include "MainWindow.h"
#include <AboutWindow.h>
#include <Catalog.h>
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "Application"
const char* kApplicationSignature = "application/x-vnd.SLema-DumBer";
App::App()
:
BApplication(kApplicationSignature)
{
MainWindow* mainWindow = new MainWindow();
mainWindow->Show();
}
App::~App()
{
}
void
App::AboutRequested()
{
BAboutWindow* about
= new BAboutWindow(B_TRANSLATE_SYSTEM_NAME("DumBer"), kApplicationSignature);
about->AddDescription(B_TRANSLATE("Type text in there to feel dumber."));
about->AddCopyright(2024, "Santiago Lema");
about->AddText("Ho");
about->Show();
}
int
main()
{
App* app = new App();
app->Run();
delete app;
return 0;
}

24
App.h Normal file
View file

@ -0,0 +1,24 @@
/*
* Copyright 2024, My Name <my@email.address>
* All rights reserved. Distributed under the terms of the MIT license.
*/
#ifndef APP_H
#define APP_H
#include <Application.h>
class App : public BApplication
{
public:
App();
virtual ~App();
virtual void AboutRequested();
private:
};
#endif // APP_H

BIN
DumBer Executable file

Binary file not shown.

120
MainWindow.cpp Normal file
View file

@ -0,0 +1,120 @@
/*
* Copyright 2024, My Name <my@email.address>
* All rights reserved. Distributed under the terms of the MIT license.
*/
#include "MainWindow.h"
#include <Application.h>
#include <Catalog.h>
#include <LayoutBuilder.h>
#include <Menu.h>
#include <MenuBar.h>
#include <View.h>
#include <cstdio>
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "Window"
static const uint32 kMsgNewFile = 'fnew';
static const uint32 kMsgOpenFile = 'fopn';
static const uint32 kMsgSaveFile = 'fsav';
static const uint32 kSendPrompt = 'kspt';
MainWindow::MainWindow()
:
BWindow(BRect(100, 100, 500, 400), B_TRANSLATE("BeDumb"), B_TITLED_WINDOW,
B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE)
{
BMenuBar* menuBar = _BuildMenu();
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
.Add(menuBar)
.AddGlue()
.End();
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
.AddGroup(B_HORIZONTAL, 0)
// .Add(new BTextControl("Input 1", "Label 1", "Default text"))
// .Add(new BButton("Go", new BMessage(kSendPrompt))
.End()
// .Add(new BTextView("Text View", new BRect(0, 0, 10, 10), B_FOLLOW_ALL_SIDES, B_WILL_DRAW))
.SetInsets(5, 5, 5, 5)
.End();
}
MainWindow::~MainWindow()
{
}
void
MainWindow::MessageReceived(BMessage* message)
{
switch (message->what) {
case kMsgNewFile:
{
fSaveMenuItem->SetEnabled(false);
printf("New\n");
} break;
case kMsgOpenFile:
{
fSaveMenuItem->SetEnabled(true);
printf("Open\n");
} break;
case kMsgSaveFile:
{
printf("Save\n");
} break;
default:
{
BWindow::MessageReceived(message);
break;
}
}
}
BMenuBar*
MainWindow::_BuildMenu()
{
BMenuBar* menuBar = new BMenuBar("menubar");
BMenu* menu;
BMenuItem* item;
// menu 'File'
menu = new BMenu(B_TRANSLATE("File"));
item = new BMenuItem(B_TRANSLATE("New"), new BMessage(kMsgNewFile), 'N');
menu->AddItem(item);
item = new BMenuItem(B_TRANSLATE("Open" B_UTF8_ELLIPSIS), new BMessage(kMsgOpenFile), 'O');
menu->AddItem(item);
fSaveMenuItem = new BMenuItem(B_TRANSLATE("Save"), new BMessage(kMsgSaveFile), 'S');
fSaveMenuItem->SetEnabled(false);
menu->AddItem(fSaveMenuItem);
menu->AddSeparatorItem();
item = new BMenuItem(B_TRANSLATE("About" B_UTF8_ELLIPSIS), new BMessage(B_ABOUT_REQUESTED));
item->SetTarget(be_app);
menu->AddItem(item);
item = new BMenuItem(B_TRANSLATE("Quit"), new BMessage(B_QUIT_REQUESTED), 'Q');
menu->AddItem(item);
menuBar->AddItem(menu);
return menuBar;
}

27
MainWindow.h Normal file
View file

@ -0,0 +1,27 @@
/*
* Copyright 2024, My Name <my@email.address>
* All rights reserved. Distributed under the terms of the MIT license.
*/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <MenuItem.h>
#include <Window.h>
class MainWindow : public BWindow
{
public:
MainWindow();
virtual ~MainWindow();
virtual void MessageReceived(BMessage* msg);
private:
BMenuBar* _BuildMenu();
BMenuItem* fSaveMenuItem;
};
#endif

127
Makefile Normal file
View file

@ -0,0 +1,127 @@
## Haiku Generic Makefile v2.6 ##
## Fill in this file to specify the project being created, and the referenced
## Makefile-Engine will do all of the hard work for you. This handles any
## architecture of Haiku.
# The name of the binary.
NAME = DumBer
TARGET_DIR = .
# The type of binary, must be one of:
# APP: Application
# SHARED: Shared library or add-on
# STATIC: Static library archive
# DRIVER: Kernel driver
TYPE = APP
# If you plan to use localization, specify the application's MIME signature.
APP_MIME_SIG = application/x-vnd.SLema-DumBer
# The following lines tell Pe and Eddie where the SRCS, RDEFS, and RSRCS are
# so that Pe and Eddie can fill them in for you.
#%{
# @src->@
# Specify the source files to use. Full paths or paths relative to the
# Makefile can be included. All files, regardless of directory, will have
# their object files created in the common object directory. Note that this
# means this Makefile will not work correctly if two source files with the
# same name (source.c or source.cpp) are included from different directories.
# Also note that spaces in folder names do not work well with this Makefile.
SRCS = App.cpp \
MainWindow.cpp
# Specify the resource definition files to use. Full or relative paths can be
# used.
RDEFS = Resources.rdef
# Specify the resource files to use. Full or relative paths can be used.
# Both RDEFS and RSRCS can be utilized in the same Makefile.
RSRCS =
# End Pe/Eddie support.
# @<-src@
#%}
# Specify libraries to link against.
# There are two acceptable forms of library specifications:
# - if your library follows the naming pattern of libXXX.so or libXXX.a,
# you can simply specify XXX for the library. (e.g. the entry for
# "libtracker.so" would be "tracker")
#
# - for GCC-independent linking of standard C++ libraries, you can use
# $(STDCPPLIBS) instead of the raw "stdc++[.r4] [supc++]" library names.
#
# - if your library does not follow the standard library naming scheme,
# you need to specify the path to the library and it's name.
# (e.g. for mylib.a, specify "mylib.a" or "path/mylib.a")
LIBS = be localestub $(STDCPPLIBS)
# Specify additional paths to directories following the standard libXXX.so
# or libXXX.a naming scheme. You can specify full paths or paths relative
# to the Makefile. The paths included are not parsed recursively, so
# include all of the paths where libraries must be found. Directories where
# source files were specified are automatically included.
LIBPATHS =
# Additional paths to look for system headers. These use the form
# "#include <header>". Directories that contain the files in SRCS are
# NOT auto-included here.
SYSTEM_INCLUDE_PATHS = $(shell findpaths -e B_FIND_PATH_HEADERS_DIRECTORY private/interface)
# Additional paths paths to look for local headers. These use the form
# #include "header". Directories that contain the files in SRCS are
# automatically included.
LOCAL_INCLUDE_PATHS =
# Specify the level of optimization that you want. Specify either NONE (O0),
# SOME (O1), FULL (O2), or leave blank (for the default optimization level).
OPTIMIZE :=
# Specify the codes for languages you are going to support in this
# application. The default "en" one must be provided too. "make catkeys"
# will recreate only the "locales/en.catkeys" file. Use it as a template
# for creating catkeys for other languages. All localization files must be
# placed in the "locales" subdirectory.
LOCALES =
# Specify all the preprocessor symbols to be defined. The symbols will not
# have their values set automatically; you must supply the value (if any) to
# use. For example, setting DEFINES to "DEBUG=1" will cause the compiler
# option "-DDEBUG=1" to be used. Setting DEFINES to "DEBUG" would pass
# "-DDEBUG" on the compiler's command line.
DEFINES =
# Specify the warning level. Either NONE (suppress all warnings),
# ALL (enable all warnings), or leave blank (enable default warnings).
WARNINGS =
# With image symbols, stack crawls in the debugger are meaningful.
# If set to "TRUE", symbols will be created.
SYMBOLS :=
# Includes debug information, which allows the binary to be debugged easily.
# If set to "TRUE", debug info will be created.
DEBUGGER :=
# Specify any additional compiler flags to be used.
COMPILER_FLAGS =
# Specify any additional linker flags to be used.
LINKER_FLAGS =
# (Only used when "TYPE" is "DRIVER"). Specify the desired driver install
# location in the /dev hierarchy. Example:
# DRIVER_PATH = video/usb
# will instruct the "driverinstall" rule to place a symlink to your driver's
# binary in ~/add-ons/kernel/drivers/dev/video/usb, so that your driver will
# appear at /dev/video/usb when loaded. The default is "misc".
DRIVER_PATH =
## Include the Makefile-Engine
DEVEL_DIRECTORY := \
$(shell findpaths -r "makefile_engine" B_FIND_PATH_DEVELOP_DIRECTORY)
include $(DEVEL_DIRECTORY)/etc/makefile-engine

39
Resources.rdef Normal file
View file

@ -0,0 +1,39 @@
resource app_signature "application/x-vnd.MyName-MyApp";
resource app_flags B_SINGLE_LAUNCH;
resource app_version {
major = 1,
middle = 0,
minor = 0,
/* 0 = development 1 = alpha 2 = beta
3 = gamma 4 = golden master 5 = final */
variety = 5,
internal = 0,
short_info = "A short description",
long_info = "A little bit longer description of the app."
};
resource vector_icon {
$"6E6369660E0500020006023C43C6B9E5E23A85A83CEE414268F44A445900BDE2"
$"B7FF40A63503E86B06020006023B2B47BB18653D0FA53D225148297046CA1900"
$"FFEC4BFFF0A506020006023B3049396B0ABA90833C646E4A101543299500FFFF"
$"FFFFFFF289020006023C71E33A0C78BA15E43C7D2149055549455700D1FACBFF"
$"76CB6803FF9803020006023A1DA6393F04BBB5BC3C6B074AEA3648091100F99B"
$"05FFFCB23D03587C46020006023C0AE63B3927BC611E3D03FF4C25624A1A9600"
$"B03C03FFBB560503BE53050307610203DE6706040174100A08325E395E41564E"
$"5E555E6052584E3E510A06302C303E40454C3C4C2A3C250A04302C303E404540"
$"320A04302C40324C2A3C250A04403240454C3C4C2A0A0338423C4D3C440A0622"
$"422254325C3E513E402E3A0A0422422254325C32490A04224232493E402E3A0A"
$"043249325C3E513E400A063E423E544E5C5A505A3F4A390A06C785BF40C354C2"
$"764E495A3F4A39C391BD6F0A043E42C354C276C785BF40C391BD6F0A054151C0"
$"8BC8834E5C4E49C35DC27A0A053E423E54C08BC8834151C35DC27A0A044E494E"
$"5C5A505A3E120A0D0100000A0001061815FF01178400040A0001061800150117"
$"8600040A010107000A080109000A0B01052020210A050108000A00010A100117"
$"8400040A02010D000A0A010E000A0902040F000A06010B000A0C010C000A0001"
$"011815FF01178400040A00010118001501178600040A030102000A040103000A"
$"07010400"
};