Changeset 3470 in Sophya for trunk/SophyaPI


Ignore:
Timestamp:
Feb 14, 2008, 10:43:34 AM (18 years ago)
Author:
mansoux
Message:

Rajout HITextView

Location:
trunk/SophyaPI/PI/Quartz
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PI/Quartz/PIControl.cpp

    r3326 r3470  
    99
    1010#include "PIControl.h"
     11#include "pistdwdggen.h"
     12#include "PIContainerQuartz.h"
    1113
    1214PIControl::PIControl(PIContainerGen *par, const char *nom,int sx, int sy, int px, int py)
    1315:PIWdgQuartz(par, nom, sx, sy, px, py)
    1416{
     17        wParent = ((PIContainer *)par)->GetWindowPtr();
     18        SetPortWindowPort(wParent);
     19    SetRect(&wdgRect,px,py,px+sx,py+sy);
    1520    contH = NULL;
    1621}
  • trunk/SophyaPI/PI/Quartz/pistdwdgmosx.cpp

    r3326 r3470  
    1717: PILabelGen(par, nom, sx, sy, px, py)
    1818{
     19        OSStatus err;
     20       
     21        string sNom(nom);
     22        wParent = ((PIContainer *)par)->GetWindowPtr();
     23        SetPortWindowPort(wParent);
     24    SetRect(&wdgRect,px,py,px+sx,py+sy);
     25        cfsrLabel = CFStringCreateWithCString(kCFAllocatorDefault,nom,kCFStringEncodingMacRoman);
     26        err = CreateStaticTextControl (wParent, &wdgRect, cfsrLabel, NULL, &contH);
    1927}
    2028
     
    3038       
    3139        cfsrLabel = CFStringCreateWithCString(kCFAllocatorDefault,sLabel.c_str(),kCFStringEncodingMacRoman);
    32         err = DrawThemeTextBox (cfsrLabel,
    33                                                         kThemeSystemFont,
    34                                                         kThemeStateInactive,
    35                                                         false,
    36                                                         &wdgRect,
    37                                                         teJustLeft,
    38                                                         NULL);
    39                        
    40         return;
    41 }
     40        SetPortWindowPort(wParent);
     41
     42        err = SetControlData (contH,0,kControlEditTextCFStringTag,sizeof(cfsrLabel),(Ptr)&cfsrLabel);
     43
     44        return;
     45}
    4246
    4347
     
    4650/* --Methode-- */
    4751PITextQuartz::PITextQuartz(PIContainerGen *par, const char *nom, int sx, int sy, int px, int py)
     52: PITextGen(par, nom, sx, sy, px, py)
     53{
     54        OSStatus err;
     55        wParent = ((PIContainer *)par)->GetWindowPtr();
     56    SetRect(&wdgRect,px,py,px+sx,py+sy);
     57}
     58
     59/* --Methode-- */
     60PITextQuartz::PITextQuartz(PIContainerGen* par, const char* nom, bool vsb, bool hsb,
     61                             int sx, int sy, int px, int py)
     62: PITextGen(par, nom, vsb, hsb, sx, sy, px, py)
     63{
     64}
     65
     66/* --Methode-- */
     67PITextQuartz::~PITextQuartz()
     68{
     69}
     70
     71
     72/* --Methode-- */
     73void PITextQuartz::SetText(string const& s)
     74{       
     75        OSStatus err;
     76       
     77        unicodeText = CFStringCreateWithCString (NULL,(char *)s.c_str(), kCFStringEncodingMacRoman);
     78        err = CreateEditUnicodeTextControl (wParent,&wdgRect,unicodeText,false,NULL,&contH);
     79
     80        return;
     81}
     82
     83/* --Methode-- */
     84string PITextQuartz::GetText() const
     85{
     86        char* cText;
     87       
     88        cText = (char *)CFStringGetCStringPtr(unicodeText,kCFStringEncodingMacRoman);   
     89        string sText(cText);   
     90        return (sText);
     91}
     92
     93
     94/* --Methode-- */
     95void PITextQuartz::SetMutiLineMode(bool mlm)
     96{
     97        return;
     98}
     99
     100
     101/* --Methode-- */
     102void PITextQuartz::SetTextEditable(bool te)
     103{
     104        return;
     105}
     106
     107
     108/* --Methode-- */
     109void PITextQuartz::SetMsg(PIMessage msg)
     110{
     111
     112}
     113
     114
     115/* ========== PIHITextViewQuartz ========== */
     116
     117/* --Methode-- */
     118PIHITextViewQuartz::PIHITextViewQuartz(PIContainerGen *par, const char *nom, int sx, int sy, int px, int py)
    48119: PITextGen(par, nom, sx, sy, px, py)
    49120{
     
    59130        fx = px+sx-mx;
    60131        fy = py+sy-my;
    61        
     132    SetRect(&wdgRect,px,py,px+sx,py+sy);
     133
    62134        SetRect(&userPaneRect,ox,oy,fx,fy);
    63135        hiRect.origin.x = ox;
     
    71143
    72144/* --Methode-- */
    73 PITextQuartz::PITextQuartz(PIContainerGen* par, const char* nom, bool vsb, bool hsb,
     145PIHITextViewQuartz::PIHITextViewQuartz(PIContainerGen* par, const char* nom, bool vsb, bool hsb,
    74146                             int sx, int sy, int px, int py)
    75147: PITextGen(par, nom, vsb, hsb, sx, sy, px, py)
     
    78150
    79151/* --Methode-- */
    80 PITextQuartz::~PITextQuartz()
    81 {
    82 }
    83 
    84 
    85 /* --Methode-- */
    86 void PITextQuartz::SetText(string const& s)
     152PIHITextViewQuartz::~PIHITextViewQuartz()
     153{
     154}
     155
     156
     157/* --Methode-- */
     158void PIHITextViewQuartz::SetText(string const& s)
    87159{       
    88160        OSStatus err;
     
    105177
    106178/* --Methode-- */
    107 string PITextQuartz::GetText() const
     179string PIHITextViewQuartz::GetText() const
    108180{
    109181        CFStringRef str;
     
    124196
    125197/* --Methode-- */
    126 void PITextQuartz::SetMutiLineMode(bool mlm)
    127 {
    128         return;
    129 }
    130 
    131 
    132 /* --Methode-- */
    133 void PITextQuartz::SetTextEditable(bool te)
    134 {
    135         return;
    136 }
    137 
    138 
    139 /* --Methode-- */
    140 void PITextQuartz::SetMsg(PIMessage msg)
    141 {
    142 
    143 }
     198void PIHITextViewQuartz::SetMutiLineMode(bool mlm)
     199{
     200        return;
     201}
     202
     203
     204/* --Methode-- */
     205void PIHITextViewQuartz::SetTextEditable(bool te)
     206{
     207        return;
     208}
     209
     210
     211/* --Methode-- */
     212void PIHITextViewQuartz::SetMsg(PIMessage msg)
     213{
     214
     215}
  • trunk/SophyaPI/PI/Quartz/pistdwdgmosx.h

    r3326 r3470  
    2121};
    2222
    23 typedef PILabelQuartz PILabel;
    24 
    2523class PITextQuartz : public PITextGen
    2624{
     
    4139       
    4240protected:
     41        CFStringRef unicodeText;
     42};
     43
     44
     45class PIHITextViewQuartz : public PITextGen
     46{
     47public:
     48        PIHITextViewQuartz(PIContainerGen *par, const char *nom,
     49                                int sx=10, int sy=10, int px=0, int py=0);
     50
     51        PIHITextViewQuartz(PIContainerGen* par, const char* nom, bool vsb, bool hsb,
     52                             int sx=100, int sy=100, int px=0, int py=0);
     53  virtual           ~PIHITextViewQuartz();
     54  virtual void      SetText(string const&);
     55  virtual string    GetText() const;
     56
     57  virtual void      SetMutiLineMode(bool mlm=false);
     58  virtual void      SetTextEditable(bool te=true);
     59
     60  virtual void          SetMsg(PIMessage msg=0);
     61       
     62protected:
    4363        UniChar* uniChars;
    4464        CFIndex textLength;
    4565        HIViewRef outTextView;
    46         WindowRef wParent;
    4766        HIRect hiRect;
    4867        ControlRef fUserPane;
     
    5069};
    5170
     71
     72
     73typedef PILabelQuartz PILabel;
    5274typedef PITextQuartz PIText;
     75typedef PIHITextViewQuartz PITextView;
    5376
    5477#endif
  • trunk/SophyaPI/PI/Quartz/piwdgmosx.cpp

    r3326 r3470  
    1616    fflush (stdout);
    1717    title = CFStringCreateWithCString (NULL, nom, kCFStringEncodingMacRoman);
    18     SetRect(&wdgRect,px,py,px+sx,py+sy);
    1918    contH = NULL;
    2019    wPtr = NULL;
     20        wParent = NULL;
    2121    mFCol = mBCol = PI_NotDefColor;
    2222}
  • trunk/SophyaPI/PI/Quartz/piwdgmosx.h

    r3326 r3470  
    1414
    1515#include "piwdggen.h"
    16 
    1716
    1817
     
    102101    ControlRef  contH;
    103102    WindowPtr   wPtr;
     103        WindowRef       wParent;
    104104//  pas utilisable dans MOSX/Carbon
    105105    PIColors mFCol, mBCol;
Note: See TracChangeset for help on using the changeset viewer.