mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-21 06:45:39 -06:00
GridCtrl: Added explicitly enabling of clipboard cut, copy and paste operations
git-svn-id: svn://ultimatepp.org/upp/trunk@4988 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
797873db09
commit
3d1a1a03ed
2 changed files with 15 additions and 5 deletions
|
|
@ -132,6 +132,9 @@ GridCtrl::GridCtrl() : holder(*this)
|
|||
clipboard = false;
|
||||
extra_paste = true;
|
||||
fixed_paste = false;
|
||||
copy_allowed = true;
|
||||
cut_allowed = true;
|
||||
paste_allowed = true;
|
||||
copy_column_names = false;
|
||||
draw_focus = false;
|
||||
ask_remove = false;
|
||||
|
|
@ -624,9 +627,9 @@ void GridCtrl::ClipboardMenu(Bar &bar)
|
|||
{
|
||||
bool c = IsCursor();
|
||||
bool s = c || IsSelection();
|
||||
bar.Add(t_("Copy"), THISBACK(DoCopy)).Image(CtrlImg::copy()).Key(K_CTRL_C).Enable(s);
|
||||
bar.Add(t_("Cut"), THISBACK(Nothing)).Image(CtrlImg::cut()).Key(K_CTRL_X).Enable(s);
|
||||
bar.Add(t_("Paste"), THISBACK(DoPaste)).Image(CtrlImg::paste()).Key(K_CTRL_V).Enable(c && IsClipboardAvailable());
|
||||
bar.Add(t_("Copy"), THISBACK(DoCopy)).Image(CtrlImg::copy()).Key(K_CTRL_C).Enable(s && copy_allowed);
|
||||
bar.Add(t_("Cut"), THISBACK(Nothing)).Image(CtrlImg::cut()).Key(K_CTRL_X).Enable(s && cut_allowed);
|
||||
bar.Add(t_("Paste"), THISBACK(DoPaste)).Image(CtrlImg::paste()).Key(K_CTRL_V).Enable(c && paste_allowed && IsClipboardAvailable());
|
||||
if(extra_paste)
|
||||
bar.Add(t_("Paste as"), THISBACK(PasteAsMenu));
|
||||
}
|
||||
|
|
@ -635,8 +638,8 @@ void GridCtrl::PasteAsMenu(Bar &bar)
|
|||
{
|
||||
bool c = IsCursor();
|
||||
bool s = IsClipboardAvailable() && !fixed_paste;
|
||||
bar.Add(t_("appended"), THISBACK(DoPasteAppendedRows)).Key(K_CTRL_E).Enable(s);
|
||||
bar.Add(t_("inserted"), THISBACK(DoPasteInsertedRows)).Key(K_CTRL_I).Enable(c && s);
|
||||
bar.Add(t_("appended"), THISBACK(DoPasteAppendedRows)).Key(K_CTRL_E).Enable(s && paste_allowed);
|
||||
bar.Add(t_("inserted"), THISBACK(DoPasteInsertedRows)).Key(K_CTRL_I).Enable(c && paste_allowed && s);
|
||||
}
|
||||
|
||||
bool GridCtrl::IsClipboardAvailable()
|
||||
|
|
|
|||
|
|
@ -881,6 +881,9 @@ class GridCtrl : public Ctrl
|
|||
bool clipboard:1;
|
||||
bool extra_paste:1;
|
||||
bool fixed_paste:1;
|
||||
bool copy_allowed:1;
|
||||
bool cut_allowed:1;
|
||||
bool paste_allowed:1;
|
||||
bool copy_column_names:1;
|
||||
bool draw_focus:1;
|
||||
bool cancel_all:1;
|
||||
|
|
@ -1136,6 +1139,9 @@ class GridCtrl : public Ctrl
|
|||
GridCtrl& Clipboard(bool b = true) { clipboard = b; return *this; }
|
||||
GridCtrl& ExtraPaste(bool b = true) { extra_paste = b; return *this; }
|
||||
GridCtrl& FixedPaste(bool b = true) { fixed_paste = b; return *this; }
|
||||
GridCtrl& ClipboardCopy(bool b = true) { copy_allowed = b; return *this; }
|
||||
GridCtrl& ClipboardCut(bool b = true) { cut_allowed = b; return *this; }
|
||||
GridCtrl& ClipboardPaste(bool b = true) { paste_allowed = b; return *this; }
|
||||
GridCtrl& CopyColumnNames(bool b = true) { copy_column_names = b; return *this; }
|
||||
GridCtrl& AskRemove(bool b = true) { ask_remove = b; return *this; }
|
||||
GridCtrl& RowChanging(bool b = true) { row_changing = b; return *this; }
|
||||
|
|
@ -1843,6 +1849,7 @@ class GridText : Ctrl
|
|||
};
|
||||
|
||||
template<> void Xmlize(XmlIO& xml, GridCtrl& g);
|
||||
template<> void Jsonize(JsonIO& json, GridCtrl& g);
|
||||
|
||||
END_UPP_NAMESPACE
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue