looper/backends/ui/haiku/slider.h
Zachary Hall f63aa4da7a
Some checks failed
Build / build-android (push) Blocked by required conditions
Build / build-windows (push) Blocked by required conditions
Build / build-gentoo (push) Failing after 1m20s
Build / download-system-deps (push) Successful in 3m31s
Build / get-source-code (push) Successful in 7m5s
Build / build-appimage (push) Has been cancelled
Fix combined Haiku/Qt backend build
2024-11-21 10:22:34 -08:00

75 lines
2.1 KiB
C++

#pragma once
#include <View.h>
#include <Slider.h>
#include <Button.h>
#include <TextControl.h>
#include <Message.h>
#include <Control.h>
#include <Button.h>
#include <GroupLayout.h>
#include <StringView.h>
#include <GroupView.h>
class LooperLogScaler;
class HaikuLooperSlider : public BControl {
inline BMessage *make_self_msg(int32 what) {
auto output = new BMessage(what);
output->AddPointer("catmeow:target", this);
return output;
}
BSlider *slider = NULL;
BButton *btn;
BStringView *text_label;
BStringView *min_label_view;
BStringView *max_label_view;
BGroupView *limits_view;
bool limits_visible = false;
BTextControl *text;
BBitmap *text_mode_bitmap = nullptr;
BBitmap *slider_mode_bitmap = nullptr;
double value;
BGroupView *text_layout_view;
bool pressed = false;
BGroupLayout *text_layout;
LooperLogScaler *scaler;
void UpdateLogScaler();
bool recreate_slider = false;
void UpdateSlider(bool update_value = false);
double min;
double max;
double tick;
bool text_edit_mode = false;
bool logarithmic;
const char *label = NULL;
const char *min_label = NULL;
const char *max_label = NULL;
BMessage *change_msg = NULL;
void set_tick(double value);
void set_min(double min);
void set_max(double max);
void set_logarithmic(bool logarithmic);
void SendChangeMsg();
public:
void SetMin(double min);
double Min();
void SetMax(double max);
double Max();
void SetLimits(double min, double max);
void SetMinLabel(const char *label);
void SetMaxLabel(const char *label);
const char *MinLabel();
const char *MaxLabel();
void SetLimitLabels(const char *min, const char *max);
void SetTick(double value);
void SetValue(int32 value) override;
double Tick();
double ValueDouble();
void SetValueDouble(double value);
void SetLogarithmic(bool logarithmic);
bool IsLogarithmic();
void SetLabel(const char *label) override;
void SetValueChangedMsg(BMessage *msg);
void MessageReceived(BMessage *msg) override;
void AttachedToWindow() override;
HaikuLooperSlider(const char *name, const char *label, BMessage *msg, uint32_t flags, double min, double max, double tick = 0.0001, bool logarithmic = false);
~HaikuLooperSlider();
};