You've already forked lazarus-ccr
tvplanit: Make default popup menus of DayView/WeekView/MonthView/TaskList/ContactGrid accessible to the user.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8393 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -111,9 +111,12 @@ type
|
||||
TVpContactGrid = class(TVpLinkableControl)
|
||||
private
|
||||
FComponentHint: TTranslateString;
|
||||
FDefaultPopup: TPopupMenu;
|
||||
FExternalPopup: TPopupMenu;
|
||||
FHintMode: TVpHintMode;
|
||||
FPendingDatastore: TVpCustomDatastore;
|
||||
procedure InternalSetDatastore(const Value: TVpCustomDatastore);
|
||||
procedure SetPopupMenu(AValue: TPopupMenu);
|
||||
protected{ private }
|
||||
FColumnWidth : Integer;
|
||||
FColor : TColor;
|
||||
@ -126,7 +129,6 @@ type
|
||||
FContactIndex : Integer;
|
||||
FPrintNumColumns : Integer;
|
||||
FActiveContact : TVpContact;
|
||||
FDefaultPopup : TPopupMenu;
|
||||
FSortBy : TVpContactSort;
|
||||
{ contact variables }
|
||||
FOwnerDrawContact : TVpOwnerDrawContactEvent;
|
||||
@ -196,6 +198,7 @@ type
|
||||
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X,Y: Integer); override;
|
||||
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
|
||||
procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
|
||||
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
||||
procedure ScrollIntoView;
|
||||
procedure PopupAddContact(Sender: TObject);
|
||||
procedure PopupAddVCards(Sender: TObject);
|
||||
@ -203,6 +206,7 @@ type
|
||||
procedure PopupEditContact(Sender: TObject);
|
||||
procedure EditContact;
|
||||
procedure EndEdit(Sender: TObject);
|
||||
function GetPopupMenu: TPopupMenu; override;
|
||||
procedure InitializeDefaultPopup;
|
||||
|
||||
{ message handlers }
|
||||
@ -264,10 +268,12 @@ type
|
||||
property Align;
|
||||
property Anchors;
|
||||
{$IFDEF LCL}
|
||||
property BorderSpacing;
|
||||
property BorderSpacing;
|
||||
{$ENDIF}
|
||||
property PopupMenu: TPopupMenu read GetPopupMenu write SetPopupMenu;
|
||||
property TabStop default true;
|
||||
property TabOrder;
|
||||
|
||||
property AllowInPlaceEditing: Boolean
|
||||
read FAllowInPlaceEdit write FAllowInPlaceEdit default true;
|
||||
property BarWidth: Integer
|
||||
@ -500,8 +506,9 @@ begin
|
||||
Width := 225;
|
||||
|
||||
FDefaultPopup := TPopupMenu.Create(Self);
|
||||
Self.PopupMenu := FDefaultPopup;
|
||||
FDefaultPopup.Name := 'default';
|
||||
InitializeDefaultPopup;
|
||||
Self.PopupMenu := FDefaultPopup;
|
||||
|
||||
LoadLanguage;
|
||||
|
||||
@ -1256,6 +1263,13 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TVpContactGrid.Notification(AComponent: TComponent; Operation: TOperation);
|
||||
begin
|
||||
inherited;
|
||||
if (Operation = opRemove) and (AComponent = FExternalPopup) then
|
||||
FExternalPopup := nil;
|
||||
end;
|
||||
|
||||
procedure TVpContactGrid.cgSpawnContactEditDialog(IsNewContact: Boolean);
|
||||
var
|
||||
AllowIt: Boolean;
|
||||
@ -1498,7 +1512,22 @@ begin
|
||||
end;
|
||||
Invalidate;
|
||||
end;
|
||||
{=====}
|
||||
|
||||
function TVpContactGrid.GetPopupMenu: TPopupMenu;
|
||||
begin
|
||||
if FExternalPopup = nil then
|
||||
Result := FDefaultPopup
|
||||
else
|
||||
Result := FExternalPopup;
|
||||
end;
|
||||
|
||||
procedure TVpContactGrid.SetPopupMenu(AValue: TPopupMenu);
|
||||
begin
|
||||
if (AValue = nil) or (AValue = FDefaultPopup) then
|
||||
FExternalPopup := nil
|
||||
else
|
||||
FExternalPopup := AValue;
|
||||
end;
|
||||
|
||||
procedure TVpContactGrid.InitializeDefaultPopup;
|
||||
var
|
||||
|
@ -235,10 +235,13 @@ type
|
||||
TVpDayView = class(TVpLinkableControl)
|
||||
private
|
||||
FComponentHint: TTranslateString;
|
||||
FDefaultPopup: TPopupMenu;
|
||||
FExternalPopup: TPopupMenu;
|
||||
FHintMode: TVpHintMode;
|
||||
FMouseEvent: TVpEvent;
|
||||
FOnHoliday: TVpHolidayEvent;
|
||||
function IsStoredDateLabelFormat: Boolean;
|
||||
procedure SetPopupMenu(AValue: TPopupMenu);
|
||||
|
||||
protected{ private }
|
||||
FGranularity: TVpGranularity;
|
||||
@ -254,7 +257,6 @@ type
|
||||
FActiveCol: Integer;
|
||||
FActiveEvent: TVpEvent;
|
||||
FGutterWidth: Integer;
|
||||
FDefaultPopup: TPopupMenu;
|
||||
FLineCount: Integer;
|
||||
FVisibleLines: Integer;
|
||||
FTimeFormat: TVpTimeFormat;
|
||||
@ -367,6 +369,7 @@ type
|
||||
procedure SetHintMode(const AValue: TVpHintMode);
|
||||
|
||||
{ Popup }
|
||||
function GetPopupMenu: TPopupMenu; override;
|
||||
procedure PopupAddEvent(Sender: TObject);
|
||||
procedure PopupAddFromICalFile(Sender: TObject);
|
||||
procedure PopupDeleteEvent(Sender: TObject);
|
||||
@ -418,6 +421,7 @@ type
|
||||
procedure MouseLeave; override;
|
||||
procedure MouseMove(Shift: TShiftState; X,Y: Integer); override;
|
||||
procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X,Y: Integer); override;
|
||||
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
||||
procedure Paint; override;
|
||||
|
||||
{ message handlers }
|
||||
@ -491,6 +495,7 @@ type
|
||||
property BorderSpacing;
|
||||
{$ENDIF}
|
||||
property Constraints;
|
||||
property PopupMenu: TPopupMenu read GetPopupMenu write SetPopupMenu;
|
||||
property ReadOnly default false;
|
||||
property TabStop default true;
|
||||
property TabOrder;
|
||||
@ -888,8 +893,9 @@ begin
|
||||
|
||||
// popup menu
|
||||
FDefaultPopup := TPopupMenu.Create(Self);
|
||||
Self.PopupMenu := FDefaultPopup;
|
||||
FDefaultPopup.Name := 'default';
|
||||
InitializeDefaultPopup;
|
||||
Self.PopupMenu := FDefaultPopup;
|
||||
|
||||
LoadLanguage;
|
||||
|
||||
@ -1136,6 +1142,22 @@ end;
|
||||
|
||||
{ Popup menu }
|
||||
|
||||
function TVpDayView.GetPopupMenu: TPopupMenu;
|
||||
begin
|
||||
if FExternalPopup = nil then
|
||||
Result := FDefaultPopup
|
||||
else
|
||||
Result := FExternalPopup;
|
||||
end;
|
||||
|
||||
procedure TVpDayView.SetPopupMenu(AValue: TPopupMenu);
|
||||
begin
|
||||
if (AValue = nil) or (AValue = FDefaultPopup) then
|
||||
FExternalPopup := nil
|
||||
else
|
||||
FExternalPopup := AValue;
|
||||
end;
|
||||
|
||||
procedure TVpDayView.InitializeDefaultPopup;
|
||||
var
|
||||
NewItem: TVpMenuItem;
|
||||
@ -2115,6 +2137,13 @@ begin
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
procedure TVpDayView.Notification(AComponent: TComponent; Operation: TOperation);
|
||||
begin
|
||||
inherited;
|
||||
if (Operation = opRemove) and (AComponent = FExternalPopup) then
|
||||
FExternalPopup := nil;
|
||||
end;
|
||||
|
||||
procedure TVpDayView.EditSelectedEvent(IsNewEvent: Boolean = false);
|
||||
begin
|
||||
if ReadOnly then
|
||||
|
@ -142,11 +142,14 @@ type
|
||||
TVpMonthView = class(TVpLinkableControl)
|
||||
private
|
||||
FComponentHint: TTranslateString;
|
||||
FDefaultPopup: TPopupMenu;
|
||||
FExternalPopup: TPopupMenu;
|
||||
FHintMode: TVpHintMode;
|
||||
FOnHoliday: TVpHolidayEvent;
|
||||
FAllowDragAndDrop: Boolean;
|
||||
FDragDropTransparent: Boolean;
|
||||
FApplyCategoryInfos: Boolean;
|
||||
procedure SetPopupMenu(AValue: TPopupMenu);
|
||||
function IsStoredDateLabelFormat: Boolean;
|
||||
procedure SetApplyCategoryInfos(AValue: Boolean);
|
||||
protected{ private }
|
||||
@ -176,7 +179,6 @@ type
|
||||
FTimeFormat: TVpTimeFormat;
|
||||
FDrawingStyle: TVpDrawingStyle;
|
||||
FDate: TDateTime;
|
||||
FDefaultPopup: TPopupMenu;
|
||||
FRightClickChangeDate: Boolean;
|
||||
FMouseDate: TDateTime;
|
||||
FPrevYearBtn: TSpeedButton;
|
||||
@ -243,6 +245,7 @@ type
|
||||
procedure MouseLeave; override;
|
||||
procedure MouseMove(Shift: TShiftState; X,Y: Integer); override;
|
||||
procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
|
||||
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
||||
procedure Paint; override;
|
||||
|
||||
{ drag and drop }
|
||||
@ -274,6 +277,7 @@ type
|
||||
procedure SetHint(const AValue: TTranslateString); override;
|
||||
|
||||
{ Popup menu }
|
||||
function GetPopupMenu: TPopupMenu; override;
|
||||
procedure InitializeDefaultPopup;
|
||||
procedure PopupToday(Sender: TObject);
|
||||
procedure PopupNextMonth(Sender: TObject);
|
||||
@ -316,6 +320,7 @@ type
|
||||
{$IFDEF LCL}
|
||||
property BorderSpacing;
|
||||
{$ENDIF}
|
||||
property PopupMenu: TPopupMenu read GetPopupMenu write SetPopupMenu;
|
||||
property TabStop default true;
|
||||
property TabOrder;
|
||||
property AllowDragAndDrop: Boolean read FAllowDragAndDrop write FAllowDragAndDrop default false;
|
||||
@ -486,13 +491,6 @@ begin
|
||||
FNextYearUpBtn.Glyph.LoadFromResourceName(HINSTANCE, 'VPRIGHTARROWS');
|
||||
{$ENDIF}
|
||||
|
||||
{
|
||||
FHeadAttr := TVpMvHeadAttr.Create(self);
|
||||
FDayHeadAttr := TVpDayHeadAttr.Create(self);
|
||||
FTodayAttr := TVpMvTodayAttr.Create(self);
|
||||
FHolidayAttr := TvpMvHolidayAttr.Create(self);
|
||||
}
|
||||
|
||||
{ Set styles and initialize internal variables }
|
||||
{$IFDEF VERSION4}
|
||||
// DoubleBuffered := true;
|
||||
@ -522,9 +520,6 @@ begin
|
||||
// mvVisibleEvents := 0;
|
||||
|
||||
{ set up fonts and colors }
|
||||
// FDayHeadAttributes.Font.Name := 'Tahoma'; wp: better use defaults
|
||||
// FDayHeadAttributes.Font.Size := 10;
|
||||
// FDayHeadAttributes.Font.Style := [];
|
||||
FDayHeadAttr.Color := clBtnFace;
|
||||
|
||||
{ Assign default font to DayNumberFont and EventFont }
|
||||
@ -548,14 +543,16 @@ begin
|
||||
Height := 225;
|
||||
Width := 300;
|
||||
|
||||
{ Popup menu }
|
||||
FDefaultPopup := TPopupMenu.Create(Self);
|
||||
Self.PopupMenu := FDefaultPopup;
|
||||
FDefaultPopup.Name := 'default';
|
||||
InitializeDefaultPopup;
|
||||
Self.PopupMenu := FDefaultPopup;
|
||||
|
||||
LoadLanguage;
|
||||
|
||||
mvHookUp;
|
||||
end;
|
||||
{=====}
|
||||
|
||||
destructor TVpMonthView.Destroy;
|
||||
begin
|
||||
@ -1225,9 +1222,28 @@ begin
|
||||
FComponentHint := AValue;
|
||||
end;
|
||||
|
||||
|
||||
{ PopupMenu }
|
||||
|
||||
function TVpMonthView.GetPopupMenu: TPopupMenu;
|
||||
begin
|
||||
if FExternalPopup = nil then
|
||||
Result := FDefaultPopup
|
||||
else
|
||||
Result := FExternalPopup;
|
||||
end;
|
||||
|
||||
procedure TVpMonthView.SetPopupMenu(AValue: TPopupMenu);
|
||||
begin
|
||||
if (AValue = nil) or (AValue = FDefaultPopup) then
|
||||
FExternalPopup := nil
|
||||
else
|
||||
FExternalPopup := AValue;
|
||||
end;
|
||||
|
||||
procedure TVpMonthView.InitializeDefaultPopup;
|
||||
var
|
||||
NewItem : TVpMenuItem;
|
||||
NewItem: TVpMenuItem;
|
||||
begin
|
||||
FDefaultPopup.Items.Clear;
|
||||
|
||||
@ -1557,6 +1573,13 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TVpMonthView.Notification(AComponent: TComponent; Operation: TOperation);
|
||||
begin
|
||||
inherited;
|
||||
if (Operation = opRemove) and (AComponent = FExternalPopup) then
|
||||
FExternalPopup := nil;
|
||||
end;
|
||||
|
||||
procedure TVpMonthView.SetRightClickChangeDate(const v: Boolean);
|
||||
begin
|
||||
if v <> FRightClickChangeDate then
|
||||
|
@ -123,6 +123,10 @@ type
|
||||
|
||||
{ Task List }
|
||||
TVpTaskList = class(TVpLinkableControl)
|
||||
private
|
||||
FDefaultPopup: TPopupMenu;
|
||||
FExternalPopup: TPopupMenu;
|
||||
procedure SetPopupMenu(AValue: TPopupMenu);
|
||||
protected{ private }
|
||||
FColor: TColor;
|
||||
FCaption: string;
|
||||
@ -136,7 +140,6 @@ type
|
||||
FMaxVisibleTasks: Word;
|
||||
FDrawingStyle: TVpDrawingStyle;
|
||||
FTaskID: Integer;
|
||||
FDefaultPopup: TPopupMenu;
|
||||
FShowIcon: Boolean;
|
||||
FAllowInplaceEdit: Boolean;
|
||||
{ task variables }
|
||||
@ -170,6 +173,7 @@ type
|
||||
procedure SetShowIcon(const v: Boolean);
|
||||
procedure SetShowResourceName(Value: Boolean);
|
||||
{ internal methods }
|
||||
function GetPopupMenu: TPopupMenu; override;
|
||||
procedure InitializeDefaultPopup;
|
||||
procedure PopupAddTask(Sender: TObject);
|
||||
procedure PopupAddFromICalFile(Sender: TObject);
|
||||
@ -181,6 +185,7 @@ type
|
||||
procedure tlHookUp;
|
||||
procedure Paint; override;
|
||||
procedure Loaded; override;
|
||||
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
||||
procedure tlSpawnTaskEditDialog(IsNewTask: Boolean);
|
||||
procedure tlSetActiveTaskByCoord(Pnt: TPoint);
|
||||
function tlVisibleTaskToTaskIndex(const VisTaskIndex: Integer) : Integer;
|
||||
@ -236,9 +241,10 @@ type
|
||||
property Align;
|
||||
property Anchors;
|
||||
property Font;
|
||||
property PopupMenu: TPopupMenu read GetPopupMenu write SetPopupMenu;
|
||||
property ReadOnly default false;
|
||||
property TabStop default true;
|
||||
property TabOrder;
|
||||
property ReadOnly default false;
|
||||
{$IFDEF LCL}
|
||||
property BorderSpacing;
|
||||
{$ENDIF}
|
||||
@ -530,8 +536,9 @@ begin
|
||||
Width := 169;
|
||||
|
||||
FDefaultPopup := TPopupMenu.Create(Self);
|
||||
Self.PopupMenu := FDefaultPopup;
|
||||
FDefaultPopup.Name := 'default';
|
||||
InitializeDefaultPopup;
|
||||
Self.PopupMenu := FDefaultPopup;
|
||||
|
||||
LoadLanguage;
|
||||
|
||||
@ -612,6 +619,13 @@ begin
|
||||
tlLoaded := true;
|
||||
end;
|
||||
|
||||
procedure TVpTaskList.Notification(AComponent: TComponent; Operation: TOperation);
|
||||
begin
|
||||
inherited;
|
||||
if (Operation = opRemove) and (AComponent = FExternalPopup) then
|
||||
FExternalPopup := nil;
|
||||
end;
|
||||
|
||||
function TVpTaskList.GetControlType: TVpItemType;
|
||||
begin
|
||||
Result := itTasks;
|
||||
@ -846,6 +860,22 @@ begin
|
||||
tlSpawnTaskEditDialog(FActiveTask = nil);
|
||||
end;
|
||||
|
||||
function TVpTaskList.GetPopupMenu: TPopupMenu;
|
||||
begin
|
||||
if FExternalPopup = nil then
|
||||
Result := FDefaultPopup
|
||||
else
|
||||
Result := FExternalPopup;
|
||||
end;
|
||||
|
||||
procedure TVpTaskList.SetPopupMenu(AValue: TPopupMenu);
|
||||
begin
|
||||
if (AValue = nil) or (AValue = FDefaultPopup) then
|
||||
FExternalPopup := nil
|
||||
else
|
||||
FExternalPopup := AValue;
|
||||
end;
|
||||
|
||||
procedure TVpTaskList.InitializeDefaultPopup;
|
||||
var
|
||||
NewItem: TVpMenuItem;
|
||||
|
@ -128,6 +128,8 @@ type
|
||||
TVpWeekView = class(TVpLinkableControl)
|
||||
private
|
||||
FComponentHint: TTranslateString;
|
||||
FDefaultPopup: TPopupMenu;
|
||||
FExternalPopup: TPopupMenu;
|
||||
FHintMode: TVpHintMode;
|
||||
FMouseEvent: TVpEvent;
|
||||
FLayout: TVpWeekviewLayout;
|
||||
@ -136,6 +138,7 @@ type
|
||||
procedure SetActiveEvent(AValue: TVpEvent);
|
||||
procedure SetApplyCategoryInfos(AValue: Boolean);
|
||||
procedure SetLayout(AValue: TVpWeekviewLayout);
|
||||
procedure SetPopupMenu(AValue: TPopupMenu);
|
||||
protected{ private }
|
||||
FActiveDate: TDateTime;
|
||||
FColumnWidth: Integer;
|
||||
@ -152,7 +155,6 @@ type
|
||||
FShowEventTime: Boolean;
|
||||
FVisibleLines: Integer;
|
||||
FWeekStartsOn: TVpDayType;
|
||||
FDefaultPopup: TPopupMenu;
|
||||
FAllDayEventAttr: TVpAllDayEventAttributes;
|
||||
FAllowInplaceEdit: Boolean;
|
||||
FAllowDragAndDrop: Boolean;
|
||||
@ -202,6 +204,7 @@ type
|
||||
procedure SetWeekStartsOn(Value: TVpDayType);
|
||||
|
||||
{ Popup }
|
||||
function GetPopupMenu: TPopupMenu; override;
|
||||
procedure PopupAddEvent(Sender: TObject);
|
||||
procedure PopupAddFromICalFile(Sender: TObject);
|
||||
procedure PopupDeleteEvent(Sender: TObject);
|
||||
@ -242,6 +245,7 @@ type
|
||||
procedure MouseLeave; override;
|
||||
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
|
||||
procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X,Y: Integer); override;
|
||||
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
||||
procedure Paint; override;
|
||||
|
||||
{ drag and drop }
|
||||
@ -325,6 +329,7 @@ type
|
||||
{$IFDEF LCL}
|
||||
property BorderSpacing;
|
||||
{$ENDIF}
|
||||
property PopupMenu: TPopupMenu read GetPopupMenu write SetPopupMenu;
|
||||
property TabStop default true;
|
||||
property TabOrder;
|
||||
|
||||
@ -549,9 +554,10 @@ begin
|
||||
Height := 225;
|
||||
Width := 300;
|
||||
|
||||
FDefaultPopup := TPopupMenu.Create (Self);
|
||||
Self.PopupMenu := FDefaultPopup;
|
||||
FDefaultPopup := TPopupMenu.Create(Self);
|
||||
FDefaultPopup.Name := 'default';
|
||||
InitializeDefaultPopup;
|
||||
Self.PopupMenu := FDefaultPopup;
|
||||
|
||||
FAllDayEventAttr.BackgroundColor := Color;
|
||||
FAllDayEventAttr.EventBackgroundColor := clBtnFace;
|
||||
@ -1166,6 +1172,22 @@ end;
|
||||
|
||||
{ Popup menu }
|
||||
|
||||
function TVpWeekView.GetPopupMenu: TPopupMenu;
|
||||
begin
|
||||
if FExternalPopup = nil then
|
||||
Result := FDefaultPopup
|
||||
else
|
||||
Result := FExternalPopup;
|
||||
end;
|
||||
|
||||
procedure TVpWeekView.SetPopupMenu(AValue: TPopupMenu);
|
||||
begin
|
||||
if (AValue = nil) or (AValue = FDefaultPopup) then
|
||||
FExternalPopup := nil
|
||||
else
|
||||
FExternalPopup := AValue;
|
||||
end;
|
||||
|
||||
procedure TVpWeekView.InitializeDefaultPopup;
|
||||
var
|
||||
NewItem: TVpMenuItem;
|
||||
@ -1854,6 +1876,12 @@ begin
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
procedure TVpWeekView.Notification(AComponent: TComponent; Operation: TOperation);
|
||||
begin
|
||||
inherited;
|
||||
if (Operation = opRemove) and (AComponent = FExternalPopup) then
|
||||
FExternalPopup := nil;
|
||||
end;
|
||||
|
||||
{ TVpWvHeadAttributes }
|
||||
|
||||
|
Reference in New Issue
Block a user