Some sad attempts at a GUI >w>'

This commit is contained in:
Jaidyn Ann 2020-11-12 13:10:39 -06:00
parent abdf1a32d8
commit b8e20ea38b
4 changed files with 92 additions and 1 deletions

View File

@ -33,6 +33,7 @@ SRCS = \
src/Entry.cpp, \
src/AtomFeed.cpp, \
src/RssFeed.cpp, \
src/PrefWindow.cpp, \
src/ProtocolListener.cpp, \
src/Mimetypes.cpp, \
src/Config.cpp, \

View File

@ -9,6 +9,7 @@
#include "Config.h"
#include "Util.h"
#include "App.h"
#include "PrefWindow.h"
#include "Invocation.h"
@ -23,7 +24,7 @@ main ( int argc, char** argv )
main_cfg->Load();
if ( argc == 0 )
if ( argc == 1 )
app->Run();
else
cliStart( argc, argv );
@ -47,6 +48,8 @@ cliStart ( int argc, char** argv )
App::App ( )
: BApplication("application/x-vnd.Pogger")
{
// PrefWindow* prefWin = new PrefWindow();
// prefWin->Show();
}

66
src/PrefWindow.cpp Normal file
View File

@ -0,0 +1,66 @@
#include "PrefWindow.h"
#include <Button.h>
#include <View.h>
#include <String.h>
enum
{
M_BUTTON_CLICKED = 'btcl'
};
PrefWindow::PrefWindow ( void )
: BWindow( BRect(100,100,300,200),"Pogger",B_TITLED_WINDOW,
B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE )
{
BButton *button = new BButton( BRect(10,10,11,11),"button", "Click Me!",
new BMessage(M_BUTTON_CLICKED) );
AddChild(button);
button->ResizeToPreferred();
BView *view = new BView(BRect(100,100,300,200), "colorview", B_FOLLOW_ALL, B_WILL_DRAW);
//view->AddChild(button);
//AddChild(view);
view->SetViewColor(255,255,255);
view->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
view->Invalidate();
}
void
PrefWindow::MessageReceived ( BMessage *msg )
{
// The way that BMessages are identified is by the public property
// 'what'.
switch (msg->what)
{
// If the message was the one sent to the window by the
// button
case M_BUTTON_CLICKED:
{
BString labelString("Clicks: ");
// This converts fCount to a string and appends it to
// the end of labelString. More on this next lesson.
labelString << "DAD";
// Set the window's title to the new string we've made
SetTitle(labelString.String());
break;
}
default:
{
// If the message doesn't match one of the ones we
// explicitly define, it must be some sort of system
// message, so we will call the BWindow version of
// MessageReceived() so that it can handle them. THIS
// IS REQUIRED if you want your window to act
// the way that you expect it to.
BWindow::MessageReceived(msg);
break;
}
}
}

21
src/PrefWindow.h Normal file
View File

@ -0,0 +1,21 @@
#ifndef PREFWINDOW_H
#define PREFWINDOW_H
#include <Window.h>
class PrefWindow : public BWindow
{
public:
PrefWindow ( void );
// void MessageRecieved ( BMessage* );
void MessageReceived(BMessage*);
private:
BView* fMainView;
void _InitInterface ( void );
};
#endif