mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-15 20:42:40 +00:00
Modified color_get_*() so they do not need "imgtype" parameter. ColorBar class is public (defined in colbar.h). Added ColorBar::Fg/BgColorChange signals. Converted palette editor widget to a C++ class (PalEdit derived from Widget). Modified the "Palette Editor" (F4 key) to be non-modal (still WIP).
83 lines
2.2 KiB
C++
83 lines
2.2 KiB
C++
/* ASE - Allegro Sprite Editor
|
|
* Copyright (C) 2001-2010 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_COLBAR_H_INCLUDED
|
|
#define WIDGETS_COLBAR_H_INCLUDED
|
|
|
|
#include "Vaca/Signal.h"
|
|
#include "jinete/jwidget.h"
|
|
|
|
#include "core/color.h"
|
|
|
|
class ColorBar : public Widget
|
|
{
|
|
typedef enum {
|
|
HOTCOLOR_NONE = -3,
|
|
HOTCOLOR_FGCOLOR = -2,
|
|
HOTCOLOR_BGCOLOR = -1,
|
|
} hotcolor_t;
|
|
|
|
public:
|
|
ColorBar(int align);
|
|
~ColorBar();
|
|
|
|
color_t getFgColor() const { return m_fgcolor; }
|
|
color_t getBgColor() const { return m_bgcolor; }
|
|
void setFgColor(color_t color);
|
|
void setBgColor(color_t color);
|
|
|
|
color_t getColorByPosition(int x, int y);
|
|
|
|
// Signals
|
|
Vaca::Signal1<void, color_t> FgColorChange;
|
|
Vaca::Signal1<void, color_t> BgColorChange;
|
|
|
|
protected:
|
|
virtual bool msg_proc(JMessage msg);
|
|
|
|
private:
|
|
int getEntriesCount() const { return m_columns*m_colorsPerColum; }
|
|
color_t getEntryColor(size_t i) const { return color_index(i+m_firstIndex); }
|
|
|
|
color_t getHotColor(hotcolor_t hot);
|
|
void setHotColor(hotcolor_t hot, color_t color);
|
|
Rect getColumnBounds(size_t column) const;
|
|
Rect getEntryBounds(size_t index) const;
|
|
Rect getFgBounds() const;
|
|
Rect getBgBounds() const;
|
|
void updateStatusBar(color_t color, int msecs);
|
|
|
|
size_t m_firstIndex;
|
|
size_t m_columns;
|
|
size_t m_colorsPerColum;
|
|
int m_entrySize;
|
|
color_t m_fgcolor;
|
|
color_t m_bgcolor;
|
|
hotcolor_t m_hot;
|
|
hotcolor_t m_hot_editing;
|
|
|
|
// Drag & drop colors
|
|
hotcolor_t m_hot_drag;
|
|
hotcolor_t m_hot_drop;
|
|
|
|
};
|
|
|
|
int colorbar_type();
|
|
|
|
#endif
|