haiku-dumber/MainWindow.h

81 lines
1.8 KiB
C
Raw Permalink Normal View History

2024-09-29 17:58:05 -03:00
/*
* Copyright 2024, My Name <my@email.address>
* All rights reserved. Distributed under the terms of the MIT license.
*/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
2025-05-08 01:39:43 -03:00
#include <MenuField.h>
2024-09-29 17:58:05 -03:00
#include <MenuItem.h>
2025-05-08 01:39:43 -03:00
#include <MessageRunner.h>
#include <PopUpMenu.h>
#include <StatusBar.h>
#include <String.h>
2024-09-30 03:17:31 -03:00
#include <TextControl.h>
#include <TextView.h>
2024-09-29 17:58:05 -03:00
#include <Window.h>
2025-05-07 06:31:50 -03:00
#include "Conversation.h"
2025-05-07 19:26:56 -03:00
static const uint32 kCheckKey = 'chkk';
static const uint32 kMsgNewFile = 'fnew';
static const uint32 kMsgOpenFile = 'fopn';
static const uint32 kMsgSaveFile = 'fsav';
2025-05-08 01:11:46 -03:00
static const uint32 kModelSelected = 'msel';
2025-05-10 01:47:05 -03:00
static const uint32 kViewJSON = 'vjso';
2025-05-07 19:26:56 -03:00
static const uint32 kPulse = 'plse';
static const uint32 kSendPrompt = 'kspt';
static const uint32 kQuestionChanged = 'kqch';
2024-09-30 03:17:31 -03:00
class MainWindow : public BWindow {
2024-09-29 17:58:05 -03:00
public:
2024-09-30 03:17:31 -03:00
MainWindow();
virtual ~MainWindow();
2024-09-29 17:58:05 -03:00
2024-09-30 03:17:31 -03:00
virtual void MessageReceived(BMessage *msg);
2024-09-29 17:58:05 -03:00
2025-05-08 01:39:43 -03:00
// Overriding FrameResized to receive notifications on resize
void FrameResized(float newWidth, float newHeight) override {
2025-05-09 21:03:31 -03:00
//printf("Window resized to: Width = %f, Height = %f\n", newWidth, newHeight);
2025-05-08 01:39:43 -03:00
// Resize the scroll view if necessary, otherwise we lose scroll ability
}
2025-05-07 02:33:01 -03:00
2025-05-06 23:26:01 -03:00
2025-05-08 02:08:36 -03:00
2025-05-08 01:39:43 -03:00
Conversation *_conversation = new Conversation(this);
void checkValidKey();
void updateHistoryInfo();
private:
2025-05-10 01:47:05 -03:00
std::string lastJSON;
2025-05-08 01:39:43 -03:00
void ShowMissingKeyAlertAndQuit();
void SelectModelByName(const char *targetLabel);
bool waitMode = false;
2024-09-30 03:17:31 -03:00
BMenuBar *_BuildMenu();
2025-05-08 01:39:43 -03:00
BTextView *_answerView;
BScrollView *_answerScrollView;
BTextView *_infoConversation;
BTextView *_infoView;
BTextView *_inputField;
BStatusBar *_progress;
BMenuField *_modelField;
BPopUpMenu *_modelMenu;
2025-05-08 01:11:46 -03:00
BButton *_sendButton;
2025-05-08 01:39:43 -03:00
// BMenuItem *fSaveMenuItem;
2024-09-29 17:58:05 -03:00
};
#endif