1/* 2 * Copyright 2003-2009 Haiku Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Michael Wilber 7 */ 8#ifndef SHOW_IMAGE_UNDO_H 9#define SHOW_IMAGE_UNDO_H 10 11 12#include <Bitmap.h> 13#include <Message.h> 14#include <Messenger.h> 15#include <Rect.h> 16#include <Window.h> 17 18#include "ShowImageConstants.h" 19 20 21// for Undo 22#define UNDO_UNDO 1 23#define UNDO_REDO 2 24 25 26class ShowImageUndo { 27public: 28 ShowImageUndo(); 29 ~ShowImageUndo(); 30 31 void SetWindow(BWindow* win) { fWindow = win; } 32 33 void Clear(); 34 35 // NOTE: THESE TWO FUNCTIONS DO NOT MAKE COPIES OF THE 36 // BITMAPS PASSED TO THEM 37 void SetTo(BRect rect, BBitmap* restore, BBitmap* selection); 38 void Undo(BRect rect, BBitmap* restore, BBitmap* selection); 39 40 int32 GetType() { return fUndoType; } 41 BRect GetRect() { return fRect; } 42 BBitmap* GetRestoreBitmap() { return fRestore; } 43 BBitmap* GetSelectionBitmap() { return fSelection; } 44 45private: 46 void InternalClear(); 47 void SendUndoStateMessage(bool bCanUndo); 48 49 BWindow* fWindow; 50 // Window to which notification messages are sent 51 int32 fUndoType; 52 // Nothing, Undo or Redo 53 BRect fRect; 54 // Area of background bitmap where change took place 55 BBitmap* fRestore; 56 // Changed portion of background bitmap, before change took place 57 BBitmap* fSelection; 58 // Selection present before change took place 59}; 60 61 62#endif // SHOW_IMAGE_UNDO_H 63 64