Use MainWindow::instance() instead of mainWindow global var
This commit is contained in:
+3
-2
@@ -22,7 +22,8 @@
|
|||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "form.h"
|
#include "form.h"
|
||||||
|
|
||||||
class Keyboard: public FormWindow {
|
class Keyboard: public FormWindow
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
explicit Keyboard(coord_t height):
|
explicit Keyboard(coord_t height):
|
||||||
FormWindow(nullptr, {0, LCD_H - height, LCD_W, height}, OPAQUE)
|
FormWindow(nullptr, {0, LCD_H - height, LCD_W, height}, OPAQUE)
|
||||||
@@ -50,7 +51,7 @@ class Keyboard: public FormWindow {
|
|||||||
activeKeyboard->clearField();
|
activeKeyboard->clearField();
|
||||||
}
|
}
|
||||||
activeKeyboard = this;
|
activeKeyboard = this;
|
||||||
attach(&mainWindow);
|
attach(MainWindow::instance());
|
||||||
fieldContainer = getFieldContainer(newField);
|
fieldContainer = getFieldContainer(newField);
|
||||||
fieldContainer->setHeight(LCD_H - height() - fieldContainer->top());
|
fieldContainer->setHeight(LCD_H - height() - fieldContainer->top());
|
||||||
fieldContainer->scrollTo(newField);
|
fieldContainer->scrollTo(newField);
|
||||||
|
|||||||
+1
-1
@@ -24,7 +24,7 @@
|
|||||||
#include "touch.h"
|
#include "touch.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
MainWindow mainWindow;
|
MainWindow * MainWindow::_instance = nullptr;
|
||||||
|
|
||||||
#if defined(HARDWARE_TOUCH)
|
#if defined(HARDWARE_TOUCH)
|
||||||
TouchState touchState;
|
TouchState touchState;
|
||||||
|
|||||||
+7
-3
@@ -31,6 +31,7 @@ class MainWindow: public Window
|
|||||||
invalidatedRect(rect)
|
invalidatedRect(rect)
|
||||||
{
|
{
|
||||||
Layer::push(this);
|
Layer::push(this);
|
||||||
|
_instance = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
~MainWindow() override
|
~MainWindow() override
|
||||||
@@ -38,6 +39,11 @@ class MainWindow: public Window
|
|||||||
children.clear();
|
children.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static MainWindow * instance()
|
||||||
|
{
|
||||||
|
return _instance;
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(DEBUG_WINDOWS)
|
#if defined(DEBUG_WINDOWS)
|
||||||
std::string getName() const override
|
std::string getName() const override
|
||||||
{
|
{
|
||||||
@@ -64,10 +70,8 @@ class MainWindow: public Window
|
|||||||
void run(bool trash=true);
|
void run(bool trash=true);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
static MainWindow * _instance;
|
||||||
static void emptyTrash();
|
static void emptyTrash();
|
||||||
rect_t invalidatedRect;
|
rect_t invalidatedRect;
|
||||||
const char * shutdown = nullptr;
|
const char * shutdown = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern MainWindow mainWindow;
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user