2 * Copyright 2002-2009 Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
6 * Jerome Duval, jerome.duval@free.fr
8 #ifndef BACKGROUNDS_VIEW_H
9 #define BACKGROUNDS_VIEW_H
15 #include <ColorControl.h>
19 #include <FilePanel.h>
25 #include <ScrollView.h>
26 #include <ScrollBar.h>
28 #include <StringView.h>
29 #include <TextControl.h>
32 #include "BackgroundImage.h"
35 #define SETTINGS_FILE "Backgrounds_settings"
41 class BGImageMenuItem
: public BMenuItem
{
43 BGImageMenuItem(const char* label
, int32 imageIndex
,
44 BMessage
* message
, char shortcut
= 0,
45 uint32 modifiers
= 0);
47 int32
ImageIndex() { return fImageIndex
; }
66 class FramePart
: public BView
{
68 FramePart(int32 part
);
70 void Draw(BRect rect
);
71 void SetDesktop(bool isDesktop
);
74 void _SetSizeAndAlignment();
81 class Preview
: public BControl
{
89 void MouseDown(BPoint point
);
90 void MouseUp(BPoint point
);
91 void MouseMoved(BPoint point
, uint32 transit
,
92 const BMessage
* message
);
93 void AttachedToWindow();
102 class BackgroundsView
: public BBox
{
108 void MessageReceived(BMessage
* message
);
110 void RefsReceived(BMessage
* message
);
113 void WorkspaceActivated(uint32 oldWorkspaces
,
115 int32
AddImage(BPath path
);
116 Image
* GetImage(int32 imageIndex
);
118 bool FoundPositionSetting();
122 void _NotifyServer();
123 void _LoadSettings();
124 void _LoadDesktopFolder();
125 void _LoadDefaultFolder();
126 void _LoadFolder(bool isDesktop
);
127 void _LoadRecentFolder(BPath path
);
128 void _UpdateWithCurrent();
129 void _UpdatePreview();
130 void _UpdateButtons();
131 void _SetDesktop(bool isDesktop
);
132 int32
_AddPath(BPath path
);
134 static int32
_NotifyThread(void* data
);
136 BGImageMenuItem
* _FindImageItem(const int32 imageIndex
);
138 bool _AddItem(BGImageMenuItem
* item
);
140 BackgroundImage::Mode
_FindPlacementMode();
142 BColorControl
* fPicker
;
145 BCheckBox
* fIconLabelOutline
;
146 BMenu
* fPlacementMenu
;
148 BMenu
* fWorkspaceMenu
;
149 BTextControl
* fXPlacementText
;
150 BTextControl
* fYPlacementText
;
152 BFilePanel
* fFolderPanel
;
153 ImageFilePanel
* fPanel
;
155 BackgroundImage
* fCurrent
;
157 BackgroundImage::BackgroundImageInfo
* fCurrentInfo
;
159 entry_ref fCurrentRef
;
160 int32 fLastImageIndex
;
161 int32 fLastWorkspaceIndex
;
164 BObjectList
<BPath
> fPathList
;
165 BObjectList
<Image
> fImageList
;
169 FramePart
* fTopRight
;
172 FramePart
* fBottomLeft
;
174 FramePart
* fBottomRight
;
176 bool fFoundPositionSetting
;
179 #endif // BACKGROUNDS_VIEW_H