diff --git a/data/skins/default/sheet.png b/data/skins/default/sheet.png
index 523cb1116..c5b0f7e1f 100644
Binary files a/data/skins/default/sheet.png and b/data/skins/default/sheet.png differ
diff --git a/data/skins/default/skin.xml b/data/skins/default/skin.xml
index e737dce3d..b294031d2 100644
--- a/data/skins/default/skin.xml
+++ b/data/skins/default/skin.xml
@@ -61,9 +61,9 @@
-
-
-
+
+
+
@@ -170,6 +170,14 @@
+
+
+
+
+
+
+
+
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index f1e6c91b8..af2a7a5c2 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -283,6 +283,7 @@ add_library(aseprite-library
widgets/color_button.cpp
widgets/color_selector.cpp
widgets/color_sliders.cpp
+ widgets/drop_down_button.cpp
widgets/editor/click.cpp
widgets/editor/cursor.cpp
widgets/editor/drawing_state.cpp
diff --git a/src/skin/skin_parts.h b/src/skin/skin_parts.h
index 4b6cd68a4..3954d528f 100644
--- a/src/skin/skin_parts.h
+++ b/src/skin/skin_parts.h
@@ -468,6 +468,78 @@ enum {
PART_UNPINNED,
PART_PINNED,
+ PART_DROP_DOWN_BUTTON_LEFT_NORMAL_NW,
+ PART_DROP_DOWN_BUTTON_LEFT_NORMAL_N,
+ PART_DROP_DOWN_BUTTON_LEFT_NORMAL_NE,
+ PART_DROP_DOWN_BUTTON_LEFT_NORMAL_E,
+ PART_DROP_DOWN_BUTTON_LEFT_NORMAL_SE,
+ PART_DROP_DOWN_BUTTON_LEFT_NORMAL_S,
+ PART_DROP_DOWN_BUTTON_LEFT_NORMAL_SW,
+ PART_DROP_DOWN_BUTTON_LEFT_NORMAL_W,
+
+ PART_DROP_DOWN_BUTTON_LEFT_HOT_NW,
+ PART_DROP_DOWN_BUTTON_LEFT_HOT_N,
+ PART_DROP_DOWN_BUTTON_LEFT_HOT_NE,
+ PART_DROP_DOWN_BUTTON_LEFT_HOT_E,
+ PART_DROP_DOWN_BUTTON_LEFT_HOT_SE,
+ PART_DROP_DOWN_BUTTON_LEFT_HOT_S,
+ PART_DROP_DOWN_BUTTON_LEFT_HOT_SW,
+ PART_DROP_DOWN_BUTTON_LEFT_HOT_W,
+
+ PART_DROP_DOWN_BUTTON_LEFT_FOCUSED_NW,
+ PART_DROP_DOWN_BUTTON_LEFT_FOCUSED_N,
+ PART_DROP_DOWN_BUTTON_LEFT_FOCUSED_NE,
+ PART_DROP_DOWN_BUTTON_LEFT_FOCUSED_E,
+ PART_DROP_DOWN_BUTTON_LEFT_FOCUSED_SE,
+ PART_DROP_DOWN_BUTTON_LEFT_FOCUSED_S,
+ PART_DROP_DOWN_BUTTON_LEFT_FOCUSED_SW,
+ PART_DROP_DOWN_BUTTON_LEFT_FOCUSED_W,
+
+ PART_DROP_DOWN_BUTTON_LEFT_SELECTED_NW,
+ PART_DROP_DOWN_BUTTON_LEFT_SELECTED_N,
+ PART_DROP_DOWN_BUTTON_LEFT_SELECTED_NE,
+ PART_DROP_DOWN_BUTTON_LEFT_SELECTED_E,
+ PART_DROP_DOWN_BUTTON_LEFT_SELECTED_SE,
+ PART_DROP_DOWN_BUTTON_LEFT_SELECTED_S,
+ PART_DROP_DOWN_BUTTON_LEFT_SELECTED_SW,
+ PART_DROP_DOWN_BUTTON_LEFT_SELECTED_W,
+
+ PART_DROP_DOWN_BUTTON_RIGHT_NORMAL_NW,
+ PART_DROP_DOWN_BUTTON_RIGHT_NORMAL_N,
+ PART_DROP_DOWN_BUTTON_RIGHT_NORMAL_NE,
+ PART_DROP_DOWN_BUTTON_RIGHT_NORMAL_E,
+ PART_DROP_DOWN_BUTTON_RIGHT_NORMAL_SE,
+ PART_DROP_DOWN_BUTTON_RIGHT_NORMAL_S,
+ PART_DROP_DOWN_BUTTON_RIGHT_NORMAL_SW,
+ PART_DROP_DOWN_BUTTON_RIGHT_NORMAL_W,
+
+ PART_DROP_DOWN_BUTTON_RIGHT_HOT_NW,
+ PART_DROP_DOWN_BUTTON_RIGHT_HOT_N,
+ PART_DROP_DOWN_BUTTON_RIGHT_HOT_NE,
+ PART_DROP_DOWN_BUTTON_RIGHT_HOT_E,
+ PART_DROP_DOWN_BUTTON_RIGHT_HOT_SE,
+ PART_DROP_DOWN_BUTTON_RIGHT_HOT_S,
+ PART_DROP_DOWN_BUTTON_RIGHT_HOT_SW,
+ PART_DROP_DOWN_BUTTON_RIGHT_HOT_W,
+
+ PART_DROP_DOWN_BUTTON_RIGHT_FOCUSED_NW,
+ PART_DROP_DOWN_BUTTON_RIGHT_FOCUSED_N,
+ PART_DROP_DOWN_BUTTON_RIGHT_FOCUSED_NE,
+ PART_DROP_DOWN_BUTTON_RIGHT_FOCUSED_E,
+ PART_DROP_DOWN_BUTTON_RIGHT_FOCUSED_SE,
+ PART_DROP_DOWN_BUTTON_RIGHT_FOCUSED_S,
+ PART_DROP_DOWN_BUTTON_RIGHT_FOCUSED_SW,
+ PART_DROP_DOWN_BUTTON_RIGHT_FOCUSED_W,
+
+ PART_DROP_DOWN_BUTTON_RIGHT_SELECTED_NW,
+ PART_DROP_DOWN_BUTTON_RIGHT_SELECTED_N,
+ PART_DROP_DOWN_BUTTON_RIGHT_SELECTED_NE,
+ PART_DROP_DOWN_BUTTON_RIGHT_SELECTED_E,
+ PART_DROP_DOWN_BUTTON_RIGHT_SELECTED_SE,
+ PART_DROP_DOWN_BUTTON_RIGHT_SELECTED_S,
+ PART_DROP_DOWN_BUTTON_RIGHT_SELECTED_SW,
+ PART_DROP_DOWN_BUTTON_RIGHT_SELECTED_W,
+
PARTS
};
diff --git a/src/skin/skin_property.h b/src/skin/skin_property.h
index 507b7d2ed..30bb6b192 100644
--- a/src/skin/skin_property.h
+++ b/src/skin/skin_property.h
@@ -25,6 +25,8 @@ enum LookType {
NormalLook,
MiniLook,
WithoutBordersLook,
+ LeftButtonLook,
+ RightButtonLook,
};
// Property to show widgets with a special look (e.g.: buttons or sliders with mini-borders)
diff --git a/src/skin/skin_theme.cpp b/src/skin/skin_theme.cpp
index dea128efb..1749b1844 100644
--- a/src/skin/skin_theme.cpp
+++ b/src/skin/skin_theme.cpp
@@ -201,6 +201,14 @@ SkinTheme::SkinTheme()
sheet_mapping["layer_locked_selected"] = PART_LAYER_LOCKED_SELECTED;
sheet_mapping["unpinned"] = PART_UNPINNED;
sheet_mapping["pinned"] = PART_PINNED;
+ sheet_mapping["drop_down_button_left_normal"] = PART_DROP_DOWN_BUTTON_LEFT_NORMAL_NW;
+ sheet_mapping["drop_down_button_left_hot"] = PART_DROP_DOWN_BUTTON_LEFT_HOT_NW;
+ sheet_mapping["drop_down_button_left_focused"] = PART_DROP_DOWN_BUTTON_LEFT_FOCUSED_NW;
+ sheet_mapping["drop_down_button_left_selected"] = PART_DROP_DOWN_BUTTON_LEFT_SELECTED_NW;
+ sheet_mapping["drop_down_button_right_normal"] = PART_DROP_DOWN_BUTTON_RIGHT_NORMAL_NW;
+ sheet_mapping["drop_down_button_right_hot"] = PART_DROP_DOWN_BUTTON_RIGHT_HOT_NW;
+ sheet_mapping["drop_down_button_right_focused"] = PART_DROP_DOWN_BUTTON_RIGHT_FOCUSED_NW;
+ sheet_mapping["drop_down_button_right_selected"] = PART_DROP_DOWN_BUTTON_RIGHT_SELECTED_NW;
reload_skin();
}
@@ -738,31 +746,39 @@ void SkinTheme::paintButton(PaintEvent& ev)
if (skinPropery != NULL)
look = skinPropery->getLook();
- // selected
+ // Selected
if (widget->isSelected()) {
fg = get_button_selected_text_color();
bg = get_button_selected_face_color();
part_nw = (look == MiniLook ? PART_TOOLBUTTON_NORMAL_NW:
- PART_BUTTON_SELECTED_NW);
+ look == LeftButtonLook ? PART_DROP_DOWN_BUTTON_LEFT_SELECTED_NW:
+ look == RightButtonLook ? PART_DROP_DOWN_BUTTON_RIGHT_SELECTED_NW:
+ PART_BUTTON_SELECTED_NW);
}
- // with mouse
+ // With mouse
else if (widget->isEnabled() && widget->hasMouseOver()) {
fg = get_button_hot_text_color();
bg = get_button_hot_face_color();
part_nw = (look == MiniLook ? PART_TOOLBUTTON_HOT_NW:
- PART_BUTTON_HOT_NW);
+ look == LeftButtonLook ? PART_DROP_DOWN_BUTTON_LEFT_HOT_NW:
+ look == RightButtonLook ? PART_DROP_DOWN_BUTTON_RIGHT_HOT_NW:
+ PART_BUTTON_HOT_NW);
}
- // without mouse
+ // Without mouse
else {
fg = get_button_normal_text_color();
bg = get_button_normal_face_color();
if (widget->hasFocus())
part_nw = (look == MiniLook ? PART_TOOLBUTTON_HOT_NW:
- PART_BUTTON_FOCUSED_NW);
+ look == LeftButtonLook ? PART_DROP_DOWN_BUTTON_LEFT_FOCUSED_NW:
+ look == RightButtonLook ? PART_DROP_DOWN_BUTTON_RIGHT_FOCUSED_NW:
+ PART_BUTTON_FOCUSED_NW);
else
part_nw = (look == MiniLook ? PART_TOOLBUTTON_NORMAL_NW:
- PART_BUTTON_NORMAL_NW);
+ look == LeftButtonLook ? PART_DROP_DOWN_BUTTON_LEFT_NORMAL_NW:
+ look == RightButtonLook ? PART_DROP_DOWN_BUTTON_RIGHT_NORMAL_NW:
+ PART_BUTTON_NORMAL_NW);
}
// widget position
diff --git a/src/widgets/drop_down_button.cpp b/src/widgets/drop_down_button.cpp
new file mode 100644
index 000000000..30bf74af4
--- /dev/null
+++ b/src/widgets/drop_down_button.cpp
@@ -0,0 +1,62 @@
+/* ASE - Allegro Sprite Editor
+ * Copyright (C) 2001-2011 David Capello
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "config.h"
+
+#include "widgets/drop_down_button.h"
+
+#include "gui/theme.h"
+#include "modules/gui.h"
+#include "skin/button_icon_impl.h"
+#include "skin/skin_property.h"
+#include "skin/skin_theme.h"
+
+DropDownButton::DropDownButton(const char* text)
+ : HBox()
+ , m_button(new Button(text))
+ , m_dropDown(new Button(""))
+{
+ setup_look(m_button, LeftButtonLook);
+ setup_look(m_dropDown, RightButtonLook);
+
+ m_button->Click.connect(&DropDownButton::onButtonClick, this);
+ m_dropDown->Click.connect(&DropDownButton::onDropDownButtonClick, this);
+
+ addChild(m_button);
+ addChild(m_dropDown);
+
+ child_spacing = 0;
+
+ m_dropDown->setIconInterface
+ (new ButtonIconImpl(static_cast(m_dropDown->getTheme()),
+ PART_COMBOBOX_ARROW_DOWN,
+ PART_COMBOBOX_ARROW_DOWN_SELECTED,
+ PART_COMBOBOX_ARROW_DOWN_DISABLED,
+ JI_CENTER | JI_MIDDLE));
+}
+
+void DropDownButton::onButtonClick(Event& ev)
+{
+ // Fire "Click" signal.
+ Click();
+}
+
+void DropDownButton::onDropDownButtonClick(Event& ev)
+{
+ DropDownClick();
+}
diff --git a/src/widgets/drop_down_button.h b/src/widgets/drop_down_button.h
new file mode 100644
index 000000000..9de6ddcd3
--- /dev/null
+++ b/src/widgets/drop_down_button.h
@@ -0,0 +1,45 @@
+/* ASE - Allegro Sprite Editor
+ * Copyright (C) 2001-2011 David Capello
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef WIDGETS_DROP_DOWN_BUTTON_H_INCLUDED
+#define WIDGETS_DROP_DOWN_BUTTON_H_INCLUDED
+
+#include "base/signal.h"
+#include "gui/box.h"
+
+class Button;
+class Event;
+
+class DropDownButton : public HBox
+{
+public:
+ DropDownButton(const char* text);
+
+ Signal0 Click;
+ Signal0 DropDownClick;
+
+protected:
+ void onButtonClick(Event& ev);
+ void onDropDownButtonClick(Event& ev);
+
+private:
+ Button* m_button;
+ Button* m_dropDown;
+};
+
+#endif