haiku-dumber/MainWindow.h

74 lines
1.7 KiB
C++

/*
* 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 <MenuField.h>
#include <MenuItem.h>
#include <MessageRunner.h>
#include <PopUpMenu.h>
#include <StatusBar.h>
#include <String.h>
#include <TextControl.h>
#include <TextView.h>
#include <Window.h>
#include "Conversation.h"
static const uint32 kCheckKey = 'chkk';
static const uint32 kMsgNewFile = 'fnew';
static const uint32 kMsgOpenFile = 'fopn';
static const uint32 kMsgSaveFile = 'fsav';
static const uint32 kModelSelected = 'msel';
static const uint32 kPulse = 'plse';
static const uint32 kSendPrompt = 'kspt';
static const uint32 kQuestionChanged = 'kqch';
class MainWindow : public BWindow {
public:
MainWindow();
virtual ~MainWindow();
virtual void MessageReceived(BMessage *msg);
// Overriding FrameResized to receive notifications on resize
void FrameResized(float newWidth, float newHeight) override {
//printf("Window resized to: Width = %f, Height = %f\n", newWidth, newHeight);
// Resize the scroll view if necessary, otherwise we lose scroll ability
}
Conversation *_conversation = new Conversation(this);
void checkValidKey();
void updateHistoryInfo();
private:
void ShowMissingKeyAlertAndQuit();
void SelectModelByName(const char *targetLabel);
bool waitMode = false;
BMenuBar *_BuildMenu();
BTextView *_answerView;
BScrollView *_answerScrollView;
BTextView *_infoConversation;
BTextView *_infoView;
BTextView *_inputField;
BStatusBar *_progress;
BMenuField *_modelField;
BPopUpMenu *_modelMenu;
BButton *_sendButton;
// BMenuItem *fSaveMenuItem;
};
#endif