mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
UTF8 enable HyperTree title and inline edit
This commit is contained in:
parent
f07b68f61a
commit
404bf5feae
@ -335,6 +335,7 @@ void RegisterAllBrowserClasses(void)
|
||||
RegisterClass_(CInlineEditField);
|
||||
|
||||
RegisterClass_(CChameleonCaption);
|
||||
RegisterClass_(CNavCenterCaption);
|
||||
RegisterClass_(CChameleonBroadcastCaption);
|
||||
|
||||
RegisterClass_(CNavCenterWindow);
|
||||
|
@ -40,7 +40,7 @@
|
||||
#include "ufilemgr.h"
|
||||
#include "CInlineEditField.h"
|
||||
#include "CContextMenuAttachment.h"
|
||||
|
||||
#include "libi18n.h"
|
||||
#include <vector.h>
|
||||
#include <algorithm>
|
||||
|
||||
@ -170,8 +170,17 @@ CHyperTreeFlexTable :: GetMainRowText( TableIndexT inRow, char* outText, UInt16
|
||||
*outText = NULL;
|
||||
|
||||
} // GetMainRowText
|
||||
//----------------------------------------------------------------------------------------
|
||||
void CHyperTreeFlexTable::SetEditParam(int w, int h, char* utf8, SPoint32& ImagePoint)
|
||||
|
||||
|
||||
{
|
||||
mNameEditor->ResizeFrameTo(w, h, true);
|
||||
char* editText = (char*) INTL_ConvertLineWithoutAutoDetect(
|
||||
CS_UTF8, INTL_GetCharSetID(INTL_DefaultTextWidgetCsidSel),
|
||||
(unsigned char*)utf8, strlen(utf8));
|
||||
mNameEditor->UpdateEdit(CStr255(editText), &ImagePoint, nil);
|
||||
XP_FREEIF(editText);
|
||||
} // SetEditParam
|
||||
//
|
||||
// FindTitleColumnID
|
||||
//
|
||||
@ -1362,8 +1371,12 @@ CHyperTreeFlexTable :: InlineEditorDone ( )
|
||||
{
|
||||
Str255 newName;
|
||||
mNameEditor->GetDescriptor(newName);
|
||||
cstring nameAsCString(newName);
|
||||
|
||||
// we need to convert to UTF8 here....
|
||||
unsigned char* utfText = INTL_ConvertLineWithoutAutoDetect(
|
||||
INTL_GetCharSetID(INTL_DefaultTextWidgetCsidSel), CS_UTF8, newName+1, newName[0]);
|
||||
cstring nameAsCString( (char*) utfText);
|
||||
XP_FREEIF(utfText);
|
||||
|
||||
HT_Resource editedNode = HT_GetNthItem(GetHTView(), URDFUtilities::PPRowToHTRow(mRowBeingEdited) );
|
||||
HT_SetNodeName ( editedNode, nameAsCString );
|
||||
|
||||
|
@ -150,6 +150,7 @@ protected:
|
||||
virtual void DeleteSelection ( const EventRecord& inEvent );
|
||||
virtual void FindCommandStatus ( CommandT inCommand, Boolean &outEnabled,
|
||||
Boolean &outUsesMark, Char16 &outMark, Str255 outName) ;
|
||||
virtual void SetEditParam(int w, int h, char* str, SPoint32& ImagePoint);
|
||||
|
||||
HT_Resource TopNode ( ) const { return HT_TopNode(GetHTView()); }
|
||||
|
||||
|
@ -28,6 +28,19 @@
|
||||
#include "URDFUtilities.h"
|
||||
#include "CContextMenuAttachment.h"
|
||||
#include "CRDFCoordinator.h"
|
||||
#include "UGraphicGizmos.h"
|
||||
|
||||
CNavCenterCaption :: CNavCenterCaption ( LStream *inStream )
|
||||
: CChameleonCaption(inStream)
|
||||
{
|
||||
}
|
||||
void CNavCenterCaption::DrawText(Rect frame, Int16 inJust)
|
||||
{
|
||||
UGraphicGizmos::PlaceUTF8TextInRect((char*)&mText[1],
|
||||
mText[0],
|
||||
frame,
|
||||
inJust);
|
||||
}
|
||||
|
||||
|
||||
CNavCenterStrip :: CNavCenterStrip ( LStream *inStream )
|
||||
|
@ -69,7 +69,13 @@ private:
|
||||
}; // class CNavCenterTitle
|
||||
|
||||
|
||||
|
||||
class CNavCenterCaption : public CChameleonCaption {
|
||||
public:
|
||||
enum { class_ID = 'ccp8' };
|
||||
CNavCenterCaption(LStream *inStream);
|
||||
protected:
|
||||
virtual void DrawText(Rect frame, Int16 inJust);
|
||||
};
|
||||
|
||||
class CNavCenterTitle : public CNavCenterStrip
|
||||
{
|
||||
|
Binary file not shown.
@ -86,10 +86,16 @@ CChameleonCaption :: DrawSelf()
|
||||
::RGBForeColor ( &textColor );
|
||||
|
||||
// ¥ Now we can finally get the text drawn
|
||||
UTextDrawing::DrawWithJustification ( (Ptr)&mText[1], mText[0], localFrame, just );
|
||||
this->DrawText(localFrame, just);
|
||||
}
|
||||
|
||||
} // DrawSelf
|
||||
void
|
||||
CChameleonCaption :: DrawText(Rect frame, Int16 inJust)
|
||||
{
|
||||
UTextDrawing::DrawWithJustification ( (Ptr)&mText[1], mText[0], frame, inJust );
|
||||
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
|
@ -42,6 +42,7 @@ public:
|
||||
protected:
|
||||
|
||||
virtual void DrawSelf();
|
||||
virtual void DrawText(Rect frame, Int16 inJust);
|
||||
|
||||
RGBColor mTextColor;
|
||||
RGBColor mBackColor;
|
||||
|
@ -1161,13 +1161,17 @@ void CStandardFlexTable::DoInlineEditing(const STableCell &inCell, Rect& inTextR
|
||||
GetHiliteText(mRowBeingEdited, nameString, sizeof(nameString), false, &inTextRect);
|
||||
InsetRect(&inTextRect, -2, -2);
|
||||
inTextRect.bottom += 2;
|
||||
mNameEditor->ResizeFrameTo(inTextRect.right - inTextRect.left,
|
||||
inTextRect.bottom - inTextRect.top, true);
|
||||
mNameEditor->UpdateEdit(CStr255(nameString), &imagePoint, nil);
|
||||
|
||||
SetEditParam(inTextRect.right - inTextRect.left, inTextRect.bottom - inTextRect.top, nameString, imagePoint);
|
||||
SelectionChanged();
|
||||
} // DoInlineEditing
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
void CStandardFlexTable::SetEditParam(int w, int h, char* str, SPoint32& ImagePoint)
|
||||
|
||||
{
|
||||
mNameEditor->ResizeFrameTo(w, h, true);
|
||||
mNameEditor->UpdateEdit(CStr255(str), &ImagePoint, nil);
|
||||
} // SetEditParam
|
||||
//----------------------------------------------------------------------------------------
|
||||
Boolean CStandardFlexTable::CellSelects(const STableCell& /*inCell*/) const
|
||||
// Determines if a cell is allowed to select the row.
|
||||
|
@ -260,6 +260,10 @@ protected:
|
||||
virtual void InlineEditorTextChanged( ) { }
|
||||
virtual void InlineEditorDone( ) { }
|
||||
virtual void DoInlineEditing( const STableCell &inCell, Rect & inTextRect );
|
||||
virtual void SetEditParam(int w, int h, char* str, SPoint32& ImagePoint);
|
||||
|
||||
|
||||
|
||||
virtual Boolean CanDoInlineEditing( ) const { return true; }
|
||||
|
||||
virtual void DrawCell(
|
||||
|
Loading…
Reference in New Issue
Block a user