Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TextEntry Hints #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions wx/src/Graphics/UI/WX/Classes.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ module Graphics.UI.WX.Classes

-- * Text
, Textual(text,appendText)
, Hints(hint)
, Literate(font ,fontFamily, fontFace, fontSize, fontWeight, fontUnderline, fontShape
,textColor,textBgcolor)
-- * Rendering
Expand Down Expand Up @@ -78,6 +79,10 @@ class Textual w where
appendText w s
= set w [text :~ (++s)]

-- | Widgets that can display a hint
class Hinted w where
-- | The hint displayed by a widget
hint :: Attr w String

-- | Widgets with a picture.
class Pictured w where
Expand Down
13 changes: 12 additions & 1 deletion wxc/src/cpp/eljtextctrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,18 @@ EWXWEXPORT(bool,wxTextCtrl_CanRedo)(wxTextCtrl* self)
{
return self->CanRedo();
}


EWXWEXPORT(wxString*,wxTextCtrl_GetHint)(wxTextCtrl* self)
{
wxString *result = new wxString();
*result = self->GetHint();
return result;
}
EWXWEXPORT(bool,wxTextCtrl_SetHint)(wxTextCtrl* self,wxString *hint)
{
self->SetHint(*hint);
}

EWXWEXPORT(void,wxTextCtrl_SetInsertionPoint)(wxTextCtrl* self,long pos)
{
self->SetInsertionPoint(pos);
Expand Down
2 changes: 2 additions & 0 deletions wxc/src/include/wxc_glue.h
Original file line number Diff line number Diff line change
Expand Up @@ -5181,6 +5181,7 @@ void wxTextCtrl_Copy( TSelf(wxTextCtrl) _obj );
TClass(wxTextCtrl) wxTextCtrl_Create( TClass(wxWindow) _prt, int _id, TClass(wxString) _txt, TRect(_lft,_top,_wdt,_hgt), long _stl );
void wxTextCtrl_Cut( TSelf(wxTextCtrl) _obj );
void wxTextCtrl_DiscardEdits( TSelf(wxTextCtrl) _obj );
TClass(wxString) wxTextCtrl_GetHint( TSelf(wxTextCtrl) _obj );
long wxTextCtrl_GetInsertionPoint( TSelf(wxTextCtrl) _obj );
long wxTextCtrl_GetLastPosition( TSelf(wxTextCtrl) _obj );
int wxTextCtrl_GetLineLength( TSelf(wxTextCtrl) _obj, long lineNo );
Expand All @@ -5198,6 +5199,7 @@ void wxTextCtrl_Remove( TSelf(wxTextCtrl) _obj, long from, long to );
void wxTextCtrl_Replace( TSelf(wxTextCtrl) _obj, long from, long to, TClass(wxString) value );
TBool wxTextCtrl_SaveFile( TSelf(wxTextCtrl) _obj, TClass(wxString) file );
void wxTextCtrl_SetEditable( TSelf(wxTextCtrl) _obj, TBool editable );
bool wxTextCtrl_SetHint( TSelf(wxTextCtrl) _obj, TClass(wxString) hint );
void wxTextCtrl_SetInsertionPoint( TSelf(wxTextCtrl) _obj, long pos );
void wxTextCtrl_SetInsertionPointEnd( TSelf(wxTextCtrl) _obj );
void wxTextCtrl_SetSelection( TSelf(wxTextCtrl) _obj, long from, long to );
Expand Down