Style cleanup.
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2007, Axel Dörfler, [email protected]. All rights reserved.
|
* Copyright 2007-2012, Axel Dörfler, [email protected].
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#ifndef SUDOKU_VIEW_H
|
#ifndef SUDOKU_VIEW_H
|
||||||
@@ -9,6 +9,7 @@
|
|||||||
#include <View.h>
|
#include <View.h>
|
||||||
#include <ObjectList.h>
|
#include <ObjectList.h>
|
||||||
|
|
||||||
|
|
||||||
class BDataIO;
|
class BDataIO;
|
||||||
class SudokuField;
|
class SudokuField;
|
||||||
struct entry_ref;
|
struct entry_ref;
|
||||||
@@ -27,99 +28,115 @@ enum {
|
|||||||
kExportAsPicture
|
kExportAsPicture
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class SudokuView : public BView {
|
class SudokuView : public BView {
|
||||||
public:
|
public:
|
||||||
SudokuView(BRect frame, const char* name, const BMessage& settings,
|
SudokuView(BRect frame, const char* name,
|
||||||
uint32 resizingMode);
|
const BMessage& settings,
|
||||||
SudokuView(BMessage* archive);
|
uint32 resizingMode);
|
||||||
virtual ~SudokuView();
|
SudokuView(BMessage* archive);
|
||||||
|
virtual ~SudokuView();
|
||||||
|
|
||||||
virtual status_t Archive(BMessage* into, bool deep = true) const;
|
virtual status_t Archive(BMessage* into, bool deep = true) const;
|
||||||
static BArchivable* Instantiate(BMessage* archive);
|
static BArchivable* Instantiate(BMessage* archive);
|
||||||
void InitObject(const BMessage* archive);
|
void InitObject(const BMessage* archive);
|
||||||
|
|
||||||
status_t SaveState(BMessage& state) const;
|
status_t SaveState(BMessage& state) const;
|
||||||
|
|
||||||
status_t SetTo(entry_ref& ref);
|
status_t SetTo(entry_ref& ref);
|
||||||
status_t SetTo(const char* data);
|
status_t SetTo(const char* data);
|
||||||
status_t SetTo(SudokuField* field);
|
status_t SetTo(SudokuField* field);
|
||||||
|
|
||||||
status_t SaveTo(entry_ref& ref, uint32 as = kExportAsText);
|
status_t SaveTo(entry_ref& ref,
|
||||||
status_t SaveTo(BDataIO &to, uint32 as = kExportAsText);
|
uint32 as = kExportAsText);
|
||||||
|
status_t SaveTo(BDataIO &to, uint32 as = kExportAsText);
|
||||||
|
|
||||||
status_t CopyToClipboard();
|
status_t CopyToClipboard();
|
||||||
|
|
||||||
void ClearChanged();
|
void ClearChanged();
|
||||||
void ClearAll();
|
void ClearAll();
|
||||||
|
|
||||||
void SetHintFlags(uint32 flags);
|
void SetHintFlags(uint32 flags);
|
||||||
uint32 HintFlags() const { return fHintFlags; }
|
uint32 HintFlags() const { return fHintFlags; }
|
||||||
|
|
||||||
SudokuField* Field() { return fField; }
|
SudokuField* Field() { return fField; }
|
||||||
|
|
||||||
void SetEditable(bool editable);
|
void SetEditable(bool editable);
|
||||||
bool Editable() const { return fEditable; }
|
bool Editable() const { return fEditable; }
|
||||||
|
|
||||||
bool CanUndo() { return !fUndos.IsEmpty(); }
|
bool CanUndo() { return !fUndos.IsEmpty(); }
|
||||||
bool CanRedo() { return !fRedos.IsEmpty(); }
|
bool CanRedo() { return !fRedos.IsEmpty(); }
|
||||||
void Undo();
|
void Undo();
|
||||||
void Redo();
|
void Redo();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void AttachedToWindow();
|
virtual void AttachedToWindow();
|
||||||
|
|
||||||
virtual void FrameResized(float width, float height);
|
virtual void FrameResized(float width, float height);
|
||||||
virtual void MouseDown(BPoint where);
|
virtual void MouseDown(BPoint where);
|
||||||
virtual void MouseMoved(BPoint where, uint32 transit,
|
virtual void MouseMoved(BPoint where, uint32 transit,
|
||||||
const BMessage* dragMessage);
|
const BMessage* dragMessage);
|
||||||
virtual void KeyDown(const char *bytes, int32 numBytes);
|
virtual void KeyDown(const char *bytes, int32 numBytes);
|
||||||
|
|
||||||
virtual void MessageReceived(BMessage* message);
|
virtual void MessageReceived(BMessage* message);
|
||||||
|
|
||||||
virtual void Draw(BRect updateRect);
|
virtual void Draw(BRect updateRect);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
status_t _FilterString(const char* data, size_t dataLength, char* buffer,
|
status_t _FilterString(const char* data,
|
||||||
uint32& out, bool& ignore);
|
size_t dataLength, char* buffer,
|
||||||
void _SetText(char* text, uint32 value);
|
uint32& out, bool& ignore);
|
||||||
char _BaseCharacter();
|
void _SetText(char* text, uint32 value);
|
||||||
bool _ValidCharacter(char c);
|
char _BaseCharacter();
|
||||||
BPoint _LeftTop(uint32 x, uint32 y);
|
bool _ValidCharacter(char c);
|
||||||
BRect _Frame(uint32, uint32 y);
|
BPoint _LeftTop(uint32 x, uint32 y);
|
||||||
void _InvalidateHintField(uint32 x, uint32 y, uint32 hintX, uint32 hintY);
|
BRect _Frame(uint32, uint32 y);
|
||||||
void _InvalidateField(uint32 x, uint32 y);
|
void _InvalidateHintField(uint32 x, uint32 y,
|
||||||
void _InvalidateKeyboardFocus(uint32 x, uint32 y);
|
uint32 hintX, uint32 hintY);
|
||||||
void _InsertKey(char rawKey, int32 modifiers);
|
void _InvalidateField(uint32 x, uint32 y);
|
||||||
void _RemoveHint();
|
void _InvalidateKeyboardFocus(uint32 x, uint32 y);
|
||||||
bool _GetHintFieldFor(BPoint where, uint32 x, uint32 y,
|
void _InsertKey(char rawKey, int32 modifiers);
|
||||||
uint32& hintX, uint32& hintY);
|
void _RemoveHint();
|
||||||
bool _GetFieldFor(BPoint where, uint32& x, uint32& y);
|
bool _GetHintFieldFor(BPoint where, uint32 x,
|
||||||
void _FitFont(BFont& font, float width, float height);
|
uint32 y, uint32& hintX, uint32& hintY);
|
||||||
void _DrawKeyboardFocus();
|
bool _GetFieldFor(BPoint where, uint32& x,
|
||||||
void _DrawHints(uint32 x, uint32 y);
|
uint32& y);
|
||||||
void _UndoRedo(BObjectList<BMessage>& undos, BObjectList<BMessage>& redos);
|
void _FitFont(BFont& font, float width,
|
||||||
void _PushUndo();
|
float height);
|
||||||
|
void _DrawKeyboardFocus();
|
||||||
|
void _DrawHints(uint32 x, uint32 y);
|
||||||
|
void _UndoRedo(BObjectList<BMessage>& undos,
|
||||||
|
BObjectList<BMessage>& redos);
|
||||||
|
void _PushUndo();
|
||||||
|
|
||||||
rgb_color fBackgroundColor;
|
private:
|
||||||
SudokuField* fField;
|
rgb_color fBackgroundColor;
|
||||||
BObjectList<BMessage> fUndos;
|
SudokuField* fField;
|
||||||
BObjectList<BMessage> fRedos;
|
BObjectList<BMessage> fUndos;
|
||||||
uint32 fBlockSize;
|
BObjectList<BMessage> fRedos;
|
||||||
float fWidth, fHeight, fBaseline;
|
uint32 fBlockSize;
|
||||||
BFont fFieldFont;
|
float fWidth;
|
||||||
BFont fHintFont;
|
float fHeight;
|
||||||
float fHintHeight, fHintWidth, fHintBaseline;
|
float fBaseline;
|
||||||
uint32 fShowHintX, fShowHintY;
|
BFont fFieldFont;
|
||||||
uint32 fLastHintValue;
|
BFont fHintFont;
|
||||||
bool fLastHintValueSet;
|
float fHintHeight;
|
||||||
uint32 fLastField;
|
float fHintWidth;
|
||||||
uint32 fKeyboardX, fKeyboardY;
|
float fHintBaseline;
|
||||||
uint32 fHintFlags;
|
uint32 fShowHintX;
|
||||||
bool fShowKeyboardFocus;
|
uint32 fShowHintY;
|
||||||
bool fShowCursor;
|
uint32 fLastHintValue;
|
||||||
bool fEditable;
|
bool fLastHintValueSet;
|
||||||
|
uint32 fLastField;
|
||||||
|
uint32 fKeyboardX;
|
||||||
|
uint32 fKeyboardY;
|
||||||
|
uint32 fHintFlags;
|
||||||
|
bool fShowKeyboardFocus;
|
||||||
|
bool fShowCursor;
|
||||||
|
bool fEditable;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static const uint32 kMsgSudokuSolved = 'susl';
|
static const uint32 kMsgSudokuSolved = 'susl';
|
||||||
static const uint32 kMsgSolveSudoku = 'slvs';
|
static const uint32 kMsgSolveSudoku = 'slvs';
|
||||||
static const uint32 kMsgSolveSingle = 'slsg';
|
static const uint32 kMsgSolveSingle = 'slsg';
|
||||||
@@ -127,4 +144,5 @@ static const uint32 kMsgSolveSingle = 'slsg';
|
|||||||
// you can observe these:
|
// you can observe these:
|
||||||
static const int32 kUndoRedoChanged = 'unre';
|
static const int32 kUndoRedoChanged = 'unre';
|
||||||
|
|
||||||
|
|
||||||
#endif // SUDOKU_VIEW_H
|
#endif // SUDOKU_VIEW_H
|
||||||
|
|||||||
Reference in New Issue
Block a user